IBDFPRG1 ;ALB/AAS - AICS PURGE UTILITY ; 4-OCT-95 ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997 ; % ; -- purge utility for purging entries from the ; Form Definition file (357.95) ; Form Tracking file (357.96) ; Form Specification file (359.2) G MANUAL^IBDFPRG ; ; PURGFD(IBLDT) ; -- Procedure ; -- purge entires in Form Definition file marked for deletion ; that were marked before ibldt and no incomplete entries in ; form tracking exist ; ; Input : ibldt := only purge records with a date marked for ; deletion older than this date ; Output: ibcnt5 := number of entries in 357.95 deleted ; ibcnt2 := number of entries in 359.2 deleted ; N IBI,IBJ,IBSTAT,X,Y S (IBCNT5,IBCNT2)=0 I IBLDT=""!(IBLDT'?7N) G PURGFDQ S IBI=0 F S IBI=$O(^IBD(357.95,"ADEL",IBI)) Q:'IBI!(IBI'2) G PURGFTQ ; S IBI=0 F S IBI=$O(^IBD(357.96,"D",IBI)) Q:'IBI!(IBI'2) G STATQ ;How is none or not valid, don't delete I '$D(^IBD(357.96,ENTRY,0)) G STATQ ;Entry doesn't exist ; ; -- if delete all, okay=1 I IBHOW=2,$P($G(^IBD(357.96,ENTRY,0)),"^",3) S OKAY=1 G STATQ ; ; -- if status = complete, piece 11 must equal 3, 4, or 12 to delete S STATUS=$P($G(^IBD(357.96,ENTRY,0)),"^",11) S OKAY=$S(STATUS=3:1,STATUS=4:1,STATUS=6:1,STATUS=7:1,STATUS=12:1,1:0) ; STATQ Q OKAY ; DEL(FILE,DA) ; -- Function ; -- delete one entry ; Input : File := internal file number of file or global root ; da := internal number of entry, If more than DA ; needs to be defined then pass da array by ; reference ; Output: 1 := succeded, 0 := failed ; N SUCCESS S SUCCESS=0 I $G(FILE)=""!(+$G(DA)<1) G DELQ S DIK=FILE D ^DIK S SUCCESS=1 W:'$D(ZTQUEUED) !,"Entry number "_DA_" in file "_DIK_" Deleted!" DELQ Q SUCCESS