Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: OCXOCMPE

OCXOCMPE.m

Go to the documentation of this file.
OCXOCMPE ;SLC/RJS,CLA - ORDER CHECK CODE COMPILER (Compile Rule Elements cont...) ;10/29/98  12:37
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
 ;;  ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
 ;
EN ;
 ;
 Q
 ;
GETC(OCXD0,OCXD1,OCXP) ;
 ;
 N OCXNULL
 S OCXNULL=$$GETPARM(39,OCXOPER,"OCXO NULL VALUE ALLOWED")
 I '$D(OCXP("PDFLD")) D WARN^OCXOCMPV("CMPE1 Primary Data field not defined",3,OCXD0,$P($T(+1)," ",1)) Q
 I $D(OCXP("PDFLD")) S OCXP("PDFLD")=$$GV(OCXD0,OCXD1,"DFLD1",OCXOPDT,OCXNULL)
 I '$L(OCXP("PDFLD")) D WARN^OCXOCMPV("CMPE2 Primary Data field not defined",3,OCXD0,$P($T(+1)," ",1)) Q
 ;
 I $D(OCXP("CVAL")) D  I '$L(OCXP("CVAL")) D WARN^OCXOCMPV("Comparison Value/Field not defined",3,OCXD0,$P($T(+1)," ",1)) Q
 .S OCXP("CVAL")=$$GV(OCXD0,OCXD1,"VAL1",OCXOPDT,OCXNULL)
 .I '$L(OCXP("CVAL")) S OCXP("CVAL")=$$GV(OCXD0,OCXD1,"DFLD2",OCXOPDT,OCXNULL)
 ;
 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
 .S OCXP("CLVAL")=$$GV(OCXD0,OCXD1,"VAL1",OCXOPDT,OCXNULL)
 .I '$L(OCXP("CLVAL")) S OCXP("CLVAL")=$$GV(OCXD0,OCXD1,"DFLD2",OCXOPDT,OCXNULL)
 ;
 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
 .S OCXP("CHVAL")=$$GV(OCXD0,OCXD1,"VAL2",OCXOPDT,OCXNULL)
 .I '$L(OCXP("CHVAL")) S OCXP("CHVAL")=$$GV(OCXD0,OCXD1,"DFLD3",OCXOPDT,OCXNULL)
 ;
 S OCXCOD1="S OCXCODE=$$"_OCXP
 I $O(OCXP(0)) S OCXCOD1=OCXCOD1_"(",OCXD2=0 F  S OCXD2=$O(OCXP(OCXD2)) Q:'OCXD2  D
 .I ($E(OCXP(OCXP(OCXD2)),1)="""") S OCXCOD1=OCXCOD1_""""""_OCXP(OCXP(OCXD2))_""""""
 .E  S OCXCOD1=OCXCOD1_""""_OCXP(OCXP(OCXD2))_""""
 .I $O(OCXP(OCXD2)) S OCXCOD1=OCXCOD1_","
 .E  S OCXCOD1=OCXCOD1_")"
 X OCXCOD1
 I '$L(OCXCODE) D WARN^OCXOCMPV("Execute code missing for '"_OCXCOD1_"'",2,OCXD0,$P($T(+1)," ",1)) Q
 I OCXTLOG,(OCXCODE["$$") D FILECODE("S OCXBOOLV="_OCXCODE,"S"),FILECODE("I OCXBOOLV","I") I 1
 E  D FILECODE("I "_OCXCODE,"I")
 Q
 ;
 ;
GETPARM(FILE,INST,PARM) ;
 Q:'$L(FILE) "" Q:'$L(INST) "" Q:'$L(PARM) ""
 N OCXP,OCXP1,OCXI,OCXGL
 S OCXGL="^OCXS" S:(FILE=1) OCXGL="^OCXD" S:(FILE=7) OCXGL="^OCXD" S:(FILE=10) OCXGL="^OCXD" S FILE=FILE/10+860
 Q:'$D(@OCXGL@(+FILE,0)) ""
 I (PARM=+PARM),$D(^OCXS(863.8,PARM,0)) S OCXP=PARM
 E  S OCXP=$O(^OCXS(863.8,"B",PARM,0))
 Q:'OCXP ""
 I (INST=+INST),$D(@OCXGL@(FILE,INST,0)) S OCXI=INST
 E  S OCXI=$O(@OCXGL@(FILE,"B",INST,0))
 Q:'OCXI ""
 S OCXP1=$O(@OCXGL@(FILE,OCXI,"PAR","B",OCXP,0)) S:'OCXP1 OCXP1=$O(@OCXGL@(FILE,OCXI,"PAR","B",PARM,0))
 Q:'$L(OCXP1) ""
 Q $G(@OCXGL@(FILE,OCXI,"PAR",OCXP1,"VAL"))
 ;
GV(D0,D1,SUB,DTYP,NULL) ;
 ;
 N OCXVAL,OCXFLDN,OCXFLDG,OCXD2,OCXCON,OCXCONN,OCXFREC
 ;
 S OCXVAL=$G(^OCXS(860.3,D0,"COND",D1,SUB)) Q:'$L(OCXVAL) ""
 Q:(SUB["VAL") $$EXT2INT^OCXOCMPA($P($G(^OCXS(864.1,+DTYP,0)),U,1),OCXVAL)
 ;
 S OCXVAL=+OCXVAL,OCXFLDN=$P($G(^OCXS(860.4,OCXVAL,0)),U,1),OCXCON=$P($G(^OCXS(860.3,+D0,0)),U,2)
 I 'OCXCON D WARN^OCXOCMPV("Element context missing for '"_$P($G(^OCXS(860.3,D0,0)),U,1)_"'",3,D0,$P($T(+1)," ",1)) Q
 I '$L(OCXFLDN) D WARN^OCXOCMPV("Data Field Name missing for '"_OCXDFLD_"'",3,D0,$P($T(+1)," ",1)) Q
 S OCXFREC="" I $D(^TMP("OCXCMP",$J,"DATA FIELD",OCXVAL)) M OCXFREC=^TMP("OCXCMP",$J,"DATA FIELD",OCXVAL)
 I '$O(OCXFREC(0)) D  Q ""
 .D WARN^OCXOCMPV("CMPE Get data code not defined for '"_OCXFLDN_"' ("_(+OCXVAL)_")",3,D0,$P($T(+1)," ",1)) Q
 ;
 I '$D(OCXFREC(OCXCON)) D
 .S OCXCONN=0 F  S OCXCONN=$O(OCXFREC(OCXCONN)) Q:'OCXCONN  Q:$G(OCXFREC(OCXCONN,"DA MODE"))
 .I 'OCXCONN D WARN^OCXOCMPV("CMPE Get data code mising for '"_$P($G(^OCXS(860.6,+OCXCON,0)),U,1)_"' ("_(+OCXCON)_") context of field '"_OCXFLDN_"' ("_(+OCXVAL)_")",3,D0,$P($T(+1)," ",1))
 .S OCXCON=+OCXCONN
 Q:'OCXCON ""
 ;
 I '$L($G(OCXFREC(OCXCON,"DTYP","DATA TYPE INDEX")))!'$L($G(OCXFREC(OCXCON,"DTYP","DATA TYPE NAME"))) D  Q ""
 .D WARN^OCXOCMPV("Data Type not defined for '"_OCXFLDN_"' Field",3,D0,$P($T(+1)," ",1)) Q
 I '(+DTYP=$G(OCXFREC(OCXCON,"DTYP","DATA TYPE INDEX"))) D  Q ""
 .N OCXX S OCXX="'"_OCXVAL_"-"_OCXFLDN_"' field's Data Type '"_OCXFREC(OCXCON,"DTYP","DATA TYPE NAME")
 .S OCXX=OCXX_"' is not valid for '"_OCXOPN_"' Operator  ("_(+DTYP)_"-"_$P($G(^OCXS(864.1,+DTYP,0)),U,1)_")"
 .D WARN^OCXOCMPV(OCXX,3,D0,$P($T(+1)," ",1)) Q
 ;
 S OCXFLDG="OCXDF("_(+OCXVAL)_")"
 ;
 I 'NULL D FILECODE("I $L("_OCXFLDG_")","I")
 ;
 Q OCXFLDG
 K D0,D1
 ;
FILECODE(CODE,OPLIST) ;
 ;
 N OCXNDX S OCXNDX=$O(OCXFCODE(9999),-1)+1,OCXFCODE(OCXNDX)=CODE
 S:$L($G(OPLIST)) OCXFCODE(OCXNDX,"OPLIST")=OPLIST
 Q