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

SCMCLN.m

Go to the documentation of this file.
  1. SCMCLN ;swo/oifobp temp clean up routine
  1. ;;5.3;Scheduling;**498**;8.13.1993;Build 23
  1. ;lets clean-up danglers in 404.43 PATIENT TEAM POSITION ASSIGNMENT
  1. ;1st run thru 404.43 and find the pointers to 404.42 PATIENT TEAM ASSIGNMENT
  1. ;pointer is piece one of 404.43
  1. N CNT1,CNT2,DA,DIK,DIR,V1,V2,V3,V4,ZNODE
  1. S (CNT1,CNT2)=0
  1. W !,"Checking for ""Ghost Entries"" in the PATIENT TEAM POSITION ASSIGNMENT FILE."
  1. W !,"This may take a moment. You will be provided with a list showing corrupted"
  1. W !,"file entries. To perform a clean-up accept the ""Yes"" prompt after the list"
  1. W !,"is displayed. Answer ""No"" to abort the clean-up.",!
  1. S V1=0 F S V1=$O(^SCPT(404.43,V1)) Q:'V1 D
  1. . S CNT1=CNT1+1
  1. . S ZNODE=$G(^SCPT(404.43,V1,0))
  1. . S V2=$P(ZNODE,U) Q:V2=""
  1. . S V3=$G(^SCPT(404.42,V2,0)) I V3="" D LOG
  1. D SHOW Q:POP
  1. I $G(CNT2)<1 W !,"Nothing to clean up...." Q
  1. S DIR("?")="Answerng Yes will perform a clean-up of the ghost entries"
  1. S DIR("A")="Perform File Clean-Up"
  1. S DIR(0)="Y",DIR("B")="No" D ^DIR
  1. I Y D DEL
  1. D CLEAN
  1. Q
  1. LOG ;build a list in ^TMP("SCMCLN",$J
  1. S ^TMP("SCMCLN",$J,V1)=""
  1. S CNT2=CNT2+1
  1. Q
  1. SHOW ;see what we got
  1. S DIOEND="D FOOT^SCMCLN"
  1. S DIC="^SCPT(404.43,",L=0,BY="@.03",(FR,TO)="",FLDS="[CAPTIONED]"
  1. S BY(0)="^TMP(""SCMCLN"",$J,"
  1. S L(0)=1 D EN1^DIP
  1. Q
  1. DEL ;delete the danglers
  1. ;check #404.48 -- PCMM HL7 EVENT FILE .07 field EVENT POINTER points to 404.43
  1. ;variable pointer, yeck!
  1. S DIK="^SCPT(404.43,"
  1. S V1=0 F S V1=$O(^TMP("SCMCLN",$J,V1)) Q:'V1 D
  1. .S V4=""""_V1_";SCPT(404.43,"_""""
  1. .I $O(^SCPT(404.48,"AACXMIT",V4,"")) D Q ;
  1. .. S ^TMP("SCMCLN2",$J,V1)=""
  1. .. W !,"Pointer to HL7 EVENT file - the entry ("_V1_") was not deleted."
  1. .S DA=V1
  1. .D ^DIK
  1. W !,"Clean-up completed",!
  1. Q
  1. CLEAN ;clean-up
  1. K ^TMP("SCMCLN",$J)
  1. K ^TMP("SCMCLN2",$J)
  1. Q
  1. W !,CNT1_" entries searched. Ghost entries found: "_CNT2
  1. Q
  1. TEST ;
  1. S X=0 F S X=$O(^SCPT(404.48,X)) Q:'X D
  1. . Q:($P(^SCPT(404.48,X,0),U,7)'[404.43)
  1. . W ^SCPT(404.43,$P($P(^SCPT(404.48,X,0),U,7),";"),0),!
  1. . Q