source: FOIAVistA/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQFIL18.m@ 1671

Last change on this file since 1671 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1VAQFIL18 ;ALB/JRP - MESSAGE FILING;18-MAY-93
2 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
3DATA(MESSNUM,PARSARR,TRANPTR) ;FILE ALL DATA BLOCKS
4 ;INPUT : MESSNUM - Message number in transmission (not XMZ)
5 ; (defaults to 1)
6 ; PARSARR - Parsing array (full global reference)
7 ; TRANPTR - Pointer to VAQ - TRANSACTION file
8 ; (As defined by MailMan)
9 ; XMFROM, XMREC,XMZ
10 ;OUTPUT : 0 - Success
11 ; -1^Error_Text - Error
12 ;NOTES : It is the responsibility of the calling program to correct
13 ; the transaction being updated if an error occurs.
14 ; : If the displayable segment can not be added, it will delete
15 ; the entry that is created for it in VAQ - DATA file.
16 ;
17 ;CHECK INPUT
18 S:($G(MESSNUM)="") MESSNUM=1
19 Q:($G(PARSARR)="") "-1^Did not pass reference to parsing array"
20 Q:('$D(@PARSARR@(MESSNUM))) "-1^Did not pass valid message number"
21 Q:('$D(@PARSARR@(MESSNUM,"DATA"))) 0
22 S TRANPTR=+$G(TRANPTR)
23 Q:(('TRANPTR)!('$D(^VAT(394.61,TRANPTR)))) "-1^Did not pass a valid transaction"
24 ;DECLARE VARIABLES
25 N BLOCKSEQ,TMP,TYPE,SEQ,ERR,OFFSET,DATAPTR,SEGABB,FILE,FIELD,TMPARR
26 N DECRYPT,KEY1,KEY2,STRING,DECSTR,DECMTHD,ENCRYPT,VALUE,ID,SEQCNT
27 S TMPARR="^TMP(""VAQ-TMP"","_$J_")"
28 K @TMPARR
29 ;GET MESSAGE TYPE
30 S TMP=$$STATYPE^VAQFIL11(MESSNUM,PARSARR)
31 Q:($P(TMP,"^",1)="-1") "-1^Could not determine message type"
32 S TYPE=$P(TMP,"^",2)
33 ;ACK & RETRANSMIT & REQUEST DON'T HAVE DATA BLOCKS
34 Q:((TYPE="ACK")!(TYPE="RET")!(TYPE="REQ")) "-1^Message type does not require display block"
35 ;GET DECRYPTION METHOD & KEYS
36 S DECMTHD=$$DECMTHD^VAQFIL11(MESSNUM,PARSARR,2)
37 S KEY1=$$KEY^VAQFIL13(MESSNUM,PARSARR,1)
38 S KEY2=$$KEY^VAQFIL13(MESSNUM,PARSARR,0)
39 ;LOOP THROUGH EACH DATA BLOCK
40 S BLOCKSEQ=""
41 F S BLOCKSEQ=$O(@PARSARR@(MESSNUM,"DATA",BLOCKSEQ)) Q:(BLOCKSEQ="") D
42 .;MAKE SURE IT'S A DATA BLOCK
43 .S TMP=$G(@PARSARR@(MESSNUM,"DATA",BLOCKSEQ,1))
44 .S:(TMP=" ") TMP=""
45 .Q:((TMP="")!(TMP'="$DATA"))
46 .;GET SEGMENT ABBREVIATION
47 .S SEGABB=$G(@PARSARR@(MESSNUM,"DATA",BLOCKSEQ,2))
48 .S:(SEGABB=" ") SEGABB=""
49 .Q:((SEGABB="")!(SEGABB="$$DATA"))
50 .;CREATE EXTRACTION ARRAY FOR DATA BLOCK
51 .K @TMPARR
52 .S OFFSET=2
53 .F S OFFSET=$O(@PARSARR@(MESSNUM,"DATA",BLOCKSEQ,OFFSET)) Q:(OFFSET="") D Q:(OFFSET="")
54 ..;READ DESCRIPTION BLOCK
55 ..S TMP=$G(@PARSARR@(MESSNUM,"DATA",BLOCKSEQ,OFFSET))
56 ..S:(TMP=" ") TMP=""
57 ..Q:((TMP="")!(TMP="$$DATA"))
58 ..S ENCRYPT=+$P(TMP,"^",1)
59 ..S FILE=+$P(TMP,"^",2)
60 ..S FIELD=+$P(TMP,"^",3)
61 ..S SEQCNT=+$P(TMP,"^",4)
62 ..Q:(('FILE)!('FIELD)!('SEQCNT))
63 ..;READ EACH VALUE & ID
64 ..S SEQCNT=SEQCNT-1
65 ..F SEQ=0:1:SEQCNT D Q:(OFFSET="")
66 ...S OFFSET=$O(@PARSARR@(MESSNUM,"DATA",BLOCKSEQ,OFFSET))
67 ...Q:(OFFSET="")
68 ...S VALUE=$G(@PARSARR@(MESSNUM,"DATA",BLOCKSEQ,OFFSET))
69 ...S:(VALUE=" ") VALUE=""
70 ...S OFFSET=$O(@PARSARR@(MESSNUM,"DATA",BLOCKSEQ,OFFSET))
71 ...Q:(OFFSET="")
72 ...S ID=$G(@PARSARR@(MESSNUM,"DATA",BLOCKSEQ,OFFSET))
73 ...S:(ID=" ") ID=""
74 ...;SET UP FOR DECRYPTION
75 ...Q:((ENCRYPT)&(DECMTHD=""))
76 ...S:(ENCRYPT) DECRYPT=("S DECSTR="_DECMTHD)
77 ...S:('ENCRYPT) DECRYPT="S DECSTR=STRING"
78 ...Q:((ENCRYPT)&((KEY1="")!(KEY2="")))
79 ...;DECRYPT VALUE
80 ...S STRING=VALUE
81 ...X DECRYPT
82 ...S VALUE=DECSTR
83 ...;REBUILD EXTRACTION ARRAY (REMEMBER IF VALUE WAS DECRYPTED)
84 ...S @TMPARR@("VALUE",FILE,FIELD,SEQ)=VALUE
85 ...S @TMPARR@("ID",FILE,FIELD,SEQ)=ID
86 ...I (STRING'="") S:(STRING'=DECSTR) @TMPARR@("DECRYPT",STRING)=DECSTR
87 ..Q:(OFFSET="")
88 .;STORE INFORMATION
89 .S FILE=""
90 .F S FILE=$O(@TMPARR@("VALUE",FILE)) Q:(FILE="") D
91 ..S FIELD=""
92 ..F S FIELD=$O(@TMPARR@("VALUE",FILE,FIELD)) Q:(FIELD="") D
93 ...S SEQ=""
94 ...F S SEQ=$O(@TMPARR@("VALUE",FILE,FIELD,SEQ)) Q:(SEQ="") D
95 ....S VALUE=$G(@TMPARR@("VALUE",FILE,FIELD,SEQ))
96 ....S ID=$G(@TMPARR@("ID",FILE,FIELD,SEQ))
97 ....;SEE IF ID SHOULD BE DECRYPTED
98 ....I (ID'="") S:($D(@TMPARR@("DECRYPT",ID))) ID=$G(@TMPARR@("DECRYPT",ID))
99 ....;MAKE STUB ENTRY IN DATA FILE
100 ....S DATAPTR=$$STUBDATA^VAQFILE1(SEGABB,TRANPTR)
101 ....Q:(DATAPTR<0)
102 ....;STORE DATA
103 ....S TMP=$$FILEINFO^VAQFILE(394.62,DATAPTR,.03,FILE)
104 ....I (TMP) S TMP=$$DELDATA^VAQFILE1(DATAPTR) Q
105 ....S TMP=$$FILEINFO^VAQFILE(394.62,DATAPTR,.04,FIELD)
106 ....I (TMP) S TMP=$$DELDATA^VAQFILE1(DATAPTR) Q
107 ....S TMP=$$FILEINFO^VAQFILE(394.62,DATAPTR,10,VALUE)
108 ....I (TMP) S TMP=$$DELDATA^VAQFILE1(DATAPTR) Q
109 ....S TMP=$$FILEINFO^VAQFILE(394.62,DATAPTR,20,ID)
110 ....I (TMP) S TMP=$$DELDATA^VAQFILE1(DATAPTR) Q
111 ....S TMP=$$FILEINFO^VAQFILE(394.62,DATAPTR,30,SEQ)
112 ....I (TMP) S TMP=$$DELDATA^VAQFILE1(DATAPTR) Q
113 .K @TMPARR
114 K @TMPARR
115 Q 0
Note: See TracBrowser for help on using the repository browser.