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

BARMPAS5.m

Go to the documentation of this file.
BARMPAS5  ;IHS/SD/PKD - Patient Account Statement ;
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**23**;OCT 26, 2005
 ;P.OTT NEW ROUTINE APR 2013 CALLED FROM BARFX001
 ;re-indexing old staments in ^XTMP('BARPAS' is needed
 ;due to PAS sorting introduced in P23
 ;
 Q
FIXPAS ;
 L +^TMP($J,"BARPAS_REINDEX"):600
 I '$T W !,"Cannot get lock on ^TMP($J,'BARPAS_REINDEX') - cannot reindex." Q
 S BARCNT=0
 S BARFILE="BARPAS" F  S BARFILE=$O(^XTMP(BARFILE)) Q:BARFILE=""  Q:BARFILE'["BARPAS"  D
 . S BARCNT=BARCNT+1 W !,BARCNT,". ",BARFILE
 . S BARSRTBY=$G(^XTMP(BARFILE,0,"SORTBY"),-1)
 . I BARSRTBY<0 D REINDEX(BARFILE) Q
 . I BARSRTBY>1 D DELETE(BARFILE) Q
 . W "  file is ok - no re-indexing needed"
 L -^TMP($J,"BARPAS_REINDEX")
 Q
REINDEX(BARFILE) ;
 D DOIT
 Q
DOIT ;
 K ^TMP($J,"BARPAS_REINDEX")
 L +^XTMP(BARFILE):360 E  W !,"CANNOT GET LOCK OF ^XTMP(",BARFILE QUIT
 W !,"FILE ",BARFILE," WILL BE NOW RE-INDEXED"
 M ^TMP($J,"BARPAS_REINDEX",BARFILE,0)=^XTMP(BARFILE,0)
 S BARLOC=0 F  S BARLOC=$O(^XTMP(BARFILE,BARLOC)) Q:+BARLOC=0  D
 . M ^TMP($J,"BARPAS_REINDEX",BARFILE,BARLOC,0,"BARFILE")=^XTMP(BARFILE,BARLOC)
 . ;;;M ^TMP($J,"BARPAS_REINDEX",BARFILE,BARLOC)=^XTMP(BARFILE,BARLOC)
 S ^TMP($J,"BARPAS_REINDEX",BARFILE,0,"SORTBY")=0
 S ^TMP($J,"BARPAS_REINDEX",BARFILE,0,"REINDEXED")=$H
 K ^XTMP(BARFILE)
 M ^XTMP(BARFILE)=^TMP($J,"BARPAS_REINDEX",BARFILE)
 K ^TMP($J,"BARPAS_REINDEX",BARFILE)
 L -^XTMP(BARFILE)
 W "  ....  DONE"
 Q
DELETE(BARFILE) ;
 W !,"FILE ",BARFILE," WILL BE REMOVED. HAS INVALID SORTING ORDER: ",BARSRTBY
 K ^XTMP(BARFILE)
 Q
TEST ;TEST - NO RE-NDEXING
 W !,"THIS IS A TEST RUN TO SIMULATE RE-IDEXING."
 W !,"NO CHANGES IN ^XTMP WILL BE DONE."
 S BARCNT=0
 S BARFILE="BARPAS" F  S BARFILE=$O(^XTMP(BARFILE)) Q:BARFILE=""  Q:BARFILE'["BARPAS"  D
 . S BARCNT=BARCNT+1 W !,BARCNT,". ",BARFILE
 . S BARSRTBY=$G(^XTMP(BARFILE,0,"SORTBY"),-1) ;P.OTT
 . I BARSRTBY<0 D  Q
 . . W !,"FILE ",BARFILE," SHOULD BE NOW RE-INDEXED" ;R ASD
 . I BARSRTBY>1 D  Q
 . . W !,"FILE ",BARFILE," SHOULD BE NOW RE-INDEXED" ;R ASD
 . W " NO ADJUSTMENT NEEDED"
 W !,"ALL DONE"
 Q