source: FOIAVistA/trunk/r/GENERIC_CODE_SHEET-GEC/GECSSTAA.m@ 1683

Last change on this file since 1683 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1GECSSTAA ;WISC/RFJ,KLD-stacker file utilities ;24 Nov 93
2 ;;2.0;GCS;**4,5,10,12,19,26,27,28**;MAR 14, 1995
3 Q
4 ;
5 ;
6ADD(SEGMENT,CONTROL,BATCH,DOCUMENT,DESCRIPT) ; add entry to stack file
7 ; segment = code sheet segment from file 2101.2
8 ; control = control segment
9 ; batch = batch segment (optional, use "" if not defined)
10 ; document = doc and <tc>1 segments (optional, use "" if not defined)
11 ; descript = 79 character description of event
12 ; return internal entry number
13 N %,%H,%I,DA,DATE,DIE,DR,TIME,TRANID,X,GDT
14 L +^GECS(2100.1,0)
15 S %=^GECS(2100.1,0)
16 F DA=$P(%,"^",3)+1:1 Q:'$D(^GECS(2100.1,DA))
17 S $P(%,"^",3)=DA,$P(%,"^",4)=$P(%,"^",4)+1,^GECS(2100.1,0)=%
18 L -^GECS(2100.1,0)
19 ;
20 L +^GECS(2100.1,DA)
21 S DATE=$P(CONTROL,"^",10),DATE=($E(DATE,1,2)-17)_$E(DATE,3,8)
22 S TIME=$P(CONTROL,"^",11)
23 S TRANID=$P(CONTROL,"^",6)_"-"_$P(CONTROL,"^",9) I $P(CONTROL,"^",8) S TRANID=TRANID_"-"_$P(CONTROL,"^",8)
24 ; NEW ENTRY FOR NOIS
25 ; for transaction class not equal DOC (i.e. VRQ)
26 I $P(CONTROL,"^",6)=" " S $P(TRANID,"-")=$E($P(CONTROL,"^",5),1,2)
27 ; ORG ENTRY
28 S ^GECS(2100.1,DA,0)=TRANID_"^F^^^"_SEGMENT_"^"_$S($P(CONTROL,"^",2)="CFD":"M",1:"A")
29 S GDT=DATE_"."_TIME
30 S DR="2///^S X=GDT",DIE=2100.1 D ^DIE
31 I $L(DESCRIPT) S ^GECS(2100.1,DA,1)=$E(DESCRIPT,1,79)
32 S ^GECS(2100.1,"B",TRANID,DA)=""
33 S %=$E($P(TRANID,"-",2),4,9) I $L(%) S ^GECS(2100.1,"BID",%,DA)=""
34 K ^GECS(2100.1,DA,10)
35 D SETCS(DA,CONTROL)
36 I $P(CONTROL,"^",8),BATCH'="" D SETCS(DA,BATCH)
37 I DOCUMENT'="" D SETCS(DA,DOCUMENT)
38 L -^GECS(2100.1,DA)
39 Q DA
40 ;
41 ;
42SETCS(DA,DATA) ; set data in wp code sheet field
43 ; da = stack internal entry number
44 ; data = code sheet data to store
45 ; dt must be set to standard date prior to call
46 I '$D(^GECS(2100.1,DA)) Q
47 L +^GECS(2100.1,DA)
48 I '$D(^GECS(2100.1,DA,10,0)) S ^(0)="^^0^0^"_DT
49 N HOLDDATE,I,X,Y
50 F I=$P($G(^GECS(2100.1,DA,10,0)),"^",3)+1:1 Q:'$D(^GECS(2100.1,DA,10,I,0))
51 S $P(^GECS(2100.1,DA,10,0),"^",3,4)=I_"^"_I
52 S DATA=$TR(DATA,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
53 S ^GECS(2100.1,DA,10,I,0)=DATA
54 S $P(^GECS(2100.1,DA,11),"^")=$P($G(^GECS(2100.1,DA,11)),"^")+$L(DATA)
55 ; compute checksum
56 S X=$P(^GECS(2100.1,DA,11),"^",2)_DATA X $S($G(^%ZOSF("LPC"))'="":^("LPC"),1:"S Y=""""") S $P(^GECS(2100.1,DA,11),"^",2)=Y
57 ; find hold date
58 I $E($P(DATA,"^"),3)=2!($P(DATA,"^")="AT1") S HOLDDATE=$$HOLDDATE^GECSSTTR(DATA) I HOLDDATE S $P(^GECS(2100.1,DA,11),"^",3)=HOLDDATE
59 L -^GECS(2100.1,DA)
60 Q
61 ;
62 ;
63SETSTAT(DA,STATUS) ; mark entry in stack for transmission
64 ; da = stack internal entry number
65 ; status = Queued for tran; Marked for tran by event
66 ; Transmitted; Error in transmission
67 I "QMTEARF"'[$E(STATUS) Q
68 N %,GECSFAUT,DIR
69 S %=$G(^GECS(2100.1,DA,0)) I %="" Q
70 L +^GECS(2100.1,DA)
71 I $P(%,"^",4)'="" K ^GECS(2100.1,"AS",$P(%,"^",4),DA)
72 S $P(^GECS(2100.1,DA,0),"^",4)=$E(STATUS)
73 I $L(STATUS) S ^GECS(2100.1,"AS",$E(STATUS),DA)=""
74 L -^GECS(2100.1,DA)
75 I STATUS="M" D
76 . K ^TMP($J,"GECSSTTR")
77 . S GECSFAUT=1
78 . D BUILD^GECSSTTM(DA)
79 . D TRANSMIT^GECSSTTT
80 . K ^TMP($J,"GECSSTTR")
81 Q
82 ;
83 ;
84SETKEY(DA,KEY) ; set the key for document lookup
85 I '$D(^GECS(2100.1,DA,0)) Q
86 N %,D,D0,DI,DIC,DIE,DQ,DR,X,Y
87 S (DIC,DIE)="^GECS(2100.1,",DR="8///"_KEY_";"
88 ; if key is null, delete it
89 I KEY="" S DR="8///@;"
90 D ^DIE
91 Q
92 ;
93 ;
94CHEKDUPL(DATA) ; called from control input template to check for duplicate
95 ; entry in the stack file.
96 ; data=same as "fms" node in file 2100
97 ; =transcode^transnumber
98 N TRANNUMB
99 S TRANNUMB=$E($P(DATA,"^",2)_" ",1,11)
100 I $D(^GECS(2100.1,"B",$P(DATA,"^")_"-"_TRANNUMB)) Q 1
101 Q 0
102 ;
103 ;
104SELECT(GECSTRAN,GECSSITE,GECSSTAT,GECSSCRN,GECSPROM) ; select stack entry
105 ; gecstran = optional screen transaction types (delimit using ^)
106 ; gecssite = optional screen for station number
107 ; gecsstat = optional screen for status (delimit using ^)
108 ; gecsscrn = optional additional screen which is executed
109 ; gecsprom = optional prompt
110 ; return internal entry of stack selected ^ document id
111 N %,%Y,DDH,DIC,GECSDATA,SCREEN,X,Y
112 S DIC="^GECS(2100.1,",DIC(0)="QEAMZ",DIC("A")="Select Stack Document for Retransmission: "
113 I $G(GECSPROM)'="" S DIC("A")=GECSPROM
114 S SCREEN="S GECSDATA=$G(^GECS(2100.1,+Y,0))"
115 I $G(GECSTRAN)'="" S SCREEN=SCREEN_" I GECSTRAN[$E(GECSDATA,1,2)"
116 I $G(GECSSITE)'="" S SCREEN=SCREEN_" I $E($P(GECSDATA,""-"",2),1,3)=GECSSITE"
117 I $G(GECSSTAT)'="" S SCREEN=SCREEN_" I GECSSTAT[$P(GECSDATA,U,4)"
118 I $G(GECSSCRN)'="" S SCREEN=SCREEN_" X GECSSCRN"
119 S DIC("S")=SCREEN
120 W ! D ^DIC
121 Q $S(Y>0:+Y_"^"_$P(Y,"^",2),1:0)
Note: See TracBrowser for help on using the repository browser.