PRCTBAR ;WISC@ALTOONA/RGY-SEND A IRL PROGRAM TO BAR CODE READER ;3.13.98
;;5.1;IFCAP;;Oct 20, 2000
;Per VHA Directive 10-93-142, this routine should not be modified.
S:'$D(PRCTID) PRCTID="" S:PRCTID]"" PRCTID=$O(^PRCT(446.4,"C",PRCTID,"")) I PRCTID="" S DIC="^PRCT(446.4,",DIC(0)="QEAM",DIC("S")="I $P(^(0),U,12)" D ^DIC K DIC("S") G:Y<0 Q S PRCTID=+Y
DEV ;
N TIME,PRX
W:'$D(IOP) !!,"OK, please enter the device to which the bar code reader is connected.",!
D ^%ZIS G:POP Q
S PRCTEON=^%ZOSF("EON"),PRCTEOFF=^%ZOSF("EOFF"),PRCTTYPE=^%ZOSF("TYPE-AHEAD"),PRCTOPEN=$G(^%ZIS(2,IOST(0),10)),PRCTCLOS=$G(^%ZIS(2,IOST(0),11))
U IO D OFF D WARN^PRCTMES1 R X:DTIME G:X="^" Q
D ON S PRCT=+$P(^PRCT(446.4,PRCTID,0),"^",9)_"^2" D SPC^PRCTLAB H 3
S TIME=$P($H,",",2)
; for janus readers
N PRCTJNUS
I $TR($P($G(^PRCT(446.6,+$P($G(^PRCT(446.4,PRCTID,0)),"^",9),0)),"^"),"janus","JANUS")["JANUS" S PRCTJNUS=1
F LN=0:0 S LN=$O(^PRCT(446.4,PRCTID,1,LN)) Q:'LN I $D(^(LN,0)) S X=^(0) D LN I X]"" W:$G(PRCTJNUS) $C(15) W X W:$G(PRCTJNUS) $C(22) W ! D:$G(PRCTJNUS)
. D OFF W *0
. D ON
S PRCT=+$P(^PRCT(446.4,PRCTID,0),"^",9)_"^3" D SPC^PRCTLAB
F I=1:1:5 R PRX(I):5 Q:'$T
D OFF,^%ZISC
W !!,"Download time: "_($P($H,",",2)-TIME)_" sec."
I $G(PRX(1))=$C(30) W !,"DOWNLOAD SUCCESSFUL, you may now disconnect the bar code reader.",!!
Q ;
D HOME^%ZIS K I,LN,%DT,POP,PRCTID,DIC,IOP Q
LN ;
S X=$P(X,"::") F Y=$L(X):-1:0 Q:$E(X,Y)'=" " S X=$E(X,1,Y-1)
I '$D(COL1) S:X["|" X=$P(X,"|")_@$P(X,"|",2)_$P(X,"|",3)
Q
;
ON X PRCTOPEN U IO X PRCTEOFF,PRCTTYPE
Q
;
OFF X PRCTCLOS,PRCTEON U IO(0)
Q
;
COM ;Entry point to allow the alignment of IRL comments in Barcode Program file
S DIC="^PRCT(446.4,",DIC(0)="QEAM" D ^DIC G:Y<0 Q2 S PRCTID=+Y
S X="At what character do you want comments to begin at ?^35^^^COM^PRCTMES1^1" D ^PRCTQUES G:X="^" Q2 S COL1=X
S X="From line no. ?^1^^^COM1^PRCTMES1^1" D ^PRCTQUES G:X="^" Q2 S LN1=X
S X="To line no. ?^"_$S($D(^PRCT(446.4,PRCTID,1,0)):$P(^(0),"^",4),1:"")_"^^^COM2^PRCTMES1^1" D ^PRCTQUES G:X="^" Q2 S LN2=X
F LN=LN1-1:0 S LN=$O(^PRCT(446.4,PRCTID,1,LN)) Q:'LN!(LN>LN2) I $D(^(LN,0)) S X=^(0),Y=COL1 D CON S ^PRCT(446.4,PRCTID,1,LN,0)=Y W "."
W "... Done"
Q2 K COL1,LN,PRCTID,TLN,LN1,LN2,LN3 Q
CON ;X=IRL TEXT,Y=COLUMN TO START COMMENTS, Can be called from Fileman
S COL=Y,(LN1,Y)=X G:X'["::" Q3 D LN F Y=0:0 Q:COL-3<$L(X) S X=X_" "
S:$A($E(X,$L(X)))>32 X=X_" " S Y=X_"::"_$P(LN1,"::",2)
Q3 K LN1,COL Q
IDENT ; Called by input transform for IDENTIFIER (446.4,.02)
I $D(^PRCT(446.4,"C",X)),$O(^(X,""))'=DA S X=$O(^("")) W !,"This IDENTIFIER already exists for ",$S($D(^PRCT(446.4,+X,0)):$P(^(0),"^"),1:X)," !" K X Q
I '$D(^DIC(9.4,"C",$E(X,1,$L(X)-2))) W !,"The PACKAGE NAME SPACE '",$E(X,1,$L(X)-2),"' does not exist !" K X
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRCTBAR 2828 printed Nov 22, 2024@17:29:20 Page 2
PRCTBAR ;WISC@ALTOONA/RGY-SEND A IRL PROGRAM TO BAR CODE READER ;3.13.98
+1 ;;5.1;IFCAP;;Oct 20, 2000
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
+3 if '$DATA(PRCTID)
SET PRCTID=""
if PRCTID]""
SET PRCTID=$ORDER(^PRCT(446.4,"C",PRCTID,""))
IF PRCTID=""
SET DIC="^PRCT(446.4,"
SET DIC(0)="QEAM"
SET DIC("S")="I $P(^(0),U,12)"
DO ^DIC
KILL DIC("S")
if Y<0
GOTO Q
SET PRCTID=+Y
DEV ;
+1 NEW TIME,PRX
+2 if '$DATA(IOP)
WRITE !!,"OK, please enter the device to which the bar code reader is connected.",!
+3 DO ^%ZIS
if POP
GOTO Q
+4 SET PRCTEON=^%ZOSF("EON")
SET PRCTEOFF=^%ZOSF("EOFF")
SET PRCTTYPE=^%ZOSF("TYPE-AHEAD")
SET PRCTOPEN=$GET(^%ZIS(2,IOST(0),10))
SET PRCTCLOS=$GET(^%ZIS(2,IOST(0),11))
+5 USE IO
DO OFF
DO WARN^PRCTMES1
READ X:DTIME
if X="^"
GOTO Q
+6 DO ON
SET PRCT=+$PIECE(^PRCT(446.4,PRCTID,0),"^",9)_"^2"
DO SPC^PRCTLAB
HANG 3
+7 SET TIME=$PIECE($HOROLOG,",",2)
+8 ; for janus readers
+9 NEW PRCTJNUS
+10 IF $TRANSLATE($PIECE($GET(^PRCT(446.6,+$PIECE($GET(^PRCT(446.4,PRCTID,0)),"^",9),0)),"^"),"janus","JANUS")["JANUS"
SET PRCTJNUS=1
+11 FOR LN=0:0
SET LN=$ORDER(^PRCT(446.4,PRCTID,1,LN))
if 'LN
QUIT
IF $DATA(^(LN,0))
SET X=^(0)
DO LN
IF X]""
if $GET(PRCTJNUS)
WRITE $CHAR(15)
WRITE X
if $GET(PRCTJNUS)
WRITE $CHAR(22)
WRITE !
if $GET(PRCTJNUS)
Begin DoDot:1
+12 DO OFF
WRITE *0
+13 DO ON
End DoDot:1
+14 SET PRCT=+$PIECE(^PRCT(446.4,PRCTID,0),"^",9)_"^3"
DO SPC^PRCTLAB
+15 FOR I=1:1:5
READ PRX(I):5
if '$TEST
QUIT
+16 DO OFF
DO ^%ZISC
+17 WRITE !!,"Download time: "_($PIECE($HOROLOG,",",2)-TIME)_" sec."
+18 IF $GET(PRX(1))=$CHAR(30)
WRITE !,"DOWNLOAD SUCCESSFUL, you may now disconnect the bar code reader.",!!
Q ;
+1 DO HOME^%ZIS
KILL I,LN,%DT,POP,PRCTID,DIC,IOP
QUIT
LN ;
+1 SET X=$PIECE(X,"::")
FOR Y=$LENGTH(X):-1:0
if $EXTRACT(X,Y)'=" "
QUIT
SET X=$EXTRACT(X,1,Y-1)
+2 IF '$DATA(COL1)
if X["|"
SET X=$PIECE(X,"|")_@$PIECE(X,"|",2)_$PIECE(X,"|",3)
+3 QUIT
+4 ;
ON XECUTE PRCTOPEN
USE IO
XECUTE PRCTEOFF
XECUTE PRCTTYPE
+1 QUIT
+2 ;
OFF XECUTE PRCTCLOS
XECUTE PRCTEON
USE IO(0)
+1 QUIT
+2 ;
COM ;Entry point to allow the alignment of IRL comments in Barcode Program file
+1 SET DIC="^PRCT(446.4,"
SET DIC(0)="QEAM"
DO ^DIC
if Y<0
GOTO Q2
SET PRCTID=+Y
+2 SET X="At what character do you want comments to begin at ?^35^^^COM^PRCTMES1^1"
DO ^PRCTQUES
if X="^"
GOTO Q2
SET COL1=X
+3 SET X="From line no. ?^1^^^COM1^PRCTMES1^1"
DO ^PRCTQUES
if X="^"
GOTO Q2
SET LN1=X
+4 SET X="To line no. ?^"_$SELECT($DATA(^PRCT(446.4,PRCTID,1,0)):$PIECE(^(0),"^",4),1:"")_"^^^COM2^PRCTMES1^1"
DO ^PRCTQUES
if X="^"
GOTO Q2
SET LN2=X
+5 FOR LN=LN1-1:0
SET LN=$ORDER(^PRCT(446.4,PRCTID,1,LN))
if 'LN!(LN>LN2)
QUIT
IF $DATA(^(LN,0))
SET X=^(0)
SET Y=COL1
DO CON
SET ^PRCT(446.4,PRCTID,1,LN,0)=Y
WRITE "."
+6 WRITE "... Done"
Q2 KILL COL1,LN,PRCTID,TLN,LN1,LN2,LN3
QUIT
CON ;X=IRL TEXT,Y=COLUMN TO START COMMENTS, Can be called from Fileman
+1 SET COL=Y
SET (LN1,Y)=X
if X'["
GOTO Q3
DO LN
FOR Y=0:0
if COL-3<$LENGTH(X)
QUIT
SET X=X_" "
+2 if $ASCII($EXTRACT(X,$LENGTH(X)))>32
SET X=X_" "
SET Y=X_"::"_$PIECE(LN1,"::",2)
Q3 KILL LN1,COL
QUIT
IDENT ; Called by input transform for IDENTIFIER (446.4,.02)
+1 IF $DATA(^PRCT(446.4,"C",X))
IF $ORDER(^(X,""))'=DA
SET X=$ORDER(^(""))
WRITE !,"This IDENTIFIER already exists for ",$SELECT($DATA(^PRCT(446.4,+X,0)):$PIECE(^(0),"^"),1:X)," !"
KILL X
QUIT
+2 IF '$DATA(^DIC(9.4,"C",$EXTRACT(X,1,$LENGTH(X)-2)))
WRITE !,"The PACKAGE NAME SPACE '",$EXTRACT(X,1,$LENGTH(X)-2),"' does not exist !"
KILL X
+3 QUIT