source: WorldVistAEHR/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLCSDR.m@ 711

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

initial load of WorldVistAEHR

File size: 2.5 KB
Line 
1HLCSDR ;ALB/RJS - INITIALIZE VARIABLES AND OPEN DEVICE FOR RECEIVER ;07/20/99 14:00
2 ;;1.6;HEALTH LEVEL SEVEN;**2,14,49,57**;Oct 13, 1995
3 ;
4INIT ;
5 S HLZER=0
6 I '$D(HLDP)&($G(%)'="") S HLDP=% ;LAUNCHED FROM VMS
7 I '$D(HLDP) Q
8 D DT^DICRW
9 I HLDP'>0 S HLDP=$O(^HLCS(870,"B",HLDP,""))
10 I HLDP'>0 G EXIT
11 ;HLDP IEN of LOGICAL LINK file #870
12 S HLDNODE=$G(^HLCS(870,HLDP,0))
13 S HLPARM=$G(^HLCS(870,HLDP,200))
14 ;pointer to DEVICE file
15 S HLDEVPTR=$P(HLPARM,U)
16 G EXIT:HLDEVPTR'>0
17 S HLDEVICE=$P($G(^%ZIS(1,HLDEVPTR,0)),"^",1)
18 G EXIT:HLDEVICE=""
19 D FILE
20INIT1 ;
21 G END:'HLZER
22 S HLZER=0
23 D OPEN G INIT1
24FILE ;
25 D NOW^%DTC
26 L +^HLCS(870,HLDP,0):DTIME I '$T G FILE
27 ;9=Time Started, 10=Time Stopped, 11=Task Number
28 ;14=Shutdown LLP, 3=Shutdown LLP, 18=Gross Errors
29 I '$D(ZTSK) S ZTSK=""
30 S DIE="^HLCS(870,",DA=HLDP,DR="9////^S X=%;10////@;11////^S X=ZTSK;14////0;3////SH;18////@" D ^DIE K DIE,DA,DR
31 L -^HLCS(870,HLDP,0)
32OPEN ;
33 I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERROR^HLCSDR"
34 E S X="ERROR^HLCSDR",@^%ZOSF("TRAP")
35OPEN1 I $P($G(^HLCS(870,HLDP,0)),U,15) G END
36 S HLST="OPEN" D STATUS(HLST,HLDP)
37 S IOP=HLDEVICE,%ZIS=0 D ^%ZIS
38 I POP S HLST="OPENFAIL" D STATUS(HLST,HLDP) H 5 G OPEN1
39INIT2 ;
40 ;Re-transmission attempts, Node, Hang Time, Start character,
41 ;End character, LLP Version Number
42 S HLDAPP=$P(HLDNODE,U,1)
43 S HLRETPRM=$P(HLPARM,U,2),HLDBSIZE=$P(HLPARM,U,3),HLDREAD=$P(HLPARM,U,4),HLDWRITE=$P(HLPARM,U,5),HLDSTRT=$P(HLPARM,U,6),HLDEND=$P(HLPARM,U,7),HLDVER=$P(HLPARM,U,8)
44 ;Defaults
45 I HLRETPRM="" S HLRETPRM=5
46 I HLDREAD="" S HLDREAD=10
47 I HLDWRITE="" S HLDWRITE=2
48 I HLDSTRT="" S HLDSTRT=11
49 I HLDEND="" S HLDEND=28
50 I HLDVER="" S HLDVER=21
51 I HLDBSIZE'>1 S HLDBSIZE=245
52 ;Set up Device Params
53 S X=255 U IO X ^%ZOSF("EOFF"),^%ZOSF("RM"),^%ZOSF("TRMON")
54START ;
55 D START^HLCSDR1(HLDP,HLRETPRM,HLDREAD,HLDWRITE,HLDSTRT,HLDEND,HLDVER,HLDBSIZE)
56END ;
57 I '$G(HLDP) G EXIT
58 D NOW^%DTC
59 L +^HLCS(870,HLDP,0):DTIME I '$T G END
60 ;10=Time Stopped,9=Time Started,11=Task Number
61 S DIE="^HLCS(870,",DA=HLDP,DR="10////^S X=%;9////@;11////@" D ^DIE K DIE,DA,DR
62 L -^HLCS(870,HLDP,0)
63EXIT ;
64 D ^%ZISC
65 K HLDNODE,HLDEVPTR,HLDEVICE,HLRETPRM,HLDAPP,X,HLDEND,HLDSTRT,HLDVER,HLDREAD,HLDWRITE,HLTRACE,ZTSK,HLDBSIZE,HLPARM
66 Q
67STATUS(HLST,HLDP) ;Update field 4
68 ;HLST=Current Status
69 ;HLDP=IEN of Logical Link
70 S DIE="^HLCS(870,",DA=HLDP,DR="4///^S X=HLST" D ^DIE K DIE,DA,DR
71 Q
72ERROR ;Trap disconnect & read errors
73 I $$EC^%ZOSV["DSCON"!($$EC^%ZOSV["data set hang-up") S HLST="DSCONECT" D STATUS(HLST,HLDP) H 3 S HLZER=1 I 1
74 E D ^%ZTER
75 S IO("C")=1 D ^%ZISC
76 G UNWIND^%ZTER
77 Q
Note: See TracBrowser for help on using the repository browser.