XBX12R ;IHS/ASDST/DMJ - READ X12 FILE [ 08/10/2004 12:13 PM ]
;;3.0;IHS/VA UTILITIES;**10**;
START ;start
D LOAD
D ^%ZISC
D VIEW
F D V2 Q:$G(XB12QUIT)
K ^TMP($J,"XB12")
K XB12QUIT,XB12CTR,XB12REC
Q
LOAD ;load file into global
W !!,"Load File",!
S %ZIS("B")="HFS"
D ^%ZIS
Q:POP
K ^TMP($J,"XB12")
S XB12REC=""
S XB12CTR=0
S XB12CTR2=0
S XB12DLM=""
F D Q:$$STATUS^%ZISH
.U IO R X#1
.Q:$$STATUS^%ZISH
.S XB12CTR2=XB12CTR2+1
.I XB12CTR2=106 S XB12DLM=X
.I X=XB12DLM D FILE Q
.S XB12REC=XB12REC_X
Q
FILE ;file
S XB12CTR=XB12CTR+1
S ^TMP($J,"XB12",XB12CTR)=XB12REC
S XB12REC=""
Q
VIEW ;view
S DA=0
F S DA=$O(^TMP($J,"XB12",DA)) Q:'DA D
.S XB12CTR=DA
W !,XB12CTR," segments loaded.",!
Q
V2 ;view continued
W !
S DIR(0)="LOC^1:"_XB12CTR
S DIR("A")="View lines"
D ^DIR K DIR
I Y["^" S XB12QUIT=1 Q
I Y="" S Y="1-"_XB12CTR
S XB12FR=+$P(Y,"-",1)
S XB12TO=+$P(Y,"-",2)
S:'XB12TO XB12TO=XB12FR
W @IOF
F I=XB12FR:1:XB12TO D Q:$G(XB12QUIT)
.I $Y+4>IOSL D
..S DIR(0)="E" D ^DIR K DIR
..I X["^" S XB12QUIT=1
..W @IOF
.Q:$G(XB12QUIT)
.W !
.W "(",I,") "
.W ^TMP($J,"XB12",I)
Q
XBX12R ;IHS/ASDST/DMJ - READ X12 FILE [ 08/10/2004 12:13 PM ]
+1 ;;3.0;IHS/VA UTILITIES;**10**;
START ;start
+1 DO LOAD
+2 DO ^%ZISC
+3 DO VIEW
+4 FOR
DO V2
IF $GET(XB12QUIT)
QUIT
+5 KILL ^TMP($JOB,"XB12")
+6 KILL XB12QUIT,XB12CTR,XB12REC
+7 QUIT
LOAD ;load file into global
+1 WRITE !!,"Load File",!
+2 SET %ZIS("B")="HFS"
+3 DO ^%ZIS
+4 IF POP
QUIT
+5 KILL ^TMP($JOB,"XB12")
+6 SET XB12REC=""
+7 SET XB12CTR=0
+8 SET XB12CTR2=0
+9 SET XB12DLM=""
+10 FOR
Begin DoDot:1
+11 USE IO
READ X#1
+12 IF $$STATUS^%ZISH
QUIT
+13 SET XB12CTR2=XB12CTR2+1
+14 IF XB12CTR2=106
SET XB12DLM=X
+15 IF X=XB12DLM
DO FILE
QUIT
+16 SET XB12REC=XB12REC_X
End DoDot:1
IF $$STATUS^%ZISH
QUIT
+17 QUIT
FILE ;file
+1 SET XB12CTR=XB12CTR+1
+2 SET ^TMP($JOB,"XB12",XB12CTR)=XB12REC
+3 SET XB12REC=""
+4 QUIT
VIEW ;view
+1 SET DA=0
+2 FOR
SET DA=$ORDER(^TMP($JOB,"XB12",DA))
IF 'DA
QUIT
Begin DoDot:1
+3 SET XB12CTR=DA
End DoDot:1
+4 WRITE !,XB12CTR," segments loaded.",!
+5 QUIT
V2 ;view continued
+1 WRITE !
+2 SET DIR(0)="LOC^1:"_XB12CTR
+3 SET DIR("A")="View lines"
+4 DO ^DIR
KILL DIR
+5 IF Y["^"
SET XB12QUIT=1
QUIT
+6 IF Y=""
SET Y="1-"_XB12CTR
+7 SET XB12FR=+$PIECE(Y,"-",1)
+8 SET XB12TO=+$PIECE(Y,"-",2)
+9 IF 'XB12TO
SET XB12TO=XB12FR
+10 WRITE @IOF
+11 FOR I=XB12FR:1:XB12TO
Begin DoDot:1
+12 IF $Y+4>IOSL
Begin DoDot:2
+13 SET DIR(0)="E"
DO ^DIR
KILL DIR
+14 IF X["^"
SET XB12QUIT=1
+15 WRITE @IOF
End DoDot:2
+16 IF $GET(XB12QUIT)
QUIT
+17 WRITE !
+18 WRITE "(",I,") "
+19 WRITE ^TMP($JOB,"XB12",I)
End DoDot:1
IF $GET(XB12QUIT)
QUIT
+20 QUIT