source: FOIAVistA/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQFIL14.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 2.3 KB
Line 
1VAQFIL14 ;ALB/JRP - MESSAGE FILING;12-MAY-93
2 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
3COMMENT(MESSNUM,PARSARR,TRANPTR) ;FILE COMMENT BLOCK
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 ;
15 ;CHECK INPUT
16 S:($G(MESSNUM)="") MESSNUM=1
17 Q:($G(PARSARR)="") "-1^Did not pass reference to parsing array"
18 Q:('$D(@PARSARR@(MESSNUM))) "-1^Did not pass valid message number"
19 Q:('$D(@PARSARR@(MESSNUM,"COMMENT",1))) "-1^Message did not contain a comment block"
20 S TRANPTR=+$G(TRANPTR)
21 Q:(('TRANPTR)!('$D(^VAT(394.61,TRANPTR)))) "-1^Did not pass a valid transaction"
22 ;DECLARE VARIABLES
23 N TMP,TYPE,LINE,ERR,OFFSET
24 ;MAKE SURE IT'S A COMMENT BLOCK
25 S TMP=$G(@PARSARR@(MESSNUM,"COMMENT",1,1))
26 S:(TMP=" ") TMP=""
27 Q:((TMP="")!(TMP'="$COMMENT")) "-1^Not a comment block"
28 S TMP=$G(@PARSARR@(MESSNUM,"COMMENT",1,2))
29 Q:(TMP="$$COMMENT") 0
30 ;GET MESSAGE TYPE
31 S TMP=$$STATYPE^VAQFIL11(MESSNUM,PARSARR)
32 Q:($P(TMP,"^",1)="-1") "-1^Could not determine message type"
33 S TYPE=$P(TMP,"^",2)
34 ;ACK & RETRANSMIT & REQUEST DON'T HAVE COMMENT BLOCK
35 Q:((TYPE="ACK")!(TYPE="RET")!(TYPE="REQ")) "-1^Message type does not require comment block"
36 ;DELETE EXISTING COMMENT
37 S ERR=0
38 I ($D(^VAT(394.61,TRANPTR,"CMNT"))) D
39 .S ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,100,"@")
40 Q:(ERR) "-1^Unable to delete existing comment"
41 ;PUT BLANK LINE INTO COMMENT (SETS ZERO NODE)
42 S ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,100," ")
43 Q:(ERR) "-1^Unable to store comment"
44 ;STORE COMMENT
45 S LINE=1
46 S OFFSET=1
47 S TMP=""
48 F S OFFSET=$O(@PARSARR@(MESSNUM,"COMMENT",1,OFFSET)) Q:(OFFSET="") D Q:(TMP="$$COMMENT")
49 .S TMP=$G(@PARSARR@(MESSNUM,"COMMENT",1,OFFSET))
50 .Q:(TMP="$$COMMENT")
51 .S ^VAT(394.61,TRANPTR,"CMNT",LINE,0)=TMP
52 .S LINE=LINE+1
53 I (TMP'="$$COMMENT") S ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,100,"@") Q "-1^Not a valid comment"
54 ;UPDATE ZERO NODE
55 S LINE=LINE-1
56 S TMP=$G(^VAT(394.61,TRANPTR,"CMNT",0))
57 S $P(TMP,"^",3)=LINE
58 S $P(TMP,"^",4)=LINE
59 S ^VAT(394.61,TRANPTR,"CMNT",0)=TMP
60 Q 0
Note: See TracBrowser for help on using the repository browser.