source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDRPA02.m@ 762

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

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1SDRPA02 ;bp-oifo/swo pait utils ; 9/10/04 9:33am
2 ;;5.3;Scheduling;**349,376**;AUG 13, 1993
3 Q ;no entry from top
4DUP(RUNIEN,BATCHIDO) ;check for duplicate ACK response
5 ;RUNIEN : the ien in file 409.6 of the run
6 ;BATCHIDO : batchid pulled from the ACK message
7 ;V3 : returns 0 if dup ACK or error and 1 new ACK
8 N V1,V2,V3,VNODE
9 S V3=0
10 I $G(RUNIEN)="" Q V3
11 I $G(BATCHIDO)="" Q V3
12 I $G(^SDWL(409.6,RUNIEN,2,0))="" Q V3
13 S V1=$O(^SDWL(409.6,RUNIEN,2,"B",BATCHIDO,"")) I V1="" Q V3
14 S VNODE=$G(^SDWL(409.6,RUNIEN,2,V1,0))
15 I $P(VNODE,"^")'=BATCHIDO Q V3
16 I $P(VNODE,"^",4)="" S V3=1
17 Q V3
18RSTAT ;check the status of the last run
19 ;V1 : last run ien
20 ;VNODE : zero node of the run
21 ;ZTSK : the task number
22 N V1,V2,V3,VNODE,ZTSK
23 S V1=$O(^SDWL(409.6,999999999),-1) Q:'V1
24 S VNODE=$G(^SDWL(409.6,V1,0)) Q:VNODE=""
25 I $P(VNODE,"^",7) Q ;the run has finished
26 S ZTSK=$P(VNODE,"^",2) Q:'ZTSK
27 D STAT^%ZTLOAD
28 I ZTSK(1)=1!(ZTSK(1)=2) Q ;still running
29 ;S V2=$$RPAIT^SDRPA03(V1) ADD MESSAGE TO HELP DESK THAT TASK ERRORED
30 Q
31RUNCK() ;date check for run start
32 ;V1 : ien file 19.2
33 ;V2 : returns 0=do not run, 1=okay to run
34 ;V3 : 1st day of scheduling pattern
35 ;V4 : 2nd day of scheduling pattern
36 ;VNODE : zero node of 19.2
37 ;VDAY : current day plussed
38 ;run may be started on the 1st or 15th with a 3 day grace window
39 ;if no entry in 19.2 allow to run anytime
40 ;if scheduling pattern is not 1M(1,15) allow to run anytime
41 N V1,V2,V3,V4,VNODE,VDAY
42 S V2=0
43 S V1=$O(^DIC(19,"B","SD-PAIT TASKED TRANSMISSION","")) ;is the option scheduled?
44 S V1=$O(^DIC(19.2,"B",V1,""))
45 I V1="" S V2=1 D NSMSG Q V2 ;not scheduled, allow to run anytime
46 S VNODE=$G(^DIC(19.2,V1,0))
47 I VNODE="" S V2=1 Q V2 ;b xref, but no entry, allow to run anytime
48 I $P(VNODE,"^",6)'?1"1M("1.2N1","1.2N1")" S V2=1 D NSMSG Q V2 ;not our scheduling pattern, allow to run anytime
49 S V3=+$P($P($P(VNODE,"^",6),"(",2),",") ;1st date in month to run
50 S V4=+$P($P($P(VNODE,"^",6),",",2),")") ;2nd date in month to run
51 S VDAY=+$E($$DT^XLFDT(),6,7)
52 I VDAY'=V3,VDAY'=(V3+1),VDAY'=(V3+2),VDAY'=(V3+3),VDAY'=V4,VDAY'=(V4+1),VDAY'=(V4+2),VDAY'=(V4+3) D NRMSG Q V2
53 S V2=1
54 Q V2
55NRMSG ;no run message
56 N XMSUB,XMY,XMTEXT,XMDUZ,SDAMX,SDNOW,SDNAM
57 S XMSUB="PAIT Transmission"
58 S XMY("G.SD-PAIT")=""
59 S XMTEXT="SDAMX("
60 S XMDUZ="POSTMASTER"
61 S SDNOW=$$HTE^XLFDT($H,)
62 S SDNAM=$$GET1^DIQ(200,+$G(DUZ)_",",.01,"I")
63 S SDAMX(1)=SDNAM_" (DUZ="_DUZ_") attempted to start the PAIT transmission"
64 S SDAMX(2)="on "_SDNOW_", outside the authorized transmission dates."
65 S SDAMX(3)="The job has been cancelled"
66 D ^XMD
67 Q
68NSMSG ;non scheduled start-up
69 N XMSUB,XMY,XMTEXT,XMDUZ,SDAMX,SDNOW,SDNAM
70 S XMSUB="PAIT Transmission"
71 S XMY("G.SD-PAIT")=""
72 ;S XMY("VHACIONHD@MED.VA.GOV")
73 S XMTEXT="SDAMX("
74 S XMDUZ="POSTMASTER"
75 S SDNOW=$$HTE^XLFDT($H,)
76 S SDNAM=$$GET1^DIQ(200,+$G(DUZ)_",",.01,"I")
77 S SDAMX(1)=SDNAM_" (DUZ="_DUZ_") started the PAIT transmission "
78 S SDAMX(2)="on "_SDNOW_". Option SD-PAIT TASKED TRANSMISSION has no "
79 S SDAMX(3)="entry or an incorrect entry for scheduling frequency. The correct frequency "
80 S SDAMX(4)="is 1M(1,15). The National Help Desk has been notified to initiate a NOIS"
81 D ^XMD
82 Q
Note: See TracBrowser for help on using the repository browser.