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

IBDF19.m

Go to the documentation of this file.
  1. IBDF19 ;ALB/CJM - ENCOUNTER FORM (compile forms,delete workcopy);NOV 22,1993
  1. ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
  1. GARBAGE ;delete unused blocks (belonging to WORKCOPY form)
  1. N IBJUNK,BLK,CR,FORM
  1. ;
  1. ;first delete unused workcopy blocks
  1. ;find the form=WORKCOPY, used as a work area
  1. S IBJUNK=+$O(^IBE(357,"B","WORKCOPY",""))
  1. ;clean up blocks not being used
  1. S BLK=0 F S BLK=$O(^IBE(357.1,"C",IBJUNK,BLK)) Q:'BLK L +^IBE(357.1,BLK):1 I $T D DLTBLK^IBDFU3(BLK,IBJUNK,357.1) L -^IBE(357.1,BLK)
  1. W !,"Blocks not belonging to any form have been deleted"
  1. ;
  1. ;delete cross-references for compilied forms if the forms have been deleted
  1. F CR="AT","AC","AG","AU","AB" S FORM=0 F S FORM=$O(^IBE(357,CR,FORM)) Q:'FORM I '$D(^IBE(357,FORM)) K ^IBE(357,CR,FORM)
  1. W !,"Extraneous cross-references on non-existant forms have been deleted"
  1. Q
  1. ;
  1. ;
  1. COMPILE ;compiles IBFORM at the form level - leaves blocks already compiled alone
  1. ;
  1. ;lock the form while compiling
  1. Q:'$$LOCKFORM^IBDFU7(IBFORM)
  1. ;compile it only if not already compiled - it could have been compiled by another process while the form was being locked
  1. I $$FORMDSCR^IBDFU1C(.IBFORM) I 'IBFORM("COMPILED") D
  1. .N IBARRAY,IBDEVICE,IBPRINT,DFN,IBCLINIC,IBAPPT,SUB
  1. .S (IBDEVICE("RASTER"),IBDEVICE("GRAPHICS"))=1
  1. .S (IBDEVICE("CRT"),IBDEVICE("LISTMAN"),IBAPPT,IBCLINIC,DFN,IBDEVICE("PCL"))=0
  1. .D UNCMPL(.IBFORM,0)
  1. .D PRNTPRMS^IBDFU1C(.IBPRINT,0,1,0,1)
  1. .D ARRAYS^IBDFU1C(.IBFORM,.IBARRAY)
  1. .K ^TMP("IB",$J,"INTERFACES")
  1. .S SUB="" F S SUB=$O(IBARRAY(SUB)) Q:SUB="" K @IBARRAY(SUB)
  1. .D DRWBLKS^IBDF2A
  1. .S:IBFORM("COMPILED")'="F" IBFORM("COMPILED")=1
  1. .S $P(^IBE(357,IBFORM,0),"^",5)=IBFORM("COMPILED")
  1. .; -- if form not scannable and it compiled w/o formtype id...get one
  1. .I 'IBFORM("SCAN"),IBFORM("COMPILED"),'$P(^IBE(357,IBFORM,0),"^",13) S IBFORM("TYPE")=$$FORMTYPE^IBDF18D(1) I IBFORM("TYPE") S $P(^IBE(357,IBFORM,0),"^",13)=IBFORM("TYPE")
  1. .S:$P(^IBE(357,IBFORM,0),"^",13) ^IBE(357,"ADEF",$P(^IBE(357,IBFORM,0),"^",13),IBFORM)=""
  1. .K ^TMP("IB",$J,"INTERFACES"),X,Y,I
  1. D FREEFORM^IBDFU7(IBFORM)
  1. ; -- build form spec if form compiled successfully
  1. I IBFORM("SCAN"),IBFORM("COMPILED"),IBFORM("TYPE") D SCAN^IBDFBKS(IBFORM("TYPE"))
  1. Q
  1. ;
  1. ASKCMPL(IBFORM) ;ask if the form should be compiled or uncompiled
  1. Q:'$G(IBFORM)
  1. N BLK,QUIT S QUIT=0
  1. I $P($G(^IBE(357,IBFORM,0)),"^",5) D
  1. .W !,"The form is currently compiled. Should it be recompiled?"
  1. .K DIR S DIR(0)="Y",DIR("B")="YES"
  1. .D ^DIR K DIR
  1. .S:$D(DUOUT)!(Y'=1) QUIT=1
  1. Q:QUIT
  1. ;uncompile the form
  1. D UNCMPALL(IBFORM)
  1. Q
  1. ;
  1. CMPLACTN ;action for compiling a form listed on the screen
  1. N IBFORM
  1. I $G(IBAPI("SELECT"))'="" X IBAPI("SELECT")
  1. I IBFORM D ASKCMPL(IBFORM)
  1. S VALMBCK="R"
  1. Q
  1. ;
  1. KILLTBL(IBFORM) ;
  1. ; -- marks the FORM DEFINITION TABLE for deletion
  1. ; IBFORM("TYPE") is reset to "", pass IBFORM by reference
  1. ;
  1. Q:'IBFORM("TYPE")
  1. ;
  1. ; -- Mark forms for deletion
  1. S $P(^IBD(357.95,IBFORM("TYPE"),0),"^",2)=DT,^IBD(357.95,"ADEL",DT,IBFORM("TYPE"))=""
  1. K ^IBE(357,"ADEF",IBFORM("TYPE"),IBFORM) ; kill cross reference
  1. S IBFORM("TYPE")="",$P(^IBE(357,IBFORM,0),"^",13)=""
  1. Q
  1. ;
  1. UNCMPL(IBFORM,FAILED) ;marks the form as not compiled and deletes or marks for deletion the FORM DEFINITION TABLE
  1. ;leaves the blocks compiled
  1. ;if FAILED means compilation of form was attempted, but failed - mark form accordingly
  1. ;IBFORM is the form - if passed by reference IBFORM("TYPE") and IBFORM("COMPILED") are set
  1. ;
  1. Q:'IBFORM
  1. N NODE
  1. S NODE=$G(^IBE(357,IBFORM,0))
  1. S IBFORM("SCAN")=$P(NODE,"^",12),IBFORM("TYPE")=$P(NODE,"^",13)
  1. D:IBFORM("TYPE") KILLTBL(.IBFORM)
  1. S IBFORM("COMPILED")=$S($G(FAILED):"F",1:0),$P(^IBE(357,IBFORM,0),"^",5)=IBFORM("COMPILED")
  1. Q
  1. ;
  1. UNCMPALL(IBFORM) ;uncompile the form and it's blocks
  1. N BLK
  1. D UNCMPL(IBFORM,0)
  1. ;also uncompile all of its blocks
  1. S BLK=0 F S BLK=$O(^IBE(357.1,"C",IBFORM,BLK)) Q:'BLK D UNCMPBLK^IBDF19(BLK)
  1. Q
  1. BLKCHNG(FORM,BLOCK) ;call this if the block is edited - uncompiles the block and form
  1. D UNCMPBLK(BLOCK)
  1. D UNCMPL(FORM)
  1. Q
  1. ;
  1. UNCMPBLK(BLOCK) ;delete the compiled version of the block
  1. K ^IBE(357.1,BLOCK,"V"),^IBE(357.1,BLOCK,"S"),^IBE(357.1,BLOCK,"B"),^IBE(357.1,BLOCK,"H")
  1. Q
  1. ;
  1. KILL(TYPE) ;deletes the form definition=TYPE
  1. K ^IBD(357.95,"AC",TYPE),^IBD(357.95,TYPE,1)
  1. K ^IBD(357.95,"AD",TYPE),^IBD(357.95,TYPE,2)
  1. K DA S DIK="^IBD(357.95,",DA=TYPE D ^DIK K DIK,DA
  1. Q
  1. ;
  1. RECMPALL ;causes all forms to be recompiled
  1. N IBFORM,IBQUIT,DIR,DIRUT,DUOUT,DTOUT
  1. S IBQUIT=0
  1. I '$D(ZTQUEUED) D
  1. .S DIR("?")="Enter 'Yes' to cause all forms to uncompile or 'No' to do nothing. Forms will actually recompile as they are printed."
  1. .S DIR(0)="Y",DIR("A")="Do you really want to Recompile all Forms"
  1. .D ^DIR S IBQUIT='Y
  1. I $G(IBQUIT) W !!,"Okay, nothing recompiled" Q
  1. ;
  1. W:'$D(ZTQUEUED) !!,"Uncompiling all forms..."
  1. S IBFORM=0
  1. F S IBFORM=$O(^IBE(357,IBFORM)) Q:'IBFORM D
  1. .Q:'$$LOCKFORM^IBDFU7(IBFORM)
  1. .D UNCMPALL(IBFORM)
  1. .D FREEFORM^IBDFU7(IBFORM)
  1. .W:'$D(ZTQUEUED) "."
  1. W:'$D(ZTQUEUED) !!,"Okay, forms will be recompiled as they are printed."
  1. Q