INHSZ72 ;JSH; 29 Sep 93 11:42;Script Compiler - FILE command
;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
;COPYRIGHT 1991-2000 SAIC
;
FILE ;Process a FILE command
I MULT!OTHER!FILEB D ERROR^INHSZ0("Cannot nest a FILE block.",1) Q
N %1,F,V
S %1=$$LBTB^UTIL($P(LINE,COMM,2,99)),F=$$LBTB^UTIL($P(%1,";")),V=$$LBTB^UTIL($P(%1,";",2))
I F="" D ERROR^INHSZ0("File missing from FILE command.",1) Q
I V="" D ERROR^INHSZ0("Variable missing from FILE command.",1) Q
I '$D(DICOMPX(V)) D WARN^INHSZ0("Identifier variable in FILE command not known.",1)
I F,'$D(^DIC(F,0)) D ERROR^INHSZ0("File #"_F_" not found.",1) Q
I 'F D Q:ER
. S DIC=1,DIC(0)="",X=F X "N F,V D ^DIC" I Y<0 D ERROR^INHSZ0("File '"_F_"' is unknown or ambiguous.",1) Q
. S F=+Y
S FILE=F_^DIC(F,0,"GL"),FILEB=1,LOOKUP=0
S A=" ;"_LINE D L
I '$D(LVARS(V)) D Q
. S A=" K MDESC S INDA=0,IDENT=$G(@INV@("""_V_""")),MDESC(2)="".01 = ""_IDENT K FIELD" D L
. S LPARAM="",IDENT=1,MCNT=2
;If var is a loop
D RLB^INHSZ51
Q
;
ENDFILE ;End of FILE block
;I REPEAT S UP^INHSZ1 S SLVL=SLVL-1,FILEB=0
Q
L ;Should be call to another routine
Q
;
INHSZ72 ;JSH; 29 Sep 93 11:42;Script Compiler - FILE command
+1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
+2 ;COPYRIGHT 1991-2000 SAIC
+3 ;
FILE ;Process a FILE command
+1 IF MULT!OTHER!FILEB
DO ERROR^INHSZ0("Cannot nest a FILE block.",1)
QUIT
+2 NEW %1,F,V
+3 SET %1=$$LBTB^UTIL($PIECE(LINE,COMM,2,99))
SET F=$$LBTB^UTIL($PIECE(%1,";"))
SET V=$$LBTB^UTIL($PIECE(%1,";",2))
+4 IF F=""
DO ERROR^INHSZ0("File missing from FILE command.",1)
QUIT
+5 IF V=""
DO ERROR^INHSZ0("Variable missing from FILE command.",1)
QUIT
+6 IF '$DATA(DICOMPX(V))
DO WARN^INHSZ0("Identifier variable in FILE command not known.",1)
+7 IF F
IF '$DATA(^DIC(F,0))
DO ERROR^INHSZ0("File #"_F_" not found.",1)
QUIT
+8 IF 'F
Begin DoDot:1
+9 SET DIC=1
SET DIC(0)=""
SET X=F
XECUTE "N F,V D ^DIC"
IF Y<0
DO ERROR^INHSZ0("File '"_F_"' is unknown or ambiguous.",1)
QUIT
+10 SET F=+Y
End DoDot:1
IF ER
QUIT
+11 SET FILE=F_^DIC(F,0,"GL")
SET FILEB=1
SET LOOKUP=0
+12 SET A=" ;"_LINE
DO L
+13 IF '$DATA(LVARS(V))
Begin DoDot:1
+14 SET A=" K MDESC S INDA=0,IDENT=$G(@INV@("""_V_""")),MDESC(2)="".01 = ""_IDENT K FIELD"
DO L
+15 SET LPARAM=""
SET IDENT=1
SET MCNT=2
End DoDot:1
QUIT
+16 ;If var is a loop
+17 DO RLB^INHSZ51
+18 QUIT
+19 ;
ENDFILE ;End of FILE block
+1 ;I REPEAT S UP^INHSZ1 S SLVL=SLVL-1,FILEB=0
+2 QUIT
L ;Should be call to another routine
+1 QUIT
+2 ;