source: WorldVistAEHR/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLCSLNCH.m@ 929

Last change on this file since 929 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 5.6 KB
RevLine 
[623]1HLCSLNCH ;ALB/MTC/JC - START AND STOP THE LLP ;12/31/2003 17:37
2 ;;1.6;HEALTH LEVEL SEVEN;**6,19,43,49,57,75,84,109**;Oct 13, 1995
3 ;
4 ;This program is callable from a menu
5 ;It allows the user to Start and Stop the Lower Layer
6 ;Protocol in the Background or in the foreground
7 ;
8 ;Required or Optional INPUT PARAMETERS
9 ; None
10 ;
11 ;
12 ;Output variables
13 ; HLDP=IEN of Logical Link in file #870
14 ;(optional)HLTRACE=if SET it launches the LLP in the Foreground
15 ;(optional) ZTSK=if defined LLP was launched in the
16 ;background
17 ;
18 ;
19START ; Start up the lower level protocol
20 N DIC,DIRUT,DTOUT,DUOUT,HLDP,HLDAPP,HLJ,HLQUIT,HLTRACE
21 N HLPARM0,HLPARM4,HLTYPTR,HLBGR,X,Y,ZTCPU,ZTSK,ZTRTN,ZTDESC
22 W !!,"This option is used to launch the lower level protocol for the"
23 W !,"appropriate device. Please select the node with which you want"
24 W !,"to communicate",!
25 S DIC="^HLCS(870,",DIC(0)="QEAMZ" D ^DIC G:Y<0 STARTQ
26 S HLDP=+Y,HLDAPP=Y(0,0),HLTYPTR=+$P(Y(0),U,3),HLPARM0=Y(0)
27 ;-- check if parameter have been setup
28 ;-- check for LLP type
29 I 'HLTYPTR W !,$C(7),"A Lower Layer Protocol must be selected before start-up can occur." G STARTQ
30 ;-- get TCP information
31 S HLPARM4=$G(^HLCS(870,HLDP,400))
32 ;-- get routine (background job for LLP)
33 S HLBGR=$G(^HLCS(869.1,HLTYPTR,100))
34 ;-- get environment check routine (HLQUIT should be defined in fails)
35 S HLENV=$G(^HLCS(869.1,HLTYPTR,200))
36 ;
37 I HLBGR="" W !,$C(7),"No routine has been specified for this LLP." G STARTQ
38 ;
39 ;-- execute environment check routine if HLQUIT is defined then terminate
40 I HLENV'="" X HLENV G:$D(HLQUIT) STARTQ
41 ;Multi-Servers, only enable the link if not OpenM
42 I $P(HLPARM4,U,3)="M",$S(^%ZOSF("OS")'["OpenM":1,1:$$OS^%ZOSV["VMS") D G STARTQ
43 . 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."
44 . Q
45 ;
46 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"
47 I $P(HLPARM0,U,11) W !,"The LLP was last shutdown on ",$$DAT2^HLUTIL1($P(HLPARM0,U,11)),"."
48 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 !"
49 I $$TASK^HLUTIL1($P(HLPARM0,U,12)) D G STARTQ
50 . W !,$C(7),"NOTE: The lower level protocol for this application is already running."
51 I $P(HLPARM4,U,3)="C"&("N"[$P(HLPARM4,U,4)) D G STARTQ
52 .;4=status 9=Time Started, 10=Time Stopped, 11=Task Number
53 .;14=Shutdown LLP, 3=Device Type, 18=Gross Errors
54 .N HLJ,X
55 .I $P(HLPARM0,U,15)=0 W !,"This LLP is already enabled!" Q
56 .L +^HLCS(870,HLDP,0):2
57 .E W !,$C(7),"Unable to enable this LLP !" Q
58 .S X="HLJ(870,"""_HLDP_","")"
59 .S @X@(4)="Enabled",@X@(9)=$$NOW^XLFDT,@X@(14)=0
60 .D FILE^HLDIE("","HLJ","","START","HLCSLNCH") ;HL*1.6*109
61 .L -^HLCS(870,HLDP,0)
62 .W !,"This LLP has been enabled!"
63 .Q
64 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.",!
65 ;
66 W ! S DIR(0)="SM^F:FOREGROUND;B:BACKGROUND;Q:QUIT"
67 S DIR("A")="Method for running the receiver"
68 S DIR("B")="B"
69 S DIR("?",1)="Enter F for Foreground (and trace)"
70 S DIR("?",2)=" B for Background (normal) or"
71 S DIR("?")=" Q to quit without starting the receiver"
72 D ^DIR K DIR
73 Q:(Y=U)!(Y="Q")
74 ;
75 S HLX=$G(^HLCS(870,HLDP,0))
76 ;-- foreground
77 I Y="F" S HLTRACE=1 D G STARTQ
78 . X HLBGR
79 ;-- background
80 I Y="B" D G STARTQ
81 . S ZTRTN=$P(HLBGR," ",2),HLTRACE="",ZTIO="",ZTDTH=$H
82 . S ZTDESC=HLDAPP_" Low Level Protocol",ZTSAVE("HLDP")=""
83 . D ^%ZTLOAD
84 . W !,$S($D(ZTSK):"Job was queued as "_ZTSK_".",1:"Unable to queue job.")
85 ;
86 Q
87 ;
88 ;
89STARTQ ;
90 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."
91 Q
92 ;
93STOP ; Shut down a lower level protocol..
94 N DIC,DIRUT,DTOUT,DUOUT,HLDP,HLDAPP,HLJ,HLPARM0,HLPARM4,X,Y
95 W !!,"This option is used to shut down the lower level protocol for the"
96 W !,"appropriate device. Please select the link which you would"
97 W !,"like to shutdown.",!
98 S DIC="^HLCS(870,",DIC(0)="QEAMZ" D ^DIC K DIC Q:Y<0
99 S HLDP=+Y,HLDAPP=Y(0,0),HLPARM0=Y(0),HLPARM4=$G(^HLCS(870,HLDP,400))
100 I $P(HLPARM4,U,3)="M",$S(^%ZOSF("OS")'["OpenM":1,1:$$OS^%ZOSV["VMS") D Q
101 . 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."
102 . Q
103 ;
104 I $P(HLPARM0,U,15) W !,$C(7),"The lower level protocol is already ",$P(HLPARM0,U,5),"." Q
105 I $P(HLPARM0,U,10) W !,$C(7),"The lower level protocol was started on ",$$DAT2^HLUTIL1($P(HLPARM0,U,10)),"."
106STP1 ;
107 W ! S DIR(0)="Y",DIR("A")="Okay to shut down this job" D ^DIR K DIR
108 I 'Y!($D(DIRUT))!($D(DUOUT)) W !!,"The job will not be shut down." Q
109S ;
110 F L +^HLCS(870,HLDP,0):2 Q:$T
111 ;4=status,10=Time Stopped,9=Time Started,11=Task Number,3=Device Type,14=shutdown
112 S X="HLJ(870,"""_HLDP_","")",@X@(4)="Halting",@X@(10)=$$NOW^XLFDT,(@X@(11),@X@(9))="@",@X@(14)=1
113 I $P(HLPARM4,U,3)="C"&("N"[$P(HLPARM4,U,4)),'$P(HLPARM0,U,12) S @X@(4)="Shutdown"
114 D FILE^HLDIE("","HLJ","","STOP","HLCSLNCH") ; HL*1.6*109
115 I ^%ZOSF("OS")["OpenM",(($P(HLPARM4,U,3)="M"&($$OS^%ZOSV'["VMS"))!($P(HLPARM4,U,3)="S")) D
116 . ;pass task number to stop listener
117 . S:$P(HLPARM0,U,12) X=$$ASKSTOP^%ZTLOAD(+$P(HLPARM0,U,12))
118 . D CALL^%ZISTCP($P(HLPARM4,U),$P(HLPARM4,U,2),10)
119 . I POP D HOME^%ZIS U IO W !,"Unable to shutdown logical link!!!",$C(7),$C(7) Q
120 . U IO W "**STOP**"
121 . W !
122 . D CLOSE^%ZISTCP
123 L -^HLCS(870,HLDP,0)
124 W !,"The job for the "_HLDAPP_" Lower Level Protocol will be shut down."
125 Q
126 ;
127STOPQ Q
Note: See TracBrowser for help on using the repository browser.