source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOCMPL.m@ 1544

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

initial load of FOIAVistA 6/30/08 version

File size: 5.1 KB
Line 
1OCXOCMPL ;SLC/RJS,CLA - ORDER CHECK CODE COMPILER (Compile Complex Rule Element Expressions) ;10/29/98 12:37
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
3 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
4 ;
5EN ;
6 ;
7 Q
8 ;
9GETC(OCXD0,OCXEXP,OCXDTYP,OCXCD) ;
10 ;
11 N OCXCHR,OCXCOD1,OCXCODE,OCXD2,OCXNULL,OCXOPC,OCXOPER,OCXOPN,OCXP,OCXPOS,OCXPTR1,OCXPTR2,OCXVNAM,OCXITEM
12 ;
13 F OCXPTR1=1:1:$L(OCXEXP) S OCXCHR=$E(OCXEXP,OCXPTR1) D
14 .;
15 .I (OCXCHR="|") D Q
16 ..F OCXPTR2=(OCXPTR1+1):1:$L(OCXEXP) Q:($E(OCXEXP,OCXPTR2)="|")
17 ..S OCXITEM($O(OCXITEM(""),-1)+1)=$$STSPAC($E(OCXEXP,OCXPTR1+1,OCXPTR2-1)),OCXPTR1=OCXPTR2
18 .;
19 .I (OCXCHR="""") D Q
20 ..F OCXPTR2=(OCXPTR1+1):1:$L(OCXEXP) Q:($E(OCXEXP,OCXPTR2)="""")
21 ..S OCXITEM($O(OCXITEM(""),-1)+1)=$$STSPAC($E(OCXEXP,OCXPTR1+1,OCXPTR2-1)),OCXPTR1=OCXPTR2
22 .;
23 .I (OCXCHR?1A) D Q
24 ..F OCXPTR2=(OCXPTR1+1):1:$L(OCXEXP) Q:($E(OCXEXP,OCXPTR2)="""") Q:($E(OCXEXP,OCXPTR2)="|")
25 ..S OCXITEM($O(OCXITEM(""),-1)+1)=$$STSPAC($E(OCXEXP,OCXPTR1,OCXPTR2-1)),OCXPTR1=OCXPTR2-1
26 ;
27 S OCXOPER=$$OPER(OCXITEM(2),OCXDTYP)
28 I '(OCXOPER) D WARN^OCXOCMPV("Operator/Function ("_OCXDTYP_") '"_OCXITEM(2)_"' not defined...",3,OCXEL,$P($T(+1)," ",1)) Q ""
29 S OCXOPN=$P($G(^OCXS(863.9,OCXOPER,0)),U,1)
30 S OCXOPC=$$GETPARM^OCXOCMPE(39,OCXOPER,"OCXO GENERATE CODE FUNCTION")
31 I '$L(OCXOPC) D WARN^OCXOCMPV("'"_OCXOPN_"' Operator 'OCXO GENERATE CODE FUNCTION' parameter not defined",3,OCXEL,$P($T(+1)," ",1)) Q ""
32 S:'(OCXOPC=+OCXOPC) OCXOPC=$$GETIEN("^OCXS(863.7)",OCXOPC)
33 I '$D(^OCXS(863.7,+OCXOPC,0)) D WARN^OCXOCMPV("'"_OCXOPN_"' Operator 'OCXO GENERATE CODE FUNCTION' Public Function not defined",3,OCXEL,$P($T(+1)," ",1)) Q ""
34 S OCXP=$G(^OCXS(863.7,+OCXOPC,"EX")) I '$L(OCXP) D WARN^OCXOCMPV("Operator ("_(+OCXOPC)_") '"_$P($G(^OCXS(863.9,+OCXOPC,0)),U,1)_"' executable not defined",3,OCXEL,$P($T(+1)," ",1)) Q ""
35 S OCXD2=0 F S OCXD2=$O(^OCXS(863.7,+OCXOPC,"PAR",OCXD2)) Q:'OCXD2 D
36 .N OCXPOS,OCXVNAM
37 .S OCXPOS=+$G(^OCXS(863.7,+OCXOPC,"PAR",OCXD2,"IN")) Q:'OCXPOS Q:$D(OCXP(OCXPOS))
38 .S OCXVNAM=+$G(^OCXS(863.7,+OCXOPC,"PAR",OCXD2,0)) Q:'OCXVNAM
39 .S OCXVNAM=$P($G(^OCXS(863.8,+OCXVNAM,0)),U,2) Q:'$L(OCXVNAM)
40 .S OCXP(+OCXPOS)=OCXVNAM,OCXP(OCXVNAM)=""
41 ;
42 S OCXNULL=$$GETPARM(39,OCXOPER,"OCXO NULL VALUE ALLOWED")
43 I '$D(OCXP("PDFLD")) D WARN^OCXOCMPV("CMPE1 Primary Data field not defined",3,OCXD0,$P($T(+1)," ",1)) Q ""
44 I $D(OCXP("PDFLD")) S OCXP("PDFLD")=OCXITEM(1)
45 I '$L(OCXP("PDFLD")) D WARN^OCXOCMPV("CMPE2 Primary Data field not defined",3,OCXD0,$P($T(+1)," ",1)) Q ""
46 ;
47 I $D(OCXP("CVAL")) D I '$L(OCXP("CVAL")) D WARN^OCXOCMPV("Comparison Value/Field not defined",3,OCXD0,$P($T(+1)," ",1)) Q ""
48 .S OCXP("CVAL")=OCXITEM(3)
49 .I '$L(OCXP("CVAL")) S OCXP("CVAL")=$$GV^OCXOCMPE(OCXD0,OCXD1,"DFLD2",OCXOPDT,OCXNULL)
50 ;
51 I $D(OCXP("CLVAL")) D I '$L(OCXP("CLVAL")) D WARN^OCXOCMPV("Comparison Value/Field minimum value not defined",3,OCXD0,$P($T(+1)," ",1)) Q ""
52 .S OCXP("CLVAL")=OCXITEM(3)
53 .I '$L(OCXP("CLVAL")) S OCXP("CLVAL")=$$GV^OCXOCMPE(OCXD0,OCXD1,"DFLD2",OCXOPDT,OCXNULL)
54 ;
55 I $D(OCXP("CHVAL")) D I '$L(OCXP("CHVAL")) D WARN^OCXOCMPV("Comparison Value/Field maximum value not defined",3,OCXD0,$P($T(+1)," ",1)) Q ""
56 .S OCXP("CHVAL")=OCXITEM(5)
57 .I '$L(OCXP("CHVAL")) S OCXP("CHVAL")=$$GV^OCXOCMPE(OCXD0,OCXD1,"DFLD3",OCXOPDT,OCXNULL)
58 ;
59 S OCXCOD1="S OCXCODE=$$"_OCXP
60 I $O(OCXP(0)) S OCXCOD1=OCXCOD1_"(",OCXD2=0 F S OCXD2=$O(OCXP(OCXD2)) Q:'OCXD2 D
61 .I ($E(OCXP(OCXP(OCXD2)),1)="""") S OCXCOD1=OCXCOD1_""""""_OCXP(OCXP(OCXD2))_""""""
62 .E S OCXCOD1=OCXCOD1_""""_OCXP(OCXP(OCXD2))_""""
63 .I $O(OCXP(OCXD2)) S OCXCOD1=OCXCOD1_","
64 .E S OCXCOD1=OCXCOD1_")"
65 X OCXCOD1
66 I '$L(OCXCODE) D WARN^OCXOCMPV("Execute code missing for '"_OCXCOD1_"'",2,OCXD0,$P($T(+1)," ",1)) Q ""
67 S OCXCD="I "_OCXCODE_" D @@@@" Q OCXWARN
68 ;
69GETIEN(FILE,KEY) ;
70 ;
71 N IEN1,IEN2,LEN,SHORT
72 F LEN=$L(KEY):-1:0 I LEN Q:$D(@FILE@("B",$E(KEY,1,LEN)))
73 Q:'LEN 0 S SHORT=$E(KEY,1,LEN)
74 S IEN1=0 F S IEN1=$O(@FILE@("B",SHORT,IEN1)) Q:'IEN1 Q:($P($G(@FILE@(IEN1,0)),U,1)=KEY)
75 S IEN2=IEN1 F S IEN2=$O(@FILE@("B",SHORT,IEN2)) Q:'IEN2 Q:($P($G(@FILE@(IEN2,0)),U,1)=KEY)
76 I IEN1,IEN2 Q -1
77 Q IEN1
78 ;
79OPER(OPER,DTYP) ;
80 ;
81 N DTYPN,OPERN
82 S DTYPN=$O(^OCXS(864.1,"B",DTYP,0)) Q:'DTYPN 0
83 S OPERN=0 F S OPERN=$O(^OCXS(863.9,"B",OPER,OPERN)) Q:'OPERN Q:($P($G(^OCXS(863.9,+OPERN,0)),U,2)=DTYPN)
84 Q:OPERN OPERN
85 S OPERN=0 F S OPERN=$O(^OCXS(863.9,"SYN",OPER,OPERN)) Q:'OPERN Q:($P($G(^OCXS(863.9,+OPERN,0)),U,2)=DTYPN)
86 Q OPERN
87 ;
88GETPARM(FILE,INST,PARM) ;
89 Q:'$L(FILE) "" Q:'$L(INST) "" Q:'$L(PARM) ""
90 N OCXP,OCXP1,OCXI,OCXGL
91 S OCXGL="^OCXS" S:(FILE=1) OCXGL="^OCXD" S:(FILE=7) OCXGL="^OCXD" S:(FILE=10) OCXGL="^OCXD" S FILE=FILE/10+860
92 Q:'$D(@OCXGL@(+FILE,0)) ""
93 I (PARM=+PARM),$D(^OCXS(863.8,PARM,0)) S OCXP=PARM
94 E S OCXP=$O(^OCXS(863.8,"B",PARM,0))
95 Q:'OCXP ""
96 I (INST=+INST),$D(@OCXGL@(FILE,INST,0)) S OCXI=INST
97 E S OCXI=$O(@OCXGL@(FILE,"B",INST,0))
98 Q:'OCXI ""
99 S OCXP1=$O(@OCXGL@(FILE,OCXI,"PAR","B",OCXP,0)) S:'OCXP1 OCXP1=$O(@OCXGL@(FILE,OCXI,"PAR","B",PARM,0))
100 Q:'$L(OCXP1) ""
101 Q $G(@OCXGL@(FILE,OCXI,"PAR",OCXP1,"VAL"))
102STSPAC(S) ;
103 ;
104 N X
105 ;
106 F X=1:1:$L(S) Q:'($E(S,X)=" ")
107 S S=$E(S,X,$L(S))
108 ;
109 F X=$L(S):-1:1 Q:'($E(S,X)=" ")
110 S S=$E(S,1,X)
111 ;
112 Q S
113 ;
Note: See TracBrowser for help on using the repository browser.