source: FOIAVistA/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIM3.m@ 677

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

initial load of FOIAVistA 6/30/08 version

File size: 3.2 KB
Line 
1DIM3 ;SFISC/JFW,GFT,TOAD-FileMan: M Syntax Checker, Commands ;5/6/97 09:10
2 ;;22.0;VA FileMan;;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;12278;4265731;3363;
5 ;
6DG ; DO and GET (D^DIM and G^DIM)
7 G GC^DIM:%ARG=""!%ERR D PARS G ER:%ERR
8 S %L=":" D PARS1 G ER:%ERR I %C=%L G ER:%A1="" S %=%A1 D ^DIM1
9 I %A["@^" S %=%A D ^DIM1 G DG
10 I %A["(",$E(%A)'="@",$E($P(%A,"^",2))'="@" D G ER:%ERR
11 . I %COM'="D" S %ERR=1 Q
12 . S %=%A
13 . I %'?.E1"(".E1")" S %ERR=1 Q
14 . S %C=$P(%,"("),%C1=$P(%C,"^",2,999),%I=$F(%,"(")-1
15 . I %C=""!(%C?.E1"^") S %ERR=1 Q
16 . I %C1]"",%C1'?1U.7AN,%C1'?1"%".7AN S %ERR=1 Q
17 . S %C=$P(%C,"^") I %C]"",%C'?1U.7AN,%C'?1"%".7AN,%C'?1.8N S %ERR=1 Q
18 . Q:$E(%,%I,%I+1)="()"
19 . S (%(-1,2),%(-1,3))=0,%N=1,%(0,0)="P^",(%(0,1),%(0,2),%(0,3))=0
20 . D GG^DIM1
21 E D LABEL(0)
22 G DG
23 ;
24LABEL(OFFSET) ; labelref, entryref, and $TEXT argument (DG and TEXT^DIM1)
25 S %L="^" D PARS1 Q:%ERR
26 I %C=%L S:%A1=""!($E(%A1)="^") %ERR=1 S %=%A1 D VV,^DIM1 Q:%ERR
27 S %=%A D VV:%'=+%&'OFFSET,^DIM1 Q
28 ;
29KL ; KILL, LOCK, and NEW (K^DIM and LK)
30 D PARS G ER:%ERR
31 I %A="",%C="," G ER
32 I %A?1"^"1UP.UN,%COM'="L" G ER
33 I %A?1"(".E1")" D G KL
34 . S %ARG("E")=$L(%ARG)
35 . S %A=$E(%A,2,$L(%A)-1) S %ARG=%A_$S(%ARG]"":","_%ARG,1:"")
36 S %=%A I %COM="L","+-"[$E(%A) S $E(%A)=""
37 I %COM="N",'$$LNAME(%) G ER
38 I %COM="K",$D(%ARG("E")),'$$LNAME(%) G ER
39 I $D(%ARG("E")),$L(%ARG)'>%ARG("E") K %ARG("E")
40 D VV,^DIM1 G GC^DIM:%ARG=""!%ERR
41 G KL
42 ;
43LK ; LOCK (L^DIM)
44 S %A=%ARG,%L=":" S:"+-"[$E(%A) %A=$E(%A,2,999) D PARS1
45 I %C=%L G ER:%A1="" S %=%A1 D ^DIM1
46 S %ARG=%A G GC^DIM:%A="",KL
47 ;
48HN ; HANG (H^DIM)
49 S %=%ARG D ^DIM1 G GC^DIM
50 ;
51OP ; OPEN and USE (O^DIM and U^DIM)
52 G GC^DIM:%ARG=""!%ERR D PARS G ER:%ERR!(%C=","&(%A=""))
53 G US:%COM="U" S %L=":" D PARS1 S %A2=%A,%A=%A1 S:%C=%L&(%A="") %ERR=1 D PARS1 G ER:%ERR!(%C=%L&(%A1=""))
54 F %L="%A1","%A2" S %=@%L D ^DIM1 G OP:%ERR
55 G OP
56US S %L=":" D PARS1 G ER:%C=%L&(%A1="") S %=%A D ^DIM1
57 S %A=%A1 D PARS1 G ER:%C]"",OP
58 ;
59FR ; FOR (F^DIM)
60 S %L="=",%A=%ARG D PARS1 G ER:%ERR!(%A1="")!(%A="") S %ARG=%A1
61 S %=%A G ER:%A?1"^".E D VV,^DIM1 G ER:%ERR
62FR1 G GC^DIM:%ARG=""!%ERR D PARS
63 S %L=":" F %A=%A,%A1 D PARS1 G ER:%ERR!(%A=""&(%C=%L)) S %=%A D ^DIM1
64 I %A1]"" S %=%A1 D ^DIM1
65 G FR1
66 ;
67PARS S (%A,%C)="" Q:%ERR S (%ERR,%I)=0
68INC D %INC D QT:%C="""",PARAN:%C="(" Q:%ERR G OUT:","[%C,INC
69QT D %INC Q:%C="""" G QT:%C]"" S %ERR=1 Q
70PARAN S %P=1 F %J=0:0 D %INC D QT:%C="""" S %P=%P+$S(%C="(":1,%C=")":-1,1:0) Q:'%P I %C="" S %ERR=1 Q
71 Q
72OUT S %A=$E(%ARG,1,%I-1),%ARG=$E(%ARG,%I+1,999) Q
73%INC S %I=%I+1,%C=$E(%ARG,%I) Q
74 ;
75PARS1 S (%A1,%C)="" Q:%ERR S (%ERR,%I)=0
76INCR D %INC1 D QT1:%C="""",PARAN1:%C="(" Q:%ERR=1 G OUT1:%L[%C,INCR
77OUT1 S %A1=$E(%A,%I+1,999),%A=$E(%A,1,%I-1) Q
78QT1 D %INC1 Q:%C="""" G QT1:%C]"" S %ERR=1 Q
79PARAN1 S %P=1 F %J=0:0 D %INC1 D QT1:%C="""" S %P=%P+$S(%C="(":1,%C=")":-1,1:0) Q:'%P I %C="" S %ERR=1 Q
80 Q
81%INC1 S %I=%I+1,%C=$E(%A,%I) Q
82 ;
83VV ; variable, label, or routine name (LABEL, KL, and FR)
84 I '%ERR,%]"",%'["@",%'?1U.UN,%'?1U.UN1"(".E1")",%'?1"%".UN1"(".E1")",%'?1"%".UN,%'?1"^"1U.UN1"(".E1")",%'?1"^%".UN1"(".E1")",%'?1"^(".E1")",%'?1"^"1U.UN S %ERR=1
85 S:%["?@" %ERR=1 Q
86 ;
87LNAME(%) ; lname (KL)
88 I %?1(1A,1"%").7UN Q 1
89 I %?1"@".E Q 1
90 Q 0
91 ;
92ER G ER^DIM
Note: See TracBrowser for help on using the repository browser.