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

HLCS1.m

Go to the documentation of this file.
  1. HLCS1 ;ALB/JRP - OPTIONS FOR BACKGROUND FILERS ;10/15/98 10:44
  1. ;;1.6;HEALTH LEVEL SEVEN;**19**;Oct 13, 1995
  1. ;
  1. STARTDEF ;Entry point used by OPTION file to task default number of each filer
  1. N PTRMAIN,ONENODE,DEFCNT,CURCNT,LOOP
  1. ;Get entry in HL COMMUNICATION SERVER PARAMETER file (#869.3)
  1. S PTRMAIN=+$O(^HLCS(869.3,0))
  1. I ('PTRMAIN) D Q
  1. .W $C(7)
  1. .W !!,"Entry in HL COMMUNICATION SERVER PARAMETER file (#869.3) has"
  1. .W !,"not been made. Entry must be made in order to start execute"
  1. .W !,"this option.",!!
  1. ;Get zero node of parameter file
  1. S ONENODE=$G(^HLCS(869.3,PTRMAIN,1))
  1. ;Get default number of incoming filers (piece 1 of node 1)
  1. S DEFCNT=+$P(ONENODE,"^",1)
  1. I ('DEFCNT) D
  1. .;No default value found
  1. .S DEFCNT=1
  1. .W $C(7)
  1. .W !!,"Default number of incoming servers has not been entered into"
  1. .W !,"the HL COMMUNICATION SERVER PARAMETER file (#869.3). Will use"
  1. .W !,"a value of ",DEFCNT,".",!!
  1. ;Get current number of incoming filers running
  1. S CURCNT=$$CNTFLR^HLCSUTL2("IN")
  1. I ((CURCNT>DEFCNT)!(CURCNT=DEFCNT)) D
  1. .;No more incoming filers needed
  1. .W $C(7)
  1. .W !!,"Default number of incoming servers is set to ",DEFCNT," and"
  1. .W !,CURCNT," incoming servers are currently running. No more"
  1. .W !,"incoming servers will be started.",!!
  1. I (CURCNT<DEFCNT) D
  1. .;Start DEFCNT-CURCNT incoming filers
  1. .F LOOP=1:1:(DEFCNT-CURCNT) D STARTIN
  1. W !
  1. ;Get default number of outgoing filers (piece 2 of node 1)
  1. S DEFCNT=+$P(ONENODE,"^",2)
  1. I ('DEFCNT) D
  1. .;No default value found
  1. .S DEFCNT=1
  1. .W $C(7)
  1. .W !!,"Default number of outgoing servers has not been entered into"
  1. .W !,"the HL COMMUNICATION SERVER PARAMETER file (#869.3). Will use"
  1. .W !,"a value of ",DEFCNT,".",!!
  1. ;Get current number of outgoing filers running
  1. S CURCNT=$$CNTFLR^HLCSUTL2("OUT")
  1. I ((CURCNT>DEFCNT)!(CURCNT=DEFCNT)) D
  1. .;No more outgoing filers needed
  1. .W $C(7)
  1. .W !!,"Default number of outgoing servers is set to ",DEFCNT," and"
  1. .W !,CURCNT," outgoing servers are currently running. No more"
  1. .W !,"outgoing servers will be started.",!!
  1. I (CURCNT<DEFCNT) D
  1. .;Start DEFCNT-CURCNT outgoing filers
  1. .F LOOP=1:1:(DEFCNT-CURCNT) D STARTOUT
  1. W !
  1. Q
  1. STARTIN ;Entry point used by OPTION file to task an incoming filer
  1. N TASKNUM
  1. S TASKNUM=$$TASKFLR("IN")
  1. W:(TASKNUM) !,"Incoming filer queued as task number ",TASKNUM
  1. W:('TASKNUM) $C(7),!!,"Unable to queue incoming filer"
  1. Q
  1. STARTOUT ;Entry point used by OPTION file to task an outgoing filer
  1. N TASKNUM
  1. S TASKNUM=$$TASKFLR("OUT")
  1. W:(TASKNUM) !,"Outgoing filer queued as task number ",TASKNUM
  1. W:('TASKNUM) $C(7),!!,"Unable to queue outgoing filer"
  1. Q
  1. STOPIN ;Entry point used by OPTION file to stop an incoming filer
  1. N PTRSUB,FLRLST
  1. ;Get list of filers
  1. D GETFLRS^HLCSUTL2("IN","FLRLST")
  1. ;No filers running
  1. I ('$D(FLRLST)) W $C(7),!!,"No incoming filers are running",!! Q
  1. ;Get first filer out of list
  1. S PTRSUB=+$O(FLRLST(0))
  1. I ('PTRSUB) W $C(7),!!,"No incoming filers are running",!! Q
  1. ;Stop incoming filer
  1. D STOPFLR^HLCSUTL1(PTRSUB,"IN")
  1. W !!,"Incoming filer queued as task number ",+FLRLST(PTRSUB)," has been asked to stop",!!
  1. Q
  1. STOPOUT ;Entry point used by OPTION file to stop an outgoing filer
  1. N PTRSUB,FLRLST
  1. ;Get list of filers
  1. D GETFLRS^HLCSUTL2("OUT","FLRLST")
  1. ;No filers running
  1. I ('$D(FLRLST)) W $C(7),!!,"No outgoing filers are running",!! Q
  1. ;Get first filer out of list
  1. S PTRSUB=+$O(FLRLST(0))
  1. I ('PTRSUB) W $C(7),!!,"No outgoing filers are running",!! Q
  1. ;Stop filer
  1. D STOPFLR^HLCSUTL1(PTRSUB,"OUT")
  1. W !!,"Outgoing filer queued as task number ",+FLRLST(PTRSUB)," has been asked to stop",!!
  1. Q
  1. STOPAIN ;Entry point used by OPTION file to stop all incoming filers
  1. N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. ;Make sure user wants to stop all filers
  1. S DIR(0)="YA"
  1. S DIR("A")="Are you sure you want to stop all incoming filers ? "
  1. S DIR("B")="NO"
  1. S DIR("?",1)="Stopping all incoming filers will prevent messages being"
  1. S DIR("?",2)="received through Logical Links from being passed to the"
  1. S DIR("?",3)="appropriate application. Answer 'YES' if you really want"
  1. S DIR("?")="this to occur."
  1. W !!
  1. D ^DIR
  1. I (($D(DIRUT))!('$G(Y))) W !!,"Incoming filers will not be stopped",!! Q
  1. ;Stop all filers
  1. W !!,"Please wait while all incoming filers are asked to stop ..."
  1. D STOPALL("IN")
  1. W !,"All incoming filers have been asked to stop",!!
  1. Q
  1. STOPAOUT ;Entry point used by OPTION file to stop all outgoing filers
  1. N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. ;Make sure user wants to stop all filers
  1. S DIR(0)="YA"
  1. S DIR("A")="Are you sure you want to stop all outgoing filers ? "
  1. S DIR("B")="NO"
  1. S DIR("?",1)="Stopping all outgoing filers will prevent messages from"
  1. S DIR("?",2)="being transmitted to external systems through Logical"
  1. S DIR("?")="Links. Answer 'YES' if you really want this to occur."
  1. W !!
  1. D ^DIR
  1. I (($D(DIRUT))!('$G(Y))) W !!,"Outgoing filers will not be stopped",!! Q
  1. ;Stop all filers
  1. W !!,"Please wait while all outgoing filers are asked to stop ..."
  1. D STOPALL("OUT")
  1. W !,"All outgoing filers have been asked to stop",!!
  1. Q
  1. TASKFLR(FLRTYPE) ;Task an incoming/outgoing filer
  1. ;INPUT : FLRTYPE - Flag denote type of filer to start
  1. ; IN - Incoming filer (default)
  1. ; OUT - Outgoing filer
  1. ;OUTPUT : ZTSK (results of call to TaskMan)
  1. ;
  1. ;Check input
  1. S FLRTYPE=$G(FLRTYPE)
  1. ;Declare variables
  1. N ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK,TMP
  1. S ZTIO=""
  1. S ZTDTH=$H
  1. ;Task incoming filer
  1. S ZTRTN="STARTIN^HLCSIN"
  1. S ZTDESC="HL7 Incoming Filer"
  1. ;Task outgoing filer
  1. I (FLRTYPE="OUT") D
  1. .S ZTRTN="STARTOUT^HLCSOUT"
  1. .S ZTDESC="HL7 Outgoing Filer"
  1. ;Call TaskMan
  1. S ZTSK=0
  1. D ^%ZTLOAD
  1. S ZTSK=+$G(ZTSK)
  1. ;Not tasked
  1. Q:('ZTSK)
  1. ;Create entry in HL COMMUNICATION SERVER PARAMETER file
  1. S TMP=$$CRTFLR^HLCSUTL1(ZTSK,FLRTYPE)
  1. ;Return task number
  1. Q ZTSK
  1. STOPALL(FLRTYPE) ;Stop all incoming/outgoing filers
  1. ;INPUT : FLRTYPE - Flag denote type of filer to start
  1. ; IN - Incoming filer (default)
  1. ; OUT - Outgoing filer
  1. ;OUTPUT : None
  1. ;
  1. ;Check input
  1. S FLRTYPE=$G(FLRTYPE)
  1. S:((FLRTYPE'="OUT")&(FLRTYPE'="IN")) FLRTYPE="IN"
  1. ;Declare variables
  1. N PTRSUB,FLRLST
  1. ;Get list of filers
  1. D GETFLRS^HLCSUTL2(FLRTYPE,"FLRLST")
  1. ;No filers running
  1. Q:('$D(FLRLST))
  1. ;Loop through list of filers, stopping each
  1. S PTRSUB=0
  1. F S PTRSUB=+$O(FLRLST(PTRSUB)) Q:('PTRSUB) D STOPFLR^HLCSUTL1(PTRSUB,FLRTYPE)
  1. Q
  1. EDITPRAM ;Entry point used by OPTION file to edit file 869.3
  1. ;Declare variables
  1. N DIC,X,Y,DTOUT,DUOUT,DLAYGO,DIE,DA,DR
  1. ;Create/find entry HL COMMUNICATION SERVER PARAMETER file (#869.3)
  1. S DLAYGO=869.3
  1. S DIC="^HLCS(869.3,"
  1. S DIC(0)="L"
  1. S DIC("DR")="11///1;12///1"
  1. S X=1
  1. D ^DIC
  1. ;Error
  1. I (Y="-1") D Q
  1. .W !!,"Unable to create/find entry in HL COMMUNICATION SERVER"
  1. .W !,"PARAMETER file (#869.3). Entry must exist in order for"
  1. .W !,"the incoming & outgoing filers to run. Use FileMan to"
  1. .W !,"create an initial entry for editing.",!!
  1. ;Entry created
  1. I ($P(Y,"^",3)) D
  1. .;Tell user entry was created
  1. .W !!,"Initial entry in HL COMMUNICATION SERVER PARAMETER file"
  1. .W !,"(#869.3) has been created.",!
  1. ;Edit parameters
  1. S DIE="^HLCS(869.3,"
  1. S DA=+Y
  1. S DR="11Default number of incoming filers;12Default number of outgoing filers"
  1. D ^DIE
  1. Q