VistA-WorldVistAEHR/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCFACX2.m

36 lines
2.2 KiB
Mathematica
Raw Permalink Normal View History

2009-11-29 13:37:14 -05:00
PRCFACX2 ;WISC/CTB/CLH-PASS STRING TO CODE SHEET ;6/4/93 13:21
V ;;5.1;IFCAP;;Oct 20, 2000
;Per VHA Directive 10-93-142, this routine should not be modified.
;BUILD AND TRANSMIT CODE SHEET AS KEY PUNCH STYLE
;VARIABLES REQUIRED
;PRCFASYS - SYSTEM ID
;PRCFA("TTF") - TRANSACTION TYPE - .01 FIELD FROM FILE 420.4
;PRC("SITE")
;PRC("PER")-STANDARD PERSON VARIABLE - ZERO NODE OF PERSON FILE
;PRCFA("STRING")-CODE SHEET STRING TO BE TRANSMITTED
;PRCFA("STRING",#)-ARRAY OF ADDITIONAL CODE SHEET LINES TO BE TRANSMITTED (OPTIONAL)
;^TMP($J,"STRING",$)-ARRAY OF ADDITIONAL CODE SHEET LINES TO BE TRANSAMITTED (OPTIONAL)
;OPTIONAL VARIABLES
;PRCF("TDATE") - TRANSMISSION DATE (OPTIONAL - IF UNDEFINED, USES CURRENT DATE
;PRCFA("REF")- LOG COMMON NUMBER
;PRCFA("PRIO") - BATCH PRIORITY - IF UNDEFINED SYSTEM DEFAULTS TO 3
N %,I,X,B,%H,%I,%DT,D,D0,DA,DI,DIC,DIE,DQ,DR,N,P
I $S('$D(PRCFASYS):1,PRCFASYS="":1,1:0) S PRCFASYS=""
I $S('$D(PRCFA("TTF")):1,PRCFA("TTF")="":1,'$D(PRC("SITE")):1,PRC("SITE")="":1,'$D(PRC("PER")):1,PRC("PER")="":1,'$D(PRCFA("STRING")):1,PRCFA("STRING")="":1,1:0) S %=0 Q
D TT^PRCFAC K PRCFA("TTF") Q:'% S PRCFA("EDIT")="",PRCHAUTO="",PRCFA("KP")="" D NEWCS^PRCFAC K PRCHAUTO,PRCFA("KP") I '$D(PRCFA("CSNAME")) S %=0 Q
S DA=PRCFA("CSDA")
S MESSAGE=""
D ENCODE^PRCFES1(DA,DUZ,.MESSAGE)
K MESSAGE
K BTYPE I $D(PRCFA("TTDA")),PRCFA("TTDA")]"",$D(^PRCD(420.4,PRCFA("TTDA"),0)),+$P(^(0),"^",4)>0 S BTYPE=$P(^(0),"^",4) I '$D(^PRCF(423.9,BTYPE,0)) K BTYPE
I $D(BTYPE) S BTYPE=$P(^PRCF(423.9,BTYPE,0),"^",1) I ("^FEE^FEN^"[("^"_BTYPE_"^")) S BTYPE=$$FB^PRCS58
I $D(PRCF("TDATE")),PRCF("TDATE")]"" S X=PRCF("TDATE")
E S X="TODAY"
S DR=".31////1;.5///"_X_";.6"_$S($D(BTYPE):"///"_BTYPE,$D(PRCHLOG):"///LOG",1:"///OTHER")_";.3///N;.8///"_$S($D(PRCFA("PRIO"))["0":3,"2~3~4"[PRCFA("PRIO"):PRCFA("PRIO"),1:3) K PRCFA("PRIO")
K TT,BTYPE S DIE="^PRCF(423,",DA=PRCFA("CSDA") D ^DIE I $D(Y)'=0 D DEL^PRCFACXM S %=0 Q
S I=1 I $D(PRCFA("STRING"))#10 S ^PRCF(423,DA,"CODE",1,0)=PRCFA("STRING"),I=I+1
S %=0 F I=I:1 S %=$O(PRCFA("STRING",%)) Q:'% S ^PRCF(423,DA,"CODE",I,0)=PRCFA("STRING",%)
S %=0 F I=I:1 S %=$O(^TMP($J,"STRING",%)) Q:'% S ^PRCF(423,DA,"CODE",I,0)=^TMP($J,"STRING",%)
S ^PRCF(423,DA,"CODE",0)="^423.06^"_(I-1)_"^"_(I-1)
S %=1 Q