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

HLCSUTL2.m

Go to the documentation of this file.
  1. HLCSUTL2 ;ALB/JRP - COMMUNICATION SERVER UTILITIES;15-MAY-95 ;11/06/2000 06:39
  1. ;;1.6;HEALTH LEVEL SEVEN;**18,28,62**;Oct 13, 1995
  1. CHK4STOP(PTRSUB,FLRTYPE,HLEXIT) ;DETERMINE IF FILER SHOULD STOP
  1. ;INPUT : PTRSUB - Pointer to incoming or outgoing filer subentry
  1. ; FLRTYPE - Indicates type of filer
  1. ; IN = Incoming (default)
  1. ; OUT = Outgoing
  1. ; HLEXIT - =0 (must be set by calling routine)
  1. ; HLEXIT("LASTCHK") - The last time the check was done. (Set by
  1. ; this routine for input to the next call to this routine
  1. ;OUTPUT : HLEXIT - Indicates whether Filer/task has been asked to stop
  1. ; 0 = no; 1 = yes
  1. ; HLEXIT("LASTCHK") - The last time the check was done.
  1. ;NOTES : This checks the STOP FILER field (#.02) of the INCOMING
  1. ; FILER TASK NUMBER and OUTGOING FILER TASK NUMBER multiples
  1. ; (fields 20 & 30) of the HL COMMUNICATION SERVER PARAMETER
  1. ; file (#869.3). If this field is set to YES, the filer
  1. ; has been asked to stop. After checking this, TaskMan
  1. ; will be asked if the task has been asked to stop [by
  1. ; calling $$S^%ZTLOAD].
  1. ; : FileMan is not used when determining if the STOP FILER field
  1. ; has been set to YES
  1. Q:$$HDIFF^XLFDT($H,$G(HLEXIT("LASTCHK")),2)<60
  1. ;Check input
  1. S PTRSUB=+$G(PTRSUB)
  1. S FLRTYPE=$G(FLRTYPE)
  1. ;Declare variables
  1. N PTRMAIN,NODE
  1. S NODE=$S(FLRTYPE="OUT":3,1:2)
  1. ;Get entry in parameter file
  1. S PTRMAIN=+$O(^HLCS(869.3,0))
  1. I PTRMAIN D Q:HLEXIT
  1. .;Lock/unlock zero node of multiple - force buffer update
  1. .L +^HLCS(869.3,PTRMAIN,NODE,0):1
  1. .L -^HLCS(869.3,PTRMAIN,NODE,0)
  1. .;If subentry doesn't exist, filer won't die off
  1. .I '$D(^HLCS(869.3,PTRMAIN,NODE,PTRSUB)) S HLEXIT=1 Q
  1. .N NODE1
  1. .;Get subentry zero node
  1. .S NODE1=$G(^HLCS(869.3,PTRMAIN,NODE,PTRSUB,0))
  1. .I NODE1="" S HLEXIT=1 Q
  1. .;no record of task
  1. .I $P(NODE1,"^")="" S HLEXIT=1 Q
  1. .;STOP FILER field is piece 2
  1. .I +$P(NODE1,"^",2) S HLEXIT=1
  1. ;Filer asked to stop
  1. ;Check if filer asked to stop via TaskMan
  1. I +$$S^%ZTLOAD S HLEXIT=1
  1. S HLEXIT("LASTCHK")=$H
  1. Q
  1. CNTFLR(FLRTYPE) ;RETURN NUMBER OF INCOMING/OUTGOING FILERS CURRENTLY RUNNING
  1. ;INPUT : FLRTYPE - Indicates type of filer
  1. ; IN = Incoming (default)
  1. ; OUT = Outgoing
  1. ;OUTPUT : X - Number of incoming/outgoing filers that are currently
  1. ; running. This will typically be the number of entries
  1. ; in the INCOMING FILER TASK NUMBER or OUTGOING FILER
  1. ; TASK NUMBER multiples (fields 20 & 30) of the HL
  1. ; COMMUNICATION SERVER PARAMETER file (#869.3). The
  1. ; tasks associated with the entries will be checked to
  1. ; determine if they have errored out - if so, they will
  1. ; not be included in the count.
  1. ; -1 - Error
  1. ;
  1. ;Check input
  1. S FLRTYPE=$G(FLRTYPE)
  1. ;Declare variables
  1. N PTRMAIN,NODE,COUNT,PTRSUB,ZTSK
  1. S NODE=$S(FLRTYPE="OUT":3,1:2)
  1. ;Get entry in parameter file
  1. S PTRMAIN=+$O(^HLCS(869.3,0))
  1. Q:('PTRMAIN) -1
  1. ;Lock/unlock zero node of multiple - force buffer update
  1. L +^HLCS(869.3,PTRMAIN,NODE,0):1
  1. L -^HLCS(869.3,PTRMAIN,NODE,0)
  1. ;Count number of subentries
  1. S PTRSUB=0
  1. S COUNT=0
  1. F S PTRSUB=+$O(^HLCS(869.3,PTRMAIN,NODE,PTRSUB)) Q:('PTRSUB) D
  1. .;Get task number
  1. .K ZTSK
  1. .S ZTSK=+$G(^HLCS(869.3,PTRMAIN,NODE,PTRSUB,0))
  1. .Q:('ZTSK)
  1. .;Check status of task
  1. .D STAT^%ZTLOAD
  1. .;Task not defined, is inactive, or errored out
  1. .Q:("12"'[ZTSK(1))
  1. .;Increment count
  1. .S COUNT=COUNT+1
  1. Q COUNT
  1. GETFLRS(FLRTYPE,ARRAY) ;RETURN LIST OF FILERS
  1. ;INPUT : FLRTYPE - Indicates type of filer
  1. ; IN = Incoming (default)
  1. ; OUT = Outgoing
  1. ; ARRAY - Array to return list of filers in (full global ref)
  1. ;OUTPUT : ARRAY will have the following format
  1. ; ARRAY(PtrSubEntry)=TaskNumber ^ LastKnown$H ^ Stop
  1. ; PtrSubEntry - Pointer to subentry in HL COMMUNICATION
  1. ; SERVER PARAMETER file (#869.3)
  1. ; TaskNumber - Task number of filer
  1. ; LastKnown$H - Value of LAST KNOWN $H (field #.03) for
  1. ; subentry
  1. ; Stop - Flag indicating if filer was asked to stop
  1. ; (field #.02 for subentry)
  1. ; 1 = YES
  1. ; 0 = NO
  1. ;NOTES : ARRAY will be initialized (KILLed) upon entry. If no
  1. ; entries are found in ARRAY() then no filers are running.
  1. ; : ARRAY() will not be defined on bad input
  1. ;
  1. ;Check input
  1. Q:($G(ARRAY)="")
  1. S FLRTYPE=$G(FLRTYPE)
  1. ;Declare variables
  1. N PTRMAIN,NODE,PTRSUB,ZERONODE,TASKNUM,LASTDH,STOP
  1. S NODE=$S(FLRTYPE="OUT":3,1:2)
  1. ;Initialize output array
  1. K @ARRAY
  1. ;Get entry in parameter file
  1. S PTRMAIN=+$O(^HLCS(869.3,0))
  1. Q:('PTRMAIN)
  1. ;Lock/unlock zero node of multiple - force buffer update
  1. L +^HLCS(869.3,PTRMAIN,NODE,0):1
  1. L -^HLCS(869.3,PTRMAIN,NODE,0)
  1. ;Get list of filers
  1. S PTRSUB=0
  1. F S PTRSUB=+$O(^HLCS(869.3,PTRMAIN,NODE,PTRSUB)) Q:('PTRSUB) D
  1. .;Get filer information
  1. .S ZERONODE=$G(^HLCS(869.3,PTRMAIN,NODE,PTRSUB,0))
  1. .S TASKNUM=+ZERONODE
  1. .S STOP=+$P(ZERONODE,"^",2)
  1. .S LASTDH=$P(ZERONODE,"^",3)
  1. .;Put info into output array
  1. .S @ARRAY@(PTRSUB)=TASKNUM_"^"_LASTDH_"^"_STOP
  1. Q