1 | VAQCON5 ;ALB/JRP - MESSAGE CONSTRUCTION;2-SEP-93
|
---|
2 | ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
|
---|
3 | SEGMENT(TRANPTR,MESSNUM,ARRAY,OFFSET) ;CONSTRUCT SEGMENT BLOCK
|
---|
4 | ;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
|
---|
5 | ; MESSNUM - Message number to place block into
|
---|
6 | ; (if 0, block will be placed in ARRAY)
|
---|
7 | ; ARRAY - Array to store block in (full global reference)
|
---|
8 | ; OFFSET - Where to begin placing information (defaults to 0)
|
---|
9 | ;OUTPUT : N - Number of lines in block
|
---|
10 | ; -1^Error_Text - Error
|
---|
11 | ;NOTES : If MESSNUM=0, then the block will be placed into
|
---|
12 | ; ARRAY(LineNumber)=Line_of_info
|
---|
13 | ; If MESSNUM>0 then the block will be placed into
|
---|
14 | ; ^XMB(3.9,MESSNUM,2,LineNumber,0)=Line_of_info
|
---|
15 | ;
|
---|
16 | ;CHECK INPUT
|
---|
17 | S TRANPTR=+$G(TRANPTR)
|
---|
18 | Q:(('TRANPTR)!('$D(^VAT(394.61,TRANPTR)))) "-1^Did not pass a valid pointer to VAQ - TRANSACTION file"
|
---|
19 | S MESSNUM=+$G(MESSNUM)
|
---|
20 | I (('MESSNUM)&($G(ARRAY)="")) Q "-1^Did not pass message number of reference to array"
|
---|
21 | I (MESSNUM) Q:('$D(^XMB(3.9,MESSNUM))) "-1^Valid message number not passed"
|
---|
22 | S OFFSET=+$G(OFFSET)
|
---|
23 | ;DECLARE VARIABLES
|
---|
24 | N TMP,LINE,SEGABB,SEGPTR,TYPE,X,SEGMNT,TIMLIM,OCCLIM,LOOP
|
---|
25 | S LINE=OFFSET
|
---|
26 | ;LINE 1
|
---|
27 | S TMP="$SEGMENT"
|
---|
28 | S:('MESSNUM) @ARRAY@(LINE)=TMP
|
---|
29 | S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
|
---|
30 | S LINE=LINE+1
|
---|
31 | ;SEGMENTS
|
---|
32 | S SEGMNT=0
|
---|
33 | F S SEGMNT=$O(^VAT(394.61,TRANPTR,"SEG",SEGMNT)) Q:('SEGMNT) D
|
---|
34 | .S TMP=$G(^VAT(394.61,TRANPTR,"SEG",SEGMNT,0))
|
---|
35 | .S SEGPTR=+TMP
|
---|
36 | .S TIMLIM=$P(TMP,"^",2)
|
---|
37 | .S OCCLIM=$P(TMP,"^",3)
|
---|
38 | .Q:('SEGPTR)
|
---|
39 | .S SEGABB=$P($G(^VAT(394.71,SEGPTR,0)),"^",2)
|
---|
40 | .Q:(SEGABB="")
|
---|
41 | .F LOOP=SEGABB,TIMLIM,OCCLIM D
|
---|
42 | ..S:('MESSNUM) @ARRAY@(LINE)=LOOP
|
---|
43 | ..S:(MESSNUM) X=$$ADDLINE^VAQCON1(LOOP,MESSNUM,LINE)
|
---|
44 | ..S LINE=LINE+1
|
---|
45 | ;LINE Z
|
---|
46 | S TMP="$$SEGMENT"
|
---|
47 | S:('MESSNUM) @ARRAY@(LINE)=TMP
|
---|
48 | S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
|
---|
49 | S LINE=LINE+1
|
---|
50 | Q (LINE-OFFSET)
|
---|