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

OCXOCMP.m

Go to the documentation of this file.
  1. OCXOCMP ;SLC/RJS,CLA - ORDER CHECK CODE COMPILER (Main Entry point - All Rules) ;3/21/01 08:50
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,105,243**;Dec 17,1997;Build 242
  1. ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
  1. ;
  1. EN ;
  1. ;
  1. N OCXQ
  1. ;
  1. S OCXQ=$$READ("Y","Do you want to queue the compiler to run ","NO") Q:(OCXQ[U) I OCXQ D Q
  1. .D QUE^OCXOCMPV(10)
  1. .W !!,"Expert system compiler queued to run in 10 seconds."
  1. .W !,"You will be sent a Mailman bulletin when it has finished.",!!
  1. .H 2
  1. ;
  1. MAN K ZTSK D MAN^OCXOCMPV Q ; Run the compiler (interactive/manual mode)
  1. ; ; Ask for option settings.
  1. ;
  1. AUTO D AUTO^OCXOCMPV Q ; Run the compiler (Automatic mode)
  1. ; ; Program Execution Trace Mode OFF
  1. ; ; Elapsed time logging OFF
  1. ; ; Raw Data Logging OFF
  1. ;
  1. QUE D QUE^OCXOCMPV(10) Q ; Queue the compiler to run in the background
  1. ; ; Uses option setting from last compile.
  1. ; ; If no last compile then all options are
  1. ; ; turned OFF as in Automatic mode.
  1. RUN ;
  1. ;
  1. N OCX1,OCX2,OCX3,OCX4
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(1,20)
  1. ;
  1. D MESG("Build list of Active Rules, Elements and Datafields...")
  1. D SETFLAG^OCXOCMPV ; H 1
  1. I $$EN^OCXOCMP9 D ERMESG("Compiler Aborted while building list of Rules, Elements and Datafields...") Q
  1. Q:$G(OCXWARN)
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(2,20)
  1. ;
  1. S OCX1="" F S OCX1=$O(^TMP("OCXCMP",$J,OCX1)) Q:'$L(OCX1) D
  1. .S OCX2=0 F OCX3=0:1 S OCX2=$O(^TMP("OCXCMP",$J,OCX1,OCX2)) Q:'OCX2
  1. .D MESG(" "_$J(OCX3,5)_" "_OCX1_$S(OCX3=1:"",1:"S"))
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(3,20)
  1. ;
  1. D MESG("Compile DataField Navigation code...")
  1. D SETFLAG^OCXOCMPV ; H 1
  1. I $$EN^OCXOCMP1 D ERMESG("Compiler Aborted due to Datafield syntax errors...") Q
  1. Q:$G(OCXWARN)
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(4,20)
  1. ;
  1. S (OCX3,OCX1)=0 F S OCX1=$O(^TMP("OCXCMP",$J,"DATA FIELD",OCX1)) Q:'OCX1 D
  1. .S OCX2=0 F S OCX2=$O(^TMP("OCXCMP",$J,"DATA FIELD",OCX1,OCX2)) Q:'OCX2 S OCX3=OCX3+1
  1. D MESG(" "_$J(OCX3,5)_" DataField Navigation Code Array"_$S(OCX3=1:"",1:"s"))
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(5,20)
  1. ;
  1. D MESG("Compile Element Evaluation code...")
  1. D SETFLAG^OCXOCMPV ; H 1
  1. I $$EN^OCXOCMP2 D ERMESG("Compiler Aborted due to Rule Element syntax errors...") Q
  1. Q:$G(OCXWARN)
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(6,20)
  1. ;
  1. S (OCX1,OCX2)=0 F S OCX1=$O(^TMP("OCXCMP",$J,"A CODE",OCX1)) Q:'OCX1 S OCX2=OCX2+1
  1. D MESG(" "_$J(OCX2,5)_" Event Evaluation Code Array"_$S(OCX2=1:"",1:"s"))
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(7,20)
  1. ;
  1. D MESG("Compile Element MetaCode...")
  1. D SETFLAG^OCXOCMPV ; H 1
  1. I $$EN^OCXOCMPM D ERMESG("Compiler Aborted due to Element metacode errors...") Q
  1. Q:$G(OCXWARN)
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(8,20)
  1. ;
  1. S OCX1="",OCX2=0 F S OCX1=$O(^TMP("OCXCMP",$J,"INCLUDE",OCX1)) Q:'$L(OCX1) S:($E(OCX1,1,3)="MCE") OCX2=OCX2+1
  1. D MESG(" "_$J(OCX2,5)_" Element Metacode Array"_$S(OCX2=1:"",1:"s"))
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(9,20)
  1. ;
  1. D MESG("Get Compiler Function Code...")
  1. D SETFLAG^OCXOCMPV ; H 1
  1. I $$EN^OCXOCMPO D ERMESG("Compiler Aborted due to Compiler Function code errors...") Q
  1. Q:$G(OCXWARN)
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(10,20)
  1. ;
  1. S OCX1="",OCX2=0 F S OCX1=$O(^TMP("OCXCMP",$J,"INCLUDE",OCX1)) Q:'$L(OCX1) S:'($E(OCX1,1,3)="MCE") OCX2=OCX2+1
  1. D MESG(" "_$J(OCX2,5)_" Compiler Include Function"_$S(OCX2=1:"",1:"s"))
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(12,20)
  1. ;
  1. D MESG("Compile Rule Element Relation code...")
  1. D SETFLAG^OCXOCMPV ; H 1
  1. I $$EN^OCXOCMP3 D ERMESG("Compiler Aborted due to Rule syntax errors...") Q
  1. Q:$G(OCXWARN)
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(13,20)
  1. ;
  1. S (OCX1,OCX2)=0 F S OCX1=$O(^TMP("OCXCMP",$J,"RULE",OCX1)) Q:'OCX1 D
  1. .S OCX3=0 F S OCX3=$O(^TMP("OCXCMP",$J,"RULE",OCX1,OCX3)) Q:'OCX3 S:$O(^(OCX3,"CODE",0)) OCX2=OCX2+1
  1. D MESG(" "_$J(OCX2,5)_" Rule Element Relation Code Array"_$S(OCX2=1:"",1:"s"))
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(14,20)
  1. ;
  1. D MESG("Construct Decision Tree...")
  1. D SETFLAG^OCXOCMPV ; H 1
  1. I $$EN^OCXOCMP4 D ERMESG("Compiler Aborted due to Compiler errors...") Q
  1. Q:$G(OCXWARN)
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(15,20)
  1. ;
  1. S OCX1=0 F OCX2=0:1 S OCX1=$O(^TMP("OCXCMP",$J,"C CODE",OCX1)) Q:'OCX1
  1. D MESG(" "_$J(OCX2,5)_" Sub-Routine"_$S(OCX2=1:"",1:"s"))
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(16,20)
  1. ;
  1. D MESG("Optimize Sub-Routines...")
  1. D SETFLAG^OCXOCMPV ; H 1
  1. I $$EN^OCXOCMP5 D ERMESG("Compiler Aborted due to Compiler errors...") Q
  1. Q:$G(OCXWARN)
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(17,20)
  1. ;
  1. S OCX1=0 F OCX3=0:1 S OCX1=$O(^TMP("OCXCMP",$J,"C CODE",OCX1)) Q:'OCX1
  1. D MESG(" "_$J(OCX3,5)_" Sub-Routine"_$S(OCX3=1:"",1:"s"))
  1. D MESG(" "_(100-(((OCX3/OCX2)*1000)\1/10))_"% Optimization")
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(18,20)
  1. ;
  1. D MESG("Assemble Routines...")
  1. D SETFLAG^OCXOCMPV ; H 1
  1. I $$EN^OCXOCMP6 D ERMESG("Compiler Aborted due to Compiler errors...") Q
  1. Q:$G(OCXWARN)
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(19,20)
  1. ;
  1. S OCX1=0 F OCX2=0:1 S OCX1=$O(^TMP("OCXCMP",$J,"D CODE",OCX1)) Q:'OCX1
  1. D MESG(" "_$J(OCX2,5)_" OCXOZ* Routine"_$S(OCX2=1:"",1:"s"))
  1. ;
  1. D:($G(OCXAUTO)<2) STATUS^OCXOPOST(20,20)
  1. ;
  1. L -^OCXD(861,1)
  1. ;
  1. Q
  1. ;
  1. MESG(OCXX) ;
  1. I '$G(OCXAUTO) W !!,OCXX
  1. I ($G(OCXAUTO)=1) D BMES^XPDUTL(.OCXX)
  1. Q
  1. ;
  1. ERMESG(OCXX) ;
  1. N OCXY S OCXY=OCXX
  1. I '$G(OCXAUTO) W !!,OCXX
  1. I ($G(OCXAUTO)=1) D BMES^XPDUTL(.OCXX)
  1. S OCXERRM=OCXY
  1. Q
  1. ;
  1. READ(OCXZ0,OCXZA,OCXZB,OCXZL) ;
  1. N OCXLINE,DIR,DTOUT,DUOUT,DIRUT,DIROUT
  1. Q:'$L($G(OCXZ0)) U
  1. S DIR(0)=OCXZ0
  1. S:$L($G(OCXZA)) DIR("A")=OCXZA
  1. S:$L($G(OCXZB)) DIR("B")=OCXZB
  1. F OCXLINE=1:1:($G(OCXZL)-1) W !
  1. D ^DIR
  1. I $D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT) Q U
  1. Q Y
  1. ;
  1. Q
  1. ;
  1. DT(X,D) N Y,%DT S %DT=D D ^%DT Q Y
  1. Q
  1. ;
  1. CNT(X) ;
  1. ;
  1. N CNT,D0
  1. S D0=0 F CNT=1:1 S D0=$O(@X@(D0)) Q:'D0
  1. W !!,?10,X," ",CNT
  1. Q CNT
  1. ;
  1. DATE() N X,Y,%DT S X="N",%DT="T" D ^%DT X ^DD("DD") Q Y
  1. ;
  1. CONV(Y) Q:'(Y["@") Y Q $P(Y,"@",1)_" at "_$P(Y,"@",2,99)
  1. ;
  1. ;
  1. VERSION() Q $P($T(+3),";;",3)
  1. ;