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

AIBMRG1.m

Go to the documentation of this file.
AIBMRG1 ;RPMS/CMB/TJF ;GENERIC GLOBAL MERGE MULTIPLE REEL ROUTINE [ 02/01/89  9:13 AM ]
 ;1.3 ;MODIFY TO KILL LOCAL VARIABLES OVERLOOKED IN VER 1.30
 ;1.3; 9/23/88 RESTRUCTURE, ALLOW FOR REGISTRATION ELIGIBILITY FILE
 ;1.1 ;5/30/88
INIT ;INITIALIZE FIELDS
 S AIBPCC=0 S:'$D(U) U="^"
 K X,AIBGBL,AIBFD S AIBSEQ=1,(AIBA,AIBMSG)=""
 S (IO(0),AIBCDV)=$I I ^%ZOSF("OS")["MSM" S AIBOS="M"
 E  S AIBOS="D"
 K AIBFBD,AIBFED,AIBS,AIBFTR
 D IN^AIBSDEV
 G RETURN
NEXTFILE ;
 U AIBCDV W !,"Sequence #",AIBSEQ," restored",!
 U AIBDEV R AIBXX:DTIME G:'$T SEQNO U AIBCDV I AIBXX="**" S QUIT=1 G RETURN
SEQNO U AIBCDV W !,"Please put sequence #",AIBSEQ+1," into the drive and"
 S AIBSEQ=AIBSEQ+1
NEXTFIL1 R !,"Press <RETURN> when ready",AIBXX:DTIME G:'$T NEXTFIL1
 I AIBXX?1"?".E W !!,"Press <RETURN> to continue restoring from sequence #",AIBSEQ,!,"or abort the restore by entering 'control C'" G NEXTFIL1
 D CLOSE^AIBSDEV S IN=1,AIBPARMS=AIBPSV D OPEN^AIBSDEV
 U AIBDEV I '$ZA R AIBXX:DTIME G:'$T NXTSEQ
 I $ZC U AIBCDV
 E  W !!,"Cannot access ",AIBFN,", please correct" G NEXTFIL1
 I AIBXX?2NP1":"2N1" ".E S AIBXX=1
 I AIBXX'=AIBSEQ W !!,"Out of sequence, this file is #",AIBXX,", please correct" G NEXTFIL1
 S QUIT=0 G RETURN
NXTSEQ ;RETRY ACCESS OF FILE
 U AIBCDV W !!,"Cannot access ",AIBFN,", please correct"
 G NEXTFIL1
FACTSET ;SETUP FACILITY TAPE HEADER VALUES
 U AIBCDV W AIBGSEL,!
 S AIBGBLP=$E(AIBGSEL,2,5),AIBGBL=U_AIBGBLP_"GLOB"
 S AIBGBLN=AIBGBL_"(0)"
 S AIBGBLF=AIBGBL_"(AIBFTL,0)"
 S AIBGBLD=AIBGBL_"(AIBFTL,AIBCT)"
 I AIBPCC G PCCFACL
 S AIBFD=AIBGV G GETFCDAT
PCCFACL ;FIND FACILITY LOCATION FOR PCC
 S AIBW=$E(AIBGV,21,26),(AIBX,AIBY)="",AIBX=$O(^AUTTLOC("C",AIBW,AIBX))
 I AIBX="" G BLDPCC
 S AIBY=$P(^AUTTLOC(AIBX,0),U,2)
BLDPCC ;BUILD PCC FACILITY ZEROTH NODE DATA
 S AIBFD=AIBW_U_AIBY_U_U_U_U_U
GETFCDAT ;GET FACILITY DATA FROM INPUT FILE
 S AIBFTL=$P(AIBFD,"^",1)
 S AIBFTN=$P(AIBFD,"^",2)
 S AIBFRD=$P(AIBFD,"^",3)
 S AIBFTB=$P(AIBFD,"^",4)
 S AIBFTE=$P(AIBFD,"^",5)
 S AIBFTT=$P(AIBFD,"^",6)
 S AIBFCT=$P(AIBFD,"^",7)
 S AIBFTC=$P(AIBFD,"^",8)
 S AIBFTD=$P(AIBFD,"^",9)
 G RETURN
ZERSET ;
 S AIBZB=$P(@AIBGBLN,"^",1)
 S AIBZE=$P(@AIBGBLN,"^",2)
 S AIBZN=$P(@AIBGBLN,"^",3)
 S AIBZR=$P(@AIBGBLN,"^",4)
 S AIBZF=$P(@AIBGBLN,"^",5)
 I $D(@AIBGBLF) G CKMLOG
 S $P(@AIBGBLF,"^",1)=$P(AIBFD,"^",4)
 S $P(@AIBGBLF,"^",2)=$P(AIBFD,"^",2)
 S $P(@AIBGBLF,"^",3)=0
 S $P(@AIBGBLF,"^",4)=0
 S $P(@AIBGBLF,"^",5)=$P(AIBFD,"^",2)
CKMLOG ;CHECK MERGE LOG FILE
 ;D SEARCHM^AIBLOGF
 G RETURN
FACSET ;
 S AIBFBD=$P(@AIBGBLF,"^",1)
 S AIBFED=$P(@AIBGBLF,"^",2)
 S AIBFTR=$P(@AIBGBLF,"^",3)
 S AIBS=$P(@AIBGBLF,"^",4)
 S AIBFNM=$P(@AIBGBLF,"^",5)
 G RETURN
UPDATE ;BALANCE CHECK
 D:$D(AIBDEV) CLOSE^AIBSDEV
 I AIBFCT=AIBRC!(AIBPCC) G COMPUTE
 U AIBCDV W !!,"# Records Merged and Tape Count Not Equal"
 W !,"Tape count was ",AIBFCT
COMPUTE ;UPDATE ZEROTH NODES IN MERGE GLOBAL
 I AIBFTB<AIBZB S $P(@AIBGBLN,"^",1)=AIBFTB
 I AIBFTE>AIBZE S $P(@AIBGBLN,"^",2)=AIBFTE
 S $P(@AIBGBLN,"^",3)=AIBZN
 S $P(@AIBGBLN,"^",4)=AIBZR+AIBRC
 S $P(@AIBGBLN,"^",5)=AIBFTL
 I AIBFTB<AIBFBD S $P(@AIBGBLF,"^",1)=AIBFTB
 I AIBFTE>AIBFED S $P(@AIBGBLF,"^",2)=AIBFTE
 S $P(@AIBGBLF,"^",3)=AIBFTR+AIBRC
 S $P(@AIBGBLF,"^",4)=AIBCT-1
 U AIBCDV
 W !!,"Merge Complete"," ",AIBRC
 W " Records Merged ",AIBNC," Nodes Merged"
KILLVAR ;KILL LOCAL VARIABLES
 K AIBA,AIBCDV,AIBCT
 K AIBFBD,AIBFCT,AIBFD,AIBFED,AIBFNM
 K AIBFRD,AIBFTB,AIBFTC,AIBFTD,AIBFTE,AIBFTL,AIBFTN,AIBFTR,AIBFTT
 K AIBGBL,AIBGBLD,AIBGBLF,AIBGBLN,AIBLK,AIBMSG
 K AIBNC,AIBPCC,AIBPSV,AIBR,AIBRC,AIBRM,AIBT2,AIBTONL,AIBTDV,AIBS,AIBV
 K AIBW,AIBX,AIBY,AIBZB,AIBZE,AIBZF,AIBZN,AIBZR
 K QUIT,X,Y,IO
 K AIBANS,AIBCMT,AIBFN,AIBGN,AIBGNL,AIBGNN,AIBGSEL,AIBGV,AIB,%IS,%MT,AIBPARMS,AIBTIME
 K AIBSBP,AIBSEL,AIBSEQ,AIBSIZE,AIBT,AIBXX
RETURN ;RETURN TO CALLING ROUTINE
 Q