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

HLCSLNCH.m

Go to the documentation of this file.
  1. HLCSLNCH ;ALB/MTC/JC - START AND STOP THE LLP ;12/31/2003 17:37
  1. ;;1.6;HEALTH LEVEL SEVEN;**6,19,43,49,57,75,84,109**;Oct 13, 1995
  1. ;
  1. ;This program is callable from a menu
  1. ;It allows the user to Start and Stop the Lower Layer
  1. ;Protocol in the Background or in the foreground
  1. ;
  1. ;Required or Optional INPUT PARAMETERS
  1. ; None
  1. ;
  1. ;
  1. ;Output variables
  1. ; HLDP=IEN of Logical Link in file #870
  1. ;(optional)HLTRACE=if SET it launches the LLP in the Foreground
  1. ;(optional) ZTSK=if defined LLP was launched in the
  1. ;background
  1. ;
  1. ;
  1. START ; Start up the lower level protocol
  1. N DIC,DIRUT,DTOUT,DUOUT,HLDP,HLDAPP,HLJ,HLQUIT,HLTRACE
  1. N HLPARM0,HLPARM4,HLTYPTR,HLBGR,X,Y,ZTCPU,ZTSK,ZTRTN,ZTDESC
  1. W !!,"This option is used to launch the lower level protocol for the"
  1. W !,"appropriate device. Please select the node with which you want"
  1. W !,"to communicate",!
  1. S DIC="^HLCS(870,",DIC(0)="QEAMZ" D ^DIC G:Y<0 STARTQ
  1. S HLDP=+Y,HLDAPP=Y(0,0),HLTYPTR=+$P(Y(0),U,3),HLPARM0=Y(0)
  1. ;-- check if parameter have been setup
  1. ;-- check for LLP type
  1. I 'HLTYPTR W !,$C(7),"A Lower Layer Protocol must be selected before start-up can occur." G STARTQ
  1. ;-- get TCP information
  1. S HLPARM4=$G(^HLCS(870,HLDP,400))
  1. ;-- get routine (background job for LLP)
  1. S HLBGR=$G(^HLCS(869.1,HLTYPTR,100))
  1. ;-- get environment check routine (HLQUIT should be defined in fails)
  1. S HLENV=$G(^HLCS(869.1,HLTYPTR,200))
  1. ;
  1. I HLBGR="" W !,$C(7),"No routine has been specified for this LLP." G STARTQ
  1. ;
  1. ;-- execute environment check routine if HLQUIT is defined then terminate
  1. I HLENV'="" X HLENV G:$D(HLQUIT) STARTQ
  1. ;Multi-Servers, only enable the link if not OpenM
  1. I $P(HLPARM4,U,3)="M",$S(^%ZOSF("OS")'["OpenM":1,1:$$OS^%ZOSV["VMS") D G STARTQ
  1. . W !,$C(7),"This LLP is a multi-threaded server. It is controlled by external service, i.e. TCPIP/UCX. You must use the external service to start this LLP."
  1. . Q
  1. ;
  1. I $P(HLPARM0,U,10) W !,$C(7),"The LLP was last started on ",$$DAT2^HLUTIL1($P(HLPARM0,U,10)),"." G STP1:$P(HLPARM0,U,5)'="Error"
  1. I $P(HLPARM0,U,11) W !,"The LLP was last shutdown on ",$$DAT2^HLUTIL1($P(HLPARM0,U,11)),"."
  1. I $P(HLPARM0,U,5)'="Error",'($P(HLPARM4,U,3)="C"&("N"[$P(HLPARM4,U,4))),$P(HLPARM0,U,10)]""&($P(HLPARM0,U,11)=""),$P(HLPARM0,U,12) W !,"The LLP appears to be online already !"
  1. I $$TASK^HLUTIL1($P(HLPARM0,U,12)) D G STARTQ
  1. . W !,$C(7),"NOTE: The lower level protocol for this application is already running."
  1. I $P(HLPARM4,U,3)="C"&("N"[$P(HLPARM4,U,4)) D G STARTQ
  1. .;4=status 9=Time Started, 10=Time Stopped, 11=Task Number
  1. .;14=Shutdown LLP, 3=Device Type, 18=Gross Errors
  1. .N HLJ,X
  1. .I $P(HLPARM0,U,15)=0 W !,"This LLP is already enabled!" Q
  1. .L +^HLCS(870,HLDP,0):2
  1. .E W !,$C(7),"Unable to enable this LLP !" Q
  1. .S X="HLJ(870,"""_HLDP_","")"
  1. .S @X@(4)="Enabled",@X@(9)=$$NOW^XLFDT,@X@(14)=0
  1. .D FILE^HLDIE("","HLJ","","START","HLCSLNCH") ;HL*1.6*109
  1. .L -^HLCS(870,HLDP,0)
  1. .W !,"This LLP has been enabled!"
  1. .Q
  1. I $P(HLPARM4,U,6),$D(^%ZIS(14.7,+$P(HLPARM4,U,6),0)) S ZTCPU=$P(^(0),U) W !,"This LLP will start on node ",ZTCPU," if it is run in the Background.",!
  1. ;
  1. W ! S DIR(0)="SM^F:FOREGROUND;B:BACKGROUND;Q:QUIT"
  1. S DIR("A")="Method for running the receiver"
  1. S DIR("B")="B"
  1. S DIR("?",1)="Enter F for Foreground (and trace)"
  1. S DIR("?",2)=" B for Background (normal) or"
  1. S DIR("?")=" Q to quit without starting the receiver"
  1. D ^DIR K DIR
  1. Q:(Y=U)!(Y="Q")
  1. ;
  1. S HLX=$G(^HLCS(870,HLDP,0))
  1. ;-- foreground
  1. I Y="F" S HLTRACE=1 D G STARTQ
  1. . X HLBGR
  1. ;-- background
  1. I Y="B" D G STARTQ
  1. . S ZTRTN=$P(HLBGR," ",2),HLTRACE="",ZTIO="",ZTDTH=$H
  1. . S ZTDESC=HLDAPP_" Low Level Protocol",ZTSAVE("HLDP")=""
  1. . D ^%ZTLOAD
  1. . W !,$S($D(ZTSK):"Job was queued as "_ZTSK_".",1:"Unable to queue job.")
  1. ;
  1. Q
  1. ;
  1. ;
  1. STARTQ ;
  1. I $G(POP) W !,?5,"-Unable to Open the Device !",!,!,?6,"Check that Port is Logged Out, and that the",!,?6,"Lower Level Protocol is not Already Running."
  1. Q
  1. ;
  1. STOP ; Shut down a lower level protocol..
  1. N DIC,DIRUT,DTOUT,DUOUT,HLDP,HLDAPP,HLJ,HLPARM0,HLPARM4,X,Y
  1. W !!,"This option is used to shut down the lower level protocol for the"
  1. W !,"appropriate device. Please select the link which you would"
  1. W !,"like to shutdown.",!
  1. S DIC="^HLCS(870,",DIC(0)="QEAMZ" D ^DIC K DIC Q:Y<0
  1. S HLDP=+Y,HLDAPP=Y(0,0),HLPARM0=Y(0),HLPARM4=$G(^HLCS(870,HLDP,400))
  1. I $P(HLPARM4,U,3)="M",$S(^%ZOSF("OS")'["OpenM":1,1:$$OS^%ZOSV["VMS") D Q
  1. . W !,$C(7),"This LLP is a multi-threaded server. It is controlled by external service, i.e. UCX. You must use the external service to disable this LLP."
  1. . Q
  1. ;
  1. I $P(HLPARM0,U,15) W !,$C(7),"The lower level protocol is already ",$P(HLPARM0,U,5),"." Q
  1. I $P(HLPARM0,U,10) W !,$C(7),"The lower level protocol was started on ",$$DAT2^HLUTIL1($P(HLPARM0,U,10)),"."
  1. STP1 ;
  1. W ! S DIR(0)="Y",DIR("A")="Okay to shut down this job" D ^DIR K DIR
  1. I 'Y!($D(DIRUT))!($D(DUOUT)) W !!,"The job will not be shut down." Q
  1. S ;
  1. F L +^HLCS(870,HLDP,0):2 Q:$T
  1. ;4=status,10=Time Stopped,9=Time Started,11=Task Number,3=Device Type,14=shutdown
  1. S X="HLJ(870,"""_HLDP_","")",@X@(4)="Halting",@X@(10)=$$NOW^XLFDT,(@X@(11),@X@(9))="@",@X@(14)=1
  1. I $P(HLPARM4,U,3)="C"&("N"[$P(HLPARM4,U,4)),'$P(HLPARM0,U,12) S @X@(4)="Shutdown"
  1. D FILE^HLDIE("","HLJ","","STOP","HLCSLNCH") ; HL*1.6*109
  1. I ^%ZOSF("OS")["OpenM",(($P(HLPARM4,U,3)="M"&($$OS^%ZOSV'["VMS"))!($P(HLPARM4,U,3)="S")) D
  1. . ;pass task number to stop listener
  1. . S:$P(HLPARM0,U,12) X=$$ASKSTOP^%ZTLOAD(+$P(HLPARM0,U,12))
  1. . D CALL^%ZISTCP($P(HLPARM4,U),$P(HLPARM4,U,2),10)
  1. . I POP D HOME^%ZIS U IO W !,"Unable to shutdown logical link!!!",$C(7),$C(7) Q
  1. . U IO W "**STOP**"
  1. . W !
  1. . D CLOSE^%ZISTCP
  1. L -^HLCS(870,HLDP,0)
  1. W !,"The job for the "_HLDAPP_" Lower Level Protocol will be shut down."
  1. Q
  1. ;
  1. STOPQ Q