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

ABSPOSAP.m

Go to the documentation of this file.
  1. ABSPOSAP ; IHS/FCS/DRS - GETNEXT, PUTBACK ; [ 09/12/2002 10:06 AM ]
  1. ;;1.0;PHARMACY POINT OF SALE;**3,37**;JUN 21, 2001;Build 38
  1. Q
  1. ;
  1. ; GETNEXT, PUTBACK - manage the list of packets to be sent
  1. ; for this DIALOUT.
  1. ;
  1. ; Due to silly LOCK rule, it's a timed read and in the sorry event
  1. ; that we cannot obtain the lock, we will reschedule a transmit/
  1. ; receive job to run again.
  1. ;
  1. LLIST() ; EP - from ABSPOSC4
  1. L +^ABSPECX("POS",DIALOUT,"C"):300 Q:$T 1
  1. D LOG("Unable to get exclusive access to the list of claims for DIALOUT="_DIALOUT)
  1. D TASK^ABSPOSQ2
  1. Q 0
  1. ULLIST ; EP - from ABSPOSC4
  1. L -^ABSPECX("POS",DIALOUT,"C") Q
  1. ;
  1. ; Routines to get and unget messages
  1. ; Given DIALOUT
  1. ; optional parameter N says "first message after #N"
  1. ; Sets SENDMSG = the big string and kills message out of the global
  1. ; SENDMSGP(n)=the message in segments as copied from global
  1. ; CLAIMIEN=the message number
  1. ; (this is for convenient restoring in case of comms error)
  1. ; Returns message number
  1. ; If no message ready to send, returns FALSE and $D(SENDMSG)=0
  1. ; and $D(CLAIMIEN)=0
  1. ;
  1. GETNEXT(N) ;EP -
  1. ; (any NEW commands go here)
  1. GETNEXT1 ;
  1. I '$$LLIST S CLAIMIEN="" Q ; lock the list for this DIALOUT
  1. I '$G(N) S N=0
  1. K SENDMSG,SENDMSGP,CLAIMIEN
  1. S N=$O(^ABSPECX("POS",DIALOUT,"C",0))
  1. I N D
  1. . M SENDMSGP=^ABSPECX("POS",DIALOUT,"C",N) ; SENDMSG(*) = message
  1. . ; Note: ABSPOSC4 also does a KILL of the claim packet
  1. . K ^ABSPECX("POS",DIALOUT,"C",N)
  1. . S SENDMSG=""
  1. . ;N I F I=1:1:SENDMSGP(0) S SENDMSG=SENDMSG_SENDMSGP(I)
  1. . N I F I=1:1:SENDMSGP(0) S SENDMSG=SENDMSG_$G(SENDMSGP(I)) ;IHS/OIT/SCR 012710 patch 37 to avoid undefined at Santa Rosa
  1. . S CLAIMIEN=N
  1. E S CLAIMIEN=""
  1. D ULLIST ; unlock the list
  1. ;
  1. ; If we got a claim packet to be sent, check to see if any of the
  1. ; claims therein are marked for cancellation. If so, then handle
  1. ; the cancellation, which involves NOT sending this packet.
  1. ; Then loop back and see if you can get another one, instead.
  1. I N,$$CANCEL^ABSPOSAN G GETNEXT1
  1. Q N
  1. PUTBACK ;EP - puts message back, with given CLAIMIEN
  1. F Q:$$LLIST Q:'$$IMPOSS^ABSPOSUE("L,P","RIT","Lock list to put back message","DIALOUT="_DIALOUT,"PUTBACK",$T(+0))
  1. I $D(^ABSPECX("POS",DIALOUT,"C",CLAIMIEN)) D G PB9 ; should never happen
  1. . D IMPOSS^ABSPOSUE("P,DB","TRI","Old slot is now occupied again?!",,"PUTBACK",$T(+0))
  1. M ^ABSPECX("POS",DIALOUT,"C",CLAIMIEN)=SENDMSGP
  1. PB9 D ULLIST ; unlock the list
  1. Q
  1. LOG(X) D LOG^ABSPOSL($T(+0)_" - "_X) Q