HLPOST ;ALB/JRP - POST INIT DRIVER;23-MAR-95
;;1.6;HEALTH LEVEL SEVEN;;Oct 13, 1995
;DECLARE VARIABLES
N DIC,X,Y,ALRDYRUN,PROTINST,LISTINST,FILECNV,DATERUN
N ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK,%ZIS,POP,%DT,%H
;CREATE ENTRY IN HL COMMUNICATION SERVER PARAMETER FILE (#869.3)
D PARAM
;DETERMINE IF POST INIT HAS ALREADY BY RUN
S DIC="^DIC(9.4,"
S DIC(0)="X"
S X="HEALTH LEVEL SEVEN"
D ^DIC
S ALRDYRUN=+$P($G(^DIC(9.4,+Y,"INIT")),"^",2)
S (PROTINST,LISTINST,FILECNV)=1
;ALREADY RUN ASK USER WHAT TO DO
I (ALRDYRUN) D Q:(('PROTINST)&('LISTINST)&('FILECNV))
.;RUN POST-INIT AGAIN
.I ($$RUNAGAIN^HLPOSTQ(ALRDYRUN)<1) S (PROTINST,LISTINST,FILECNV)=0 Q
.;RE-INSTALL PROTOCOLS
.S PROTINST=$$PROTINST^HLPOSTQ
.I (PROTINST<0) S (PROTINST,LISTINST,FILECNV)=0 Q
.;RE-INSTALL LIST TEMPLATES
.S LISTINST=$$LISTINST^HLPOSTQ
.I (LISTINST<0) S (PROTINST,LISTINST,FILECNV)=0 Q
.;RE-RUN FILE CONVERSION
.S FILECNV=$$FILECNV^HLPOSTQ
.S:(FILECNV<0) (PROTINST,LISTINST,FILECNV)=0
;INSTALL PROTOCOLS
I (PROTINST) W !! D ^HLONIT
W:('PROTINST) !!,"Installation of PROTOCOLS not performed"
;INSTALL LIST TEMPLATES
I (LISTINST) W !! D ^HLLM
W:('LISTINST) !!,"Installation of LIST TEMPLATES not performed"
;NOT DOING FILE CONVERSION - DONE
I ('FILECNV) W !!,"Running of file conversions not performed" Q
CONVERT ;FILE CONVERSION
S %ZIS="QN0"
S %ZIS("A")="Select output device for file conversion: "
W !! D ^%ZIS
I (POP) W !!,"Running of the file conversions not performed" Q
;QUEUE TO DEVICE
I (IO'=IO(0)) D Q:($G(ZTSK))
.;USER SELECTED HOST FILE
.S:(IOT="HFS") IO("HFSIO")=IO
.;QUEUE
.S ZTRTN="^HLPOST16"
.S ZTDESC="FILE CONVERSIONS REQUIRED BY INSTALLATION OF HL7 V1.6"
.S ZTIO=ION
.S:('$D(IO("Q"))) ZTDTH=$H
.D ^%ZTLOAD
.;ERROR QUEUEING
.I ('$G(ZTSK)) D Q
..D HOME^%ZIS
..W !!,"** Running of file conversions could not be queued **"
..W !,"** File conversions will be run interactively **"
.;TELL USER TASK NUMBER & QUEUEING TIME
.D HOME^%ZIS
.S %H=ZTSK("D")
.D YX^%DTC
.S DATERUN=$P(Y,"@",1)_" @ "_$P(Y,"@",2)
.W !!,"Running of file conversions queued as task number ",ZTSK
.W !,"Task will begin execution on ",DATERUN
;INTERACTIVE
;OPEN SLAVE
I ($P(IOST,"-",1)["P") D
.S %ZIS=""
.S IOP=ION
.D ^%ZIS
;DO CONVERSIONS
D ^HLPOST16
;CLOSE SLAVE DEVICE
D ^%ZISC
;[RE]SET HOME DEVICE ATTRIBUTES
D HOME^%ZIS
Q
;
REQUEUE ;ENTRY POINT FOR REQUEUEING/RUNNING OF FILE CONVERSIONS
;DECLARE VARIABLES
N ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK,%ZIS,POP,%DT,DATERUN,%H
;QUEUE/RUN FILE CONVERSIONS
D CONVERT
;DONE
Q
PARAM ;CREATE INITIAL ENTRY IN HL COMMUNICATION SERVER PARAMETER file (#869.3)
;DECLARE VARIABLES
N DIC,X,Y,DTOUT,DUOUT,DLAYGO
;CREATE/FIND ENTRY
S DLAYGO=869.3
S DIC="^HLCS(869.3,"
S DIC(0)="L"
S DIC("DR")="11///1;12///1"
S X=1
D ^DIC
;Error
I (Y="-1") D Q
.W !!,"Unable to create/find entry in HL COMMUNICATION SERVER"
.W !,"PARAMETER file (#869.3). Entry must exist in order for"
.W !,"the incoming & outgoing filers to run. Use FileMan to"
.W !,"create an initial entry for editing.",!!
;Entry created
I ($P(Y,"^",3)) D
.;Tell user entry was created
.W !!,"Initial entry in HL COMMUNICATION SERVER PARAMETER file"
.W !,"(#869.3) has been created.",!
Q
HLPOST ;ALB/JRP - POST INIT DRIVER;23-MAR-95
+1 ;;1.6;HEALTH LEVEL SEVEN;;Oct 13, 1995
+2 ;DECLARE VARIABLES
+3 NEW DIC,X,Y,ALRDYRUN,PROTINST,LISTINST,FILECNV,DATERUN
+4 NEW ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK,%ZIS,POP,%DT,%H
+5 ;CREATE ENTRY IN HL COMMUNICATION SERVER PARAMETER FILE (#869.3)
+6 DO PARAM
+7 ;DETERMINE IF POST INIT HAS ALREADY BY RUN
+8 SET DIC="^DIC(9.4,"
+9 SET DIC(0)="X"
+10 SET X="HEALTH LEVEL SEVEN"
+11 DO ^DIC
+12 SET ALRDYRUN=+$PIECE($GET(^DIC(9.4,+Y,"INIT")),"^",2)
+13 SET (PROTINST,LISTINST,FILECNV)=1
+14 ;ALREADY RUN ASK USER WHAT TO DO
+15 IF (ALRDYRUN)
Begin DoDot:1
+16 ;RUN POST-INIT AGAIN
+17 IF ($$RUNAGAIN^HLPOSTQ(ALRDYRUN)<1)
SET (PROTINST,LISTINST,FILECNV)=0
QUIT
+18 ;RE-INSTALL PROTOCOLS
+19 SET PROTINST=$$PROTINST^HLPOSTQ
+20 IF (PROTINST<0)
SET (PROTINST,LISTINST,FILECNV)=0
QUIT
+21 ;RE-INSTALL LIST TEMPLATES
+22 SET LISTINST=$$LISTINST^HLPOSTQ
+23 IF (LISTINST<0)
SET (PROTINST,LISTINST,FILECNV)=0
QUIT
+24 ;RE-RUN FILE CONVERSION
+25 SET FILECNV=$$FILECNV^HLPOSTQ
+26 IF (FILECNV<0)
SET (PROTINST,LISTINST,FILECNV)=0
End DoDot:1
IF (('PROTINST)&('LISTINST)&('FILECNV))
QUIT
+27 ;INSTALL PROTOCOLS
+28 IF (PROTINST)
WRITE !!
DO ^HLONIT
+29 IF ('PROTINST)
WRITE !!,"Installation of PROTOCOLS not performed"
+30 ;INSTALL LIST TEMPLATES
+31 IF (LISTINST)
WRITE !!
DO ^HLLM
+32 IF ('LISTINST)
WRITE !!,"Installation of LIST TEMPLATES not performed"
+33 ;NOT DOING FILE CONVERSION - DONE
+34 IF ('FILECNV)
WRITE !!,"Running of file conversions not performed"
QUIT
CONVERT ;FILE CONVERSION
+1 SET %ZIS="QN0"
+2 SET %ZIS("A")="Select output device for file conversion: "
+3 WRITE !!
DO ^%ZIS
+4 IF (POP)
WRITE !!,"Running of the file conversions not performed"
QUIT
+5 ;QUEUE TO DEVICE
+6 IF (IO'=IO(0))
Begin DoDot:1
+7 ;USER SELECTED HOST FILE
+8 IF (IOT="HFS")
SET IO("HFSIO")=IO
+9 ;QUEUE
+10 SET ZTRTN="^HLPOST16"
+11 SET ZTDESC="FILE CONVERSIONS REQUIRED BY INSTALLATION OF HL7 V1.6"
+12 SET ZTIO=ION
+13 IF ('$DATA(IO("Q")))
SET ZTDTH=$HOROLOG
+14 DO ^%ZTLOAD
+15 ;ERROR QUEUEING
+16 IF ('$GET(ZTSK))
Begin DoDot:2
+17 DO HOME^%ZIS
+18 WRITE !!,"** Running of file conversions could not be queued **"
+19 WRITE !,"** File conversions will be run interactively **"
End DoDot:2
QUIT
+20 ;TELL USER TASK NUMBER & QUEUEING TIME
+21 DO HOME^%ZIS
+22 SET %H=ZTSK("D")
+23 DO YX^%DTC
+24 SET DATERUN=$PIECE(Y,"@",1)_" @ "_$PIECE(Y,"@",2)
+25 WRITE !!,"Running of file conversions queued as task number ",ZTSK
+26 WRITE !,"Task will begin execution on ",DATERUN
End DoDot:1
IF ($GET(ZTSK))
QUIT
+27 ;INTERACTIVE
+28 ;OPEN SLAVE
+29 IF ($PIECE(IOST,"-",1)["P")
Begin DoDot:1
+30 SET %ZIS=""
+31 SET IOP=ION
+32 DO ^%ZIS
End DoDot:1
+33 ;DO CONVERSIONS
+34 DO ^HLPOST16
+35 ;CLOSE SLAVE DEVICE
+36 DO ^%ZISC
+37 ;[RE]SET HOME DEVICE ATTRIBUTES
+38 DO HOME^%ZIS
+39 QUIT
+40 ;
REQUEUE ;ENTRY POINT FOR REQUEUEING/RUNNING OF FILE CONVERSIONS
+1 ;DECLARE VARIABLES
+2 NEW ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK,%ZIS,POP,%DT,DATERUN,%H
+3 ;QUEUE/RUN FILE CONVERSIONS
+4 DO CONVERT
+5 ;DONE
+6 QUIT
PARAM ;CREATE INITIAL ENTRY IN HL COMMUNICATION SERVER PARAMETER file (#869.3)
+1 ;DECLARE VARIABLES
+2 NEW DIC,X,Y,DTOUT,DUOUT,DLAYGO
+3 ;CREATE/FIND ENTRY
+4 SET DLAYGO=869.3
+5 SET DIC="^HLCS(869.3,"
+6 SET DIC(0)="L"
+7 SET DIC("DR")="11///1;12///1"
+8 SET X=1
+9 DO ^DIC
+10 ;Error
+11 IF (Y="-1")
Begin DoDot:1
+12 WRITE !!,"Unable to create/find entry in HL COMMUNICATION SERVER"
+13 WRITE !,"PARAMETER file (#869.3). Entry must exist in order for"
+14 WRITE !,"the incoming & outgoing filers to run. Use FileMan to"
+15 WRITE !,"create an initial entry for editing.",!!
End DoDot:1
QUIT
+16 ;Entry created
+17 IF ($PIECE(Y,"^",3))
Begin DoDot:1
+18 ;Tell user entry was created
+19 WRITE !!,"Initial entry in HL COMMUNICATION SERVER PARAMETER file"
+20 WRITE !,"(#869.3) has been created.",!
End DoDot:1
+21 QUIT