source: FOIAVistA/tag/r/CMOP-PSX/PSXMST.m@ 1700

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

initial load of FOIAVistA 6/30/08 version

File size: 2.7 KB
Line 
1PSXMST ;BIR/BAB,WPB-Master Module to Transmit Messages ;[ 01/28/99 2:46 PM ]
2 ;;2.0;CMOP;**17**;11 Apr 97
3 Q
4BID ;Set line bid retry counter
5 S PSXTRY=0
6BID1 G:^PSX(553,1,"S")="S" STOP^PSXJOB
7 S PSXTME=$P($H,",",2)
8 U IO
9 W *ENQ,*TERM
10BID2 R *X:PSXDLTA E D MST6 G BAD
11 I X=EOT R *X:PSXDLTA G:X=TERM BID2
12 I X=ENQ R *X:PSXDLTA D:'$T!(X'=TERM) MST1 G:'$T!(X'=TERM) BAD S PSXTME=$P($H,",",2) S PSXTRY=PSXTRY+1 G:PSXTRY>PSXTRYM BAD D MST7,LOG^PSXUTL G BID2 ;ENQ received
13 I X=NAK R *X:PSXDLTA D:'$T!(X'=TERM) MST2 G:'$T!(X'=TERM) BAD D MST5,LOG^PSXUTL G BAD
14 I X=ACK R *X:PSXDLTA D:'$T!(X'=48) MST3 G:'$T!(X'=48) BAD R *X:PSXDLTA D:'$T!(X'=TERM) MST8 G:($G(X)=TERM) OKAY
15 D MST4 ;if X wasn't ENQ or ACK or NAK then garbage
16BAD S PSXTRY=PSXTRY+1 D FLUSH1^PSXUTL,LOG^PSXUTL G:PSXTRY'>PSXTRYM BID1
17 ;STOP interface if bid fails more that M times
18 ;S ^PSX(553,1,"S")="S" G STOP^PSXJOB
19 D MST9,LOG^PSXUTL,SETPAR^PSXSTRT
20 S PSXQUIT=1
21 ;Hibernate awhile till CMOP comes on line,then try again
22 H 45
23 G ^PSXJOB
24OKAY ;Bid for Master was succesful
25 S PSXTME=$P($H,",",2)
26 ;Quit if Status is Stopped
27 G:^PSX(553,1,"S")="S" STOP^PSXJOB
28 ;Check for transmission 'Queued'
29 Q:$G(PSXQRY)=1
30 I ('$D(^PSX(552.1,"AQ"))&('$D(^PSX(552.1,"APQ")))&($P($G(^PSX(553,1,0)),"^")["LEAVENWORTH")) W *EOT,*TERM G ^PSXJOB
31 I ('$D(^PSX(552.1,"AQ"))&('$D(^PSX(552.1,"APQ")))) W *EOT,*TERM G ^PSXQRY
32 I $G(PSXONE) S PSXB=PSXONE,PSXDA=$O(^PSX(552.1,"B",PSXB,"")) G SEND
33 S QUE=$S($D(^PSX(552.1,"APQ")):"APQ",1:"AQ")
34 S PSXDT=$O(^PSX(552.1,QUE,"")) G:'PSXDT EOT S PSXB=$O(^PSX(552.1,QUE,PSXDT,"")) G:'PSXB EOT S PSXDA=$O(^PSX(552.1,QUE,PSXDT,PSXB,"")) G:'PSXDA EOT
35 ;Begin sending messages if any Qued
36SEND I $D(^PSX(552.2,"AQ",PSXB)) G ^PSXSND
37EOT S PSXTXT="BTS|",PSXLAST=1,PSXBLK=1 D XMIT^PSXSND,FILE^PSXSND
38 S PSXBHS=0
39 W *EOT,*TERM ;end of transmission, nothing to send
40 K PSXDT,PSXB,PSXDA,AA,PSXBLK,PSXHEX,PSXLAST,PSXLEN,PSXMSA,PSXMSGID,PSXMSH,PSXQN,PSXSUM,PSXTS,PSXTXT,PSXTSTN,REC,CNT,PSXBHS,QUE
41 G:$G(PSXONE) EN^PSXSTP
42 G ^PSXJOB
43MST1 K LOG S LOG(1)="MST1 ENQ received with no terminator while Bidding for Master status." Q
44MST2 K LOG S LOG(1)="MST2 NAK received with no terminator while Bidding for Master status." Q
45MST3 K LOG S LOG(1)="MST3 ACK without 0 received while Bidding for Master status." Q
46MST4 K LOG S LOG(1)="MST4 Garbage received while Bidding for Master status." Q
47MST5 K LOG S LOG(1)="MST5 NAK received while Bidding for Master status." Q
48MST6 K LOG S LOG(1)="MST6 No response from CMOP while Bidding for Master status." Q
49MST7 K LOG S LOG(1)="MST7 Simultaneous bid for Master status by CMOP and DHCP." Q
50MST8 K LOG S LOG(1)="MST8 ACK received with no terminator while Bidding for Master status." Q
51MST9 K LOG S LOG(1)="MST9 CMOP won't respond, waiting 45 seconds to try again" Q
Note: See TracBrowser for help on using the repository browser.