1 | HLCSDL ;ALB/MTC/SF/JC - INITIALIZE VARIABLES AND OPEN DEVICE X3.28 ;08/23/99 13:35
|
---|
2 | ;;1.6;HEALTH LEVEL SEVEN;**2,44,49,57**;Oct 13, 1995
|
---|
3 | ;
|
---|
4 | EN ;-- entry point for X3.28 protocol
|
---|
5 | ;
|
---|
6 | ;-- error trap (keepalive for disconnects)
|
---|
7 | I ^%ZOSF("OS")["DSM" N $ETRAP S $ET=""
|
---|
8 | S X="ERROR^HLCSDL",@^%ZOSF("TRAP")
|
---|
9 | EN1 ;-- check device init
|
---|
10 | ;-- if device error and still running, try again
|
---|
11 | I $$INIT,$$RUN^HLCSDL2 D EXIT2 H 5 G EN1
|
---|
12 | ;-- setup X3.28 parameters
|
---|
13 | I $$XSETUP G ENQ
|
---|
14 | ;-- file start stats
|
---|
15 | D FILE
|
---|
16 | ;-- start LLP
|
---|
17 | D START^HLCSDL1
|
---|
18 | ;-- file end stats
|
---|
19 | D END
|
---|
20 | ;-- exit
|
---|
21 | ENQ D EXIT
|
---|
22 | ;
|
---|
23 | Q
|
---|
24 | ;
|
---|
25 | INIT() ;-- check for device, open
|
---|
26 | ; This fucntion will return a 1 if it fails else 0
|
---|
27 | ;
|
---|
28 | N RESULT
|
---|
29 | S RESULT=0
|
---|
30 | I '$D(HLDP)&($G(%)'="") S HLDP=% ;LAUNCHED FROM VMS
|
---|
31 | I '$D(HLDP) S RESULT=1 G INITQ
|
---|
32 | D DT^DICRW
|
---|
33 | I HLDP'>0 S HLDP=$O(^HLCS(870,"B",HLDP,""))
|
---|
34 | I HLDP'>0 S RESULT=1 G INITQ
|
---|
35 | ;HLDP IEN of LOGICAL LINK file #870
|
---|
36 | S HLPARM=$G(^HLCS(870,HLDP,300))
|
---|
37 | ;pointer to DEVICE file
|
---|
38 | S HLDEVPTR=$P(HLPARM,U)
|
---|
39 | ;-- check for valid pointer
|
---|
40 | I HLDEVPTR'>0 S RESULT=1 G INITQ
|
---|
41 | ;-- check for device
|
---|
42 | S HLDEVICE=$P($G(^%ZIS(1,HLDEVPTR,0)),"^",1)
|
---|
43 | I HLDEVICE="" S RESULT=1 G INITQ
|
---|
44 | ;-- open device
|
---|
45 | D MONITOR^HLCSDR2("OPEN",5,HLDP)
|
---|
46 | K ZTIO S IOP=HLDEVICE D ^%ZIS I POP D MONITOR^HLCSDR2("OPENFAIL",5,HLDP) H 3 S RESULT=1 G INITQ
|
---|
47 | ;-- set up environment
|
---|
48 | S X=255 U IO X ^%ZOSF("EOFF"),^%ZOSF("RM"),^%ZOSF("TRMON")
|
---|
49 | ;
|
---|
50 | INITQ Q RESULT
|
---|
51 | ;
|
---|
52 | XSETUP() ;-- This function will set up all parameters required by the X3.28
|
---|
53 | ; protocol.
|
---|
54 | ; This function will return a 1 if it fails, else 0
|
---|
55 | ;
|
---|
56 | N RESULT
|
---|
57 | S RESULT=0
|
---|
58 | ;-- initialize and set defaults
|
---|
59 | ;-- max message size
|
---|
60 | S HLMMS=$P(HLPARM,U,2) S:'HLMMS HLMMS=99999
|
---|
61 | ;-- block size
|
---|
62 | S HLDBLOCK=$P(HLPARM,U,3) S:'HLDBLOCK HLDBLOCK=245
|
---|
63 | ;-- timer a
|
---|
64 | S HLTIMA=$P(HLPARM,U,4) S:'HLTIMA HLTIMA=6
|
---|
65 | ;-- timer b
|
---|
66 | S HLTIMB=$P(HLPARM,U,5) S:'HLTIMB HLTIMB=3
|
---|
67 | ;-- timer d
|
---|
68 | S HLTIMD=$P(HLPARM,U,6) S:'HLTIMD HLTIMD=30
|
---|
69 | ;-- timer e
|
---|
70 | S HLTIME=$P(HLPARM,U,7) S:'HLTIME HLTIME=180
|
---|
71 | N I,J,K F I=1:1 S J=$T(CTRLS+I) Q:J["END" D
|
---|
72 | .S K=$P(J,";",3),@K=$P(J,";",4)
|
---|
73 | .S HLCTRL(@K)=$P(J,";",5)
|
---|
74 | I $G(HLTRACE) K ^TMP("HLLOG",$J) S HLLOG=0
|
---|
75 | ;
|
---|
76 | XSETQ Q RESULT
|
---|
77 | ;
|
---|
78 | FILE ;-- file startup stats
|
---|
79 | ;
|
---|
80 | D NOW^%DTC
|
---|
81 | L +^HLCS(870,HLDP,0):DTIME I '$T G FILE
|
---|
82 | ;9=Time Started, 10=Time Stopped, 11=Task Number
|
---|
83 | ;14=Shutdown LLP, 3=Device Type, 18=Gross Errors
|
---|
84 | I '$D(ZTSK) S ZTSK=""
|
---|
85 | S DIE="^HLCS(870,",DA=HLDP,DR="9////^S X=%;10////@;11////^S X=ZTSK;14////0;3////SX;18////@" D ^DIE K DIE,DA,DR
|
---|
86 | L -^HLCS(870,HLDP,0)
|
---|
87 | Q
|
---|
88 | ;
|
---|
89 | END ;-- file stats
|
---|
90 | D NOW^%DTC
|
---|
91 | D MONITOR^HLCSDR2("SHUTDOWN",5,HLDP)
|
---|
92 | L +^HLCS(870,HLDP,0):DTIME I '$T G END
|
---|
93 | ;10=Time Stopped,9=Time Started,11=Task Number
|
---|
94 | S DIE="^HLCS(870,",DA=HLDP,DR="10////^S X=%;9////@;11////@" D ^DIE K DIE,DA,DR
|
---|
95 | L -^HLCS(870,HLDP,0)
|
---|
96 | Q
|
---|
97 | ;
|
---|
98 | EXIT2 ;
|
---|
99 | D ^%ZISC X ^%ZOSF("EON")
|
---|
100 | Q
|
---|
101 | EXIT ;-- exit cleanup
|
---|
102 | D ^%ZISC X ^%ZOSF("EON")
|
---|
103 | K HLMMS,HLBLOCK,HLTIMA,HLTIMB,HLTIMD,HLTIME,HLTERM,HLSOH,HLSTX,HLETB,HLETX,HLEOT,HLENQ,HLRINT,HLDLE,HLNAK,HLACK0,HLACK1,HLACK2,HLACK3,HLACK4,HLACK5,HLACK6,HLACK7
|
---|
104 | K HLDNODE,HLDEVPTR,HLDEVICE,HLRETPRM,HLDAPP,X,HLDEND,HLDSTRT,HLDVER,HLDREAD,HLDWRITE,HLDP,HLTRACE,ZTSK,HLDBSIZE
|
---|
105 | Q
|
---|
106 | ;
|
---|
107 | ERROR ;
|
---|
108 | ;-- on disconnect errors, trap and try to reconnect, all others,
|
---|
109 | ; trap and shut down gracefully
|
---|
110 | I $$EC^%ZOSV["DSCON" D MONITOR^HLCSDR2("Disconnect",5,HLDP) H 3 G EN1
|
---|
111 | D ^%ZTER
|
---|
112 | D END G EXIT
|
---|
113 | CTRLS ;X3.28 control settings
|
---|
114 | ;;HLTERM;13;<CR>
|
---|
115 | ;;HLSOH;1;<SOH>
|
---|
116 | ;;HLSTX;2;<STX>
|
---|
117 | ;;HLETB;23;<ETB>
|
---|
118 | ;;HLETX;3;<ETX>
|
---|
119 | ;;HLEOT;4;<EOT>
|
---|
120 | ;;HLENQ;5;<ENQ>
|
---|
121 | ;;HLRINT;60;<RINT>
|
---|
122 | ;;HLDLE;16;<DLE>
|
---|
123 | ;;HLNAK;21;<NAK>
|
---|
124 | ;;HLACK0;48;<ACK0>
|
---|
125 | ;;HLACK1;49;<ACK1>
|
---|
126 | ;;HLACK2;50;<ACK2>
|
---|
127 | ;;HLACK3;51;<ACK3>
|
---|
128 | ;;HLACK4;52;<ACK4>
|
---|
129 | ;;HLACK5;53;<ACK5>
|
---|
130 | ;;HLACK6;54;<ACK6>
|
---|
131 | ;;HLACK7;55;<ACK7>
|
---|
132 | ;;END
|
---|