VENPCC25 ; IHS/OIT/GIS - FACILITY PRINT DEAMON ;
;;2.6;PCC+;;NOV 12, 2007
;
; NEW DATA FILE UTILITIES
; WORKS WITH VER 2.5 PRINT SERVICE
;
INIT ; EP - DIRVER
N MN F MN="ef","25","pn","hs" D POP(MN)
Q
;
POP(MN) ; EP-POPULATE THE NEW HEADER FILE
N STG,PATH,FILE,POP,REC,DIC,DA,X,Y,LEN,PCE
S PATH=$G(^VEN(7.5,$$CFG^VENPCCU,2)) I '$L(PATH) Q
S FILE=MN_"HEADER.TXT"
S DIC="^VEN(7.49,",DIC(0)="L"
S X=MN,DLAYGO=19707.49
D ^DIC I Y=-1 Q
S DA(1)=+Y S DIC=DIC_DA(1)_",1,"
S DIC(0)="LX" S DIC("P")=19707.491
S POP=$$OPN^VENPCCP(PATH,FILE,"R","R REC")
S LEN=$L(REC,U)
F PCE=1:1:LEN S X=$P(REC,U,PCE) D ^DIC
Q
;
DOLD(FILE) ; EP-CONVERT A VER 2.5 DATA FILE TO A TRADITIONAL DATA FILE
I '$L($G(FILE)) Q
N PATH,REC,X,Y,ZPCE,STG1,STG2,POP
S PATH=$G(^VEN(7.5,$$CFG^VENPCCU,1)) I '$L(PATH) Q
S POP=$$OPN^VENPCCP(PATH,FILE,"R","R REC") I POP Q
I '$L(REC) Q
S L=$L(REC,U),STG1="",STG2=""
F PCE=1:1:L D
. S X=$P(REC,U,PCE)
. S Y=$P(X,$C(30))
. S Z=$P(X,$C(30),2)
. I PCE>1 S STG1=STG1_U
. S STG1=STG1_Y
. I PCE>1 S STG2=STG2_U
. S STG2=STG2_Z
. Q
S POP=$$OPN^VENPCCP(PATH,FILE,"W","W STG1,!,STG2")
Q
;
HOLD(MN) ; EP-CREATE A TRADITIONAL HEADER FILE FROM THE CONTENTS OF VEN EHP HEADER GROUP
I '$L(MN) Q
N FILE,PATH,HFIEN,POP
S FILE=MN_"header.txt"
S PATH=$G(^VEN(7.5,$$CFG^VENPCCU,2)) I '$L(PATH) Q
S POP=$$OPN^VENPCCP(PATH,FILE,"W","D HPOP^VENPCC25(MN)") I POP Q
D CONVERT^VENPCCU(MN,2) ; ALSO CREAT THE PRINT SERVER HEADER FILE
Q
;
HPOP(MN) ; EP-POPULATE THE HEADER FILE
I '$L(MN) Q
N HFIEN,MMF,CNT,MIEN
S HFIEN=$O(^VEN(7.49,"B",MN,0)) I 'HFIEN Q
S CNT=0,MIEN=0
F S MIEN=$O(^VEN(7.49,HFIEN,1,MIEN)) Q:'MIEN D
. S MMF=$P($G(^VEN(7.49,HFIEN,1,MIEN,0)),U)
. S CNT=CNT+1
. I CNT>1 W U
. W MMF
. Q
Q
DEMODATA ; EP-CREATE A DEMO DATA FILE FOR BUILDING PCC+ TEMPLATES ; FOR VER 2.5 AND WIN XP
N DIR,DA,DEMODATA,REC,PATH,FILE,POP,DLM,X,HDR,HIEN,HGIEN,%
S DIR(0)="FO^1:20",DIR("A")="Name of test data file"
S DIR("?")="Example: 'eftest'. No file extension reqd." D ^DIR
I Y'?2.20AN G DDX
S DEMODATA=Y
D DEMODATA^VENPCC
S FILE=DEMODATA_".txt"
S PATH=$G(^VEN(7.5,$$CFG^VENPCCU,3)) I '$L(PATH) G DDX
S POP=$$OPN^VENPCCP(PATH,FILE,"R","R REC")
I POP W !,"Unable to generate test file. Request cancelled..." G DDX
S DLM="",X=$L(REC,U)
S $P(DLM,U,X)=""
S HGIEN=$O(^VEN(7.49,"B","25",0)) I 'HGIEN G DDX
S HDR="",HIEN=0
F S HIEN=$O(^VEN(7.49,HGIEN,1,HIEN)) Q:'HIEN D
. S %=$G(^VEN(7.49,HGIEN,1,HIEN,0))
. I $L(HDR) S HDR=HDR_U
. S HDR=HDR_%
. Q
DDF S POP=$$OPN^VENPCCP(PATH,FILE,"W","W HDR,!,REC,!,DLM")
DDX D ^XBFMK
Q
;
VENPCC25 ; IHS/OIT/GIS - FACILITY PRINT DEAMON ;
+1 ;;2.6;PCC+;;NOV 12, 2007
+2 ;
+3 ; NEW DATA FILE UTILITIES
+4 ; WORKS WITH VER 2.5 PRINT SERVICE
+5 ;
INIT ; EP - DIRVER
+1 NEW MN
FOR MN="ef","25","pn","hs"
DO POP(MN)
+2 QUIT
+3 ;
POP(MN) ; EP-POPULATE THE NEW HEADER FILE
+1 NEW STG,PATH,FILE,POP,REC,DIC,DA,X,Y,LEN,PCE
+2 SET PATH=$GET(^VEN(7.5,$$CFG^VENPCCU,2))
IF '$LENGTH(PATH)
QUIT
+3 SET FILE=MN_"HEADER.TXT"
+4 SET DIC="^VEN(7.49,"
SET DIC(0)="L"
+5 SET X=MN
SET DLAYGO=19707.49
+6 DO ^DIC
IF Y=-1
QUIT
+7 SET DA(1)=+Y
SET DIC=DIC_DA(1)_",1,"
+8 SET DIC(0)="LX"
SET DIC("P")=19707.491
+9 SET POP=$$OPN^VENPCCP(PATH,FILE,"R","R REC")
+10 SET LEN=$LENGTH(REC,U)
+11 FOR PCE=1:1:LEN
SET X=$PIECE(REC,U,PCE)
DO ^DIC
+12 QUIT
+13 ;
DOLD(FILE) ; EP-CONVERT A VER 2.5 DATA FILE TO A TRADITIONAL DATA FILE
+1 IF '$LENGTH($GET(FILE))
QUIT
+2 NEW PATH,REC,X,Y,ZPCE,STG1,STG2,POP
+3 SET PATH=$GET(^VEN(7.5,$$CFG^VENPCCU,1))
IF '$LENGTH(PATH)
QUIT
+4 SET POP=$$OPN^VENPCCP(PATH,FILE,"R","R REC")
IF POP
QUIT
+5 IF '$LENGTH(REC)
QUIT
+6 SET L=$LENGTH(REC,U)
SET STG1=""
SET STG2=""
+7 FOR PCE=1:1:L
Begin DoDot:1
+8 SET X=$PIECE(REC,U,PCE)
+9 SET Y=$PIECE(X,$CHAR(30))
+10 SET Z=$PIECE(X,$CHAR(30),2)
+11 IF PCE>1
SET STG1=STG1_U
+12 SET STG1=STG1_Y
+13 IF PCE>1
SET STG2=STG2_U
+14 SET STG2=STG2_Z
+15 QUIT
End DoDot:1
+16 SET POP=$$OPN^VENPCCP(PATH,FILE,"W","W STG1,!,STG2")
+17 QUIT
+18 ;
HOLD(MN) ; EP-CREATE A TRADITIONAL HEADER FILE FROM THE CONTENTS OF VEN EHP HEADER GROUP
+1 IF '$LENGTH(MN)
QUIT
+2 NEW FILE,PATH,HFIEN,POP
+3 SET FILE=MN_"header.txt"
+4 SET PATH=$GET(^VEN(7.5,$$CFG^VENPCCU,2))
IF '$LENGTH(PATH)
QUIT
+5 SET POP=$$OPN^VENPCCP(PATH,FILE,"W","D HPOP^VENPCC25(MN)")
IF POP
QUIT
+6 ; ALSO CREAT THE PRINT SERVER HEADER FILE
DO CONVERT^VENPCCU(MN,2)
+7 QUIT
+8 ;
HPOP(MN) ; EP-POPULATE THE HEADER FILE
+1 IF '$LENGTH(MN)
QUIT
+2 NEW HFIEN,MMF,CNT,MIEN
+3 SET HFIEN=$ORDER(^VEN(7.49,"B",MN,0))
IF 'HFIEN
QUIT
+4 SET CNT=0
SET MIEN=0
+5 FOR
SET MIEN=$ORDER(^VEN(7.49,HFIEN,1,MIEN))
IF 'MIEN
QUIT
Begin DoDot:1
+6 SET MMF=$PIECE($GET(^VEN(7.49,HFIEN,1,MIEN,0)),U)
+7 SET CNT=CNT+1
+8 IF CNT>1
WRITE U
+9 WRITE MMF
+10 QUIT
End DoDot:1
+11 QUIT
DEMODATA ; EP-CREATE A DEMO DATA FILE FOR BUILDING PCC+ TEMPLATES ; FOR VER 2.5 AND WIN XP
+1 NEW DIR,DA,DEMODATA,REC,PATH,FILE,POP,DLM,X,HDR,HIEN,HGIEN,%
+2 SET DIR(0)="FO^1:20"
SET DIR("A")="Name of test data file"
+3 SET DIR("?")="Example: 'eftest'. No file extension reqd."
DO ^DIR
+4 IF Y'?2.20AN
GOTO DDX
+5 SET DEMODATA=Y
+6 DO DEMODATA^VENPCC
+7 SET FILE=DEMODATA_".txt"
+8 SET PATH=$GET(^VEN(7.5,$$CFG^VENPCCU,3))
IF '$LENGTH(PATH)
GOTO DDX
+9 SET POP=$$OPN^VENPCCP(PATH,FILE,"R","R REC")
+10 IF POP
WRITE !,"Unable to generate test file. Request cancelled..."
GOTO DDX
+11 SET DLM=""
SET X=$LENGTH(REC,U)
+12 SET $PIECE(DLM,U,X)=""
+13 SET HGIEN=$ORDER(^VEN(7.49,"B","25",0))
IF 'HGIEN
GOTO DDX
+14 SET HDR=""
SET HIEN=0
+15 FOR
SET HIEN=$ORDER(^VEN(7.49,HGIEN,1,HIEN))
IF 'HIEN
QUIT
Begin DoDot:1
+16 SET %=$GET(^VEN(7.49,HGIEN,1,HIEN,0))
+17 IF $LENGTH(HDR)
SET HDR=HDR_U
+18 SET HDR=HDR_%
+19 QUIT
End DoDot:1
DDF SET POP=$$OPN^VENPCCP(PATH,FILE,"W","W HDR,!,REC,!,DLM")
DDX DO ^XBFMK
+1 QUIT
+2 ;