Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSXMST

PSXMST.m

Go to the documentation of this file.
  1. PSXMST ;BIR/BAB,WPB-Master Module to Transmit Messages ;[ 01/28/99 2:46 PM ]
  1. ;;2.0;CMOP;**17**;11 Apr 97
  1. Q
  1. BID ;Set line bid retry counter
  1. S PSXTRY=0
  1. BID1 G:^PSX(553,1,"S")="S" STOP^PSXJOB
  1. S PSXTME=$P($H,",",2)
  1. U IO
  1. W *ENQ,*TERM
  1. BID2 R *X:PSXDLTA E D MST6 G BAD
  1. I X=EOT R *X:PSXDLTA G:X=TERM BID2
  1. 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
  1. I X=NAK R *X:PSXDLTA D:'$T!(X'=TERM) MST2 G:'$T!(X'=TERM) BAD D MST5,LOG^PSXUTL G BAD
  1. 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
  1. D MST4 ;if X wasn't ENQ or ACK or NAK then garbage
  1. BAD S PSXTRY=PSXTRY+1 D FLUSH1^PSXUTL,LOG^PSXUTL G:PSXTRY'>PSXTRYM BID1
  1. ;STOP interface if bid fails more that M times
  1. ;S ^PSX(553,1,"S")="S" G STOP^PSXJOB
  1. D MST9,LOG^PSXUTL,SETPAR^PSXSTRT
  1. S PSXQUIT=1
  1. ;Hibernate awhile till CMOP comes on line,then try again
  1. H 45
  1. G ^PSXJOB
  1. OKAY ;Bid for Master was succesful
  1. S PSXTME=$P($H,",",2)
  1. ;Quit if Status is Stopped
  1. G:^PSX(553,1,"S")="S" STOP^PSXJOB
  1. ;Check for transmission 'Queued'
  1. Q:$G(PSXQRY)=1
  1. I ('$D(^PSX(552.1,"AQ"))&('$D(^PSX(552.1,"APQ")))&($P($G(^PSX(553,1,0)),"^")["LEAVENWORTH")) W *EOT,*TERM G ^PSXJOB
  1. I ('$D(^PSX(552.1,"AQ"))&('$D(^PSX(552.1,"APQ")))) W *EOT,*TERM G ^PSXQRY
  1. I $G(PSXONE) S PSXB=PSXONE,PSXDA=$O(^PSX(552.1,"B",PSXB,"")) G SEND
  1. S QUE=$S($D(^PSX(552.1,"APQ")):"APQ",1:"AQ")
  1. 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
  1. ;Begin sending messages if any Qued
  1. SEND I $D(^PSX(552.2,"AQ",PSXB)) G ^PSXSND
  1. EOT S PSXTXT="BTS|",PSXLAST=1,PSXBLK=1 D XMIT^PSXSND,FILE^PSXSND
  1. S PSXBHS=0
  1. W *EOT,*TERM ;end of transmission, nothing to send
  1. K PSXDT,PSXB,PSXDA,AA,PSXBLK,PSXHEX,PSXLAST,PSXLEN,PSXMSA,PSXMSGID,PSXMSH,PSXQN,PSXSUM,PSXTS,PSXTXT,PSXTSTN,REC,CNT,PSXBHS,QUE
  1. G:$G(PSXONE) EN^PSXSTP
  1. G ^PSXJOB
  1. MST1 K LOG S LOG(1)="MST1 ENQ received with no terminator while Bidding for Master status." Q
  1. MST2 K LOG S LOG(1)="MST2 NAK received with no terminator while Bidding for Master status." Q
  1. MST3 K LOG S LOG(1)="MST3 ACK without 0 received while Bidding for Master status." Q
  1. MST4 K LOG S LOG(1)="MST4 Garbage received while Bidding for Master status." Q
  1. MST5 K LOG S LOG(1)="MST5 NAK received while Bidding for Master status." Q
  1. MST6 K LOG S LOG(1)="MST6 No response from CMOP while Bidding for Master status." Q
  1. MST7 K LOG S LOG(1)="MST7 Simultaneous bid for Master status by CMOP and DHCP." Q
  1. MST8 K LOG S LOG(1)="MST8 ACK received with no terminator while Bidding for Master status." Q
  1. MST9 K LOG S LOG(1)="MST9 CMOP won't respond, waiting 45 seconds to try again" Q