source: FOIAVistA/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/ZOSV2GTM.m@ 1166

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

initial load of FOIAVistA 6/30/08 version

File size: 2.3 KB
Line 
1%ZOSV2 ;ISF/RWF - More GT.M support routines ;10/18/06 14:29
2 ;;8.0;KERNEL;**275,425**;Jul 10, 1995;Build 18
3 Q
4 ;SAVE: DIE open array reference.
5 ; XCN is the starting value to $O from.
6SAVE(RN) ;Save a routine
7 N %,%F,%I,%N,SP,$ETRAP
8 S $ETRAP="S $ECODE="""" Q"
9 S %I=$I,SP=" ",%F=$$RTNDIR^%ZOSV()_$TR(RN,"%","_")_".m"
10 O %F:(newversion:noreadonly:blocksize=2048:recordsize=2044) U %F
11 F S XCN=$O(@(DIE_XCN_")")) Q:XCN'>0 S %=@(DIE_XCN_",0)") Q:$E(%,1)="$" I $E(%)'=";" W $P(%,SP)_$C(9)_$P(%,SP,2,99999),!
12 C %F ;S %N=$$NULL
13 ZLINK RN
14 ;C %N
15 U %I
16 Q
17NULL() ;Open and use null to hide talking. Return open name
18 ;Doesn't work for compile errors
19 N %N S %N=$S($ZV["VMS":"NLA0:",1:"/dev/nul")
20 O %N U %N
21 Q %N
22 ;
23DEL(RN) ;Delete a routine file, both source and object.
24 N %N,%DIR,%I,$ETRAP
25 S $ETRAP="S $ECODE="""" Q"
26 S %I=$I,%DIR=$$RTNDIR^%ZOSV,RN=$TR(RN,"%","_")
27 I $L($ZSEARCH(%DIR_RN_".m",244)) ZSYSTEM "DEL "_%DIR_X_".m;*"
28 I $L($ZSEARCH(%DIR_RN_".obj",244)) ZSYSTEM "DEL "_%DIR_X_".obj;*"
29 I $L($ZSEARCH(%DIR_RN_".o",244)) ZSYSTEM "rm -f "_%DIR_X_".o"
30 Q
31 ;LOAD: DIF open array to receive the routine lines.
32 ; XCNP The starting index -1.
33LOAD(RN) ;Load a routine
34 N %
35 S %N=0 F XCNP=XCNP+1:1 S %N=%N+1,%=$T(+%N^@RN) Q:$L(%)=0 S @(DIF_XCNP_",0)")=%
36 Q
37 ;
38LOAD2(RN) ;Load a routine
39 N %,%1,%F,%N,$ETRAP
40 S %I=$I,%F=$$RTNDIR^%ZOSV()_$TR(RN,"%","_")_".m"
41 O %F:(readonly):1 Q:'$T U %F
42 F XCNP=XCNP+1:1 R %1:1 Q:'$T!$ZEOF S @(DIF_XCNP_",0)")=$TR(%1,$C(9)," ")
43 C %F I $L(%I) U %I
44 Q
45 ;
46RSUM(RN) ;Calculate a RSUM value
47 N %,DIF,XCNP,%N,Y,$ETRAP K ^TMP("RSUM",$J)
48 S $ETRAP="S $ECODE="""" Q"
49 S Y=0,DIF="^TMP(""RSUM"",$J,",XCNP=0 D LOAD2(RN)
50 F %=1,3:1 S %1=$G(^TMP("RSUM",$J,%,0)),%3=$F(%1," ") Q:'%3 S %3=$S($E(%1,%3)'=";":$L(%1),$E(%1,%3+1)=";":$L(%1),1:%3-2) F %2=1:1:%3 S Y=$A(%1,%2)*%2+Y
51 K ^TMP("RSUM",$J)
52 Q Y
53 ;
54RSUM2(RN) ;Calculate a RSUM2 value
55 N %,DIF,XCNP,%N,Y,$ETRAP K ^TMP("RSUM",$J)
56 S $ETRAP="S $ECODE="""" Q"
57 S Y=0,DIF="^TMP(""RSUM"",$J,",XCNP=0 D LOAD2(RN)
58 F %=1,3:1 S %1=$G(^TMP("RSUM",$J,%,0)),%3=$F(%1," ") Q:'%3 S %3=$S($E(%1,%3)'=";":$L(%1),$E(%1,%3+1)=";":$L(%1),1:%3-2) F %2=1:1:%3 S Y=$A(%1,%2)*(%2+%)+Y
59 K ^TMP("RSUM",$J)
60 Q Y
61 ;
62TEST(RN) ;Special GT.M Test to see if routine is here.
63 N %F,%X
64 S %F=$$RTNDIR^%ZOSV()_$TR(RN,"%","_")_".m"
65 S %X=$ZSEARCH("X.X",245),%X=$ZSEARCH(%F,245)
66 Q %X
Note: See TracBrowser for help on using the repository browser.