AIBLOGF ;DDPS/DFM ;LOG FILE PROCESSING [ 12/27/88 4:23 PM ]
;1.3 ;BEGIN PROCESSING CONTROL LOG FILES
SEARCHM ;LOOK FOR CURRENT MERGE LOG CONTROL FILE
S AIBGBLD0="",AIBGBLD0=$O(^AIBCVTC("B",AIBGBLP,AIBGBLD0)) I AIBGBLD0="" W !,"No control information for system "_AIBGBLP S AIBA="A" G RETURN
S AIBLMD0="",AIBLMD0=$O(^AIBMLOG("AC",AIBGBLD0,AIBLMD0)) I AIBLMD0="" W !,"No merge log key active for "_AIBGBLP G BUILDM
S AIBLMK=$P(^AIBMLOG(AIBLMD0,0),U,1) W !,"Active merge log key is ",AIBLMK G RETURN
BUILDM ;BUILD KEY FIELDS IN MERGE LOG CONTROL FILE
S DR=".01///"_AIBGBLP_NOW_";1///"_AIBGBLD0_";2///NOW"
K Y S DIE="^AIBMLOG(" D ^DIE I $D(Y) W !,"Write to Merge log file unsucessful ",Y S AIBA="A" G RETURN
W !,"New merge log entry made" G RETURN
SEARCHD ;LOOK FOR MATCHING DATA LOG CONTROL FILE
S AIBLKY=AIBGBLP_AIBFTL_AIBFRD W !,"Searching for data log key "_AIBLKY
S AIBLD0="",AIBLD0=$O(^AIBLOG("B",AIBLKY,AIBLD0))
I AIBLD0="" W !,"None found, Will build" G CKCTRLD
G RETURN
CKCTRLD ;CHECK CONTROL GLOBAL FOR LOCATION DEFINITION
S AIBFTLD0="",AIBFTLD0=$O(^AUTTLOC("B",AIBFTL,AIBFTLD0))
I AIBFTLD0="" W !,"Facility not on file for "_AIBFTL S AIBA="A" G RETURN
BUILD ;BUILD KEY FIELDS IN DATA LOG CONTROL FILE
S DR=".01///"_AIBLKY_";1///"_AIBGBLD0_";2///"_AIBFTLD0_";3///"_AIBFRD
K Y S DIE="^AIBLOG(" D ^DIE I $D(Y) W !,"Write to Data log file unsucessful ",Y S AIBA="A" G RETURN
W !,"New merge log entry made" G RETURN
UPDATEM ;UPDATE MERGE LOG FILE
S DA=AIBLMD0,DR=".01///"_AIBLMK_";4///"_AIBFTR_"6///"_AIBLMD0
K Y S DIE="^AIBMLOG(" D ^DIE I $D(Y) W !,"Update to Merge log file unsucessful ",Y S AIBA="A" G RETURN
G RETURN
UPDATED ;UPDATE DATA LOG FILE
S DA=AIBLD0,DR=".01///"_AIBLKY_";3///NOW;4///"_AIBFTR_";6///"_"""Y"""
K Y S DIE="^AIBLOG(" D ^DIE I $D(Y) W !,"Update to Data log file unsucessful ",Y S AIBA="A" G RETURN
G RETURN
RETURN ;RETURN TO CALLING PROGRAM
Q
AIBLOGF ;DDPS/DFM ;LOG FILE PROCESSING [ 12/27/88 4:23 PM ]
+1 ;1.3 ;BEGIN PROCESSING CONTROL LOG FILES
SEARCHM ;LOOK FOR CURRENT MERGE LOG CONTROL FILE
+1 SET AIBGBLD0=""
SET AIBGBLD0=$ORDER(^AIBCVTC("B",AIBGBLP,AIBGBLD0))
IF AIBGBLD0=""
WRITE !,"No control information for system "_AIBGBLP
SET AIBA="A"
GOTO RETURN
+2 SET AIBLMD0=""
SET AIBLMD0=$ORDER(^AIBMLOG("AC",AIBGBLD0,AIBLMD0))
IF AIBLMD0=""
WRITE !,"No merge log key active for "_AIBGBLP
GOTO BUILDM
+3 SET AIBLMK=$PIECE(^AIBMLOG(AIBLMD0,0),U,1)
WRITE !,"Active merge log key is ",AIBLMK
GOTO RETURN
BUILDM ;BUILD KEY FIELDS IN MERGE LOG CONTROL FILE
+1 SET DR=".01///"_AIBGBLP_NOW_";1///"_AIBGBLD0_";2///NOW"
+2 KILL Y
SET DIE="^AIBMLOG("
DO ^DIE
IF $DATA(Y)
WRITE !,"Write to Merge log file unsucessful ",Y
SET AIBA="A"
GOTO RETURN
+3 WRITE !,"New merge log entry made"
GOTO RETURN
SEARCHD ;LOOK FOR MATCHING DATA LOG CONTROL FILE
+1 SET AIBLKY=AIBGBLP_AIBFTL_AIBFRD
WRITE !,"Searching for data log key "_AIBLKY
+2 SET AIBLD0=""
SET AIBLD0=$ORDER(^AIBLOG("B",AIBLKY,AIBLD0))
+3 IF AIBLD0=""
WRITE !,"None found, Will build"
GOTO CKCTRLD
+4 GOTO RETURN
CKCTRLD ;CHECK CONTROL GLOBAL FOR LOCATION DEFINITION
+1 SET AIBFTLD0=""
SET AIBFTLD0=$ORDER(^AUTTLOC("B",AIBFTL,AIBFTLD0))
+2 IF AIBFTLD0=""
WRITE !,"Facility not on file for "_AIBFTL
SET AIBA="A"
GOTO RETURN
BUILD ;BUILD KEY FIELDS IN DATA LOG CONTROL FILE
+1 SET DR=".01///"_AIBLKY_";1///"_AIBGBLD0_";2///"_AIBFTLD0_";3///"_AIBFRD
+2 KILL Y
SET DIE="^AIBLOG("
DO ^DIE
IF $DATA(Y)
WRITE !,"Write to Data log file unsucessful ",Y
SET AIBA="A"
GOTO RETURN
+3 WRITE !,"New merge log entry made"
GOTO RETURN
UPDATEM ;UPDATE MERGE LOG FILE
+1 SET DA=AIBLMD0
SET DR=".01///"_AIBLMK_";4///"_AIBFTR_"6///"_AIBLMD0
+2 KILL Y
SET DIE="^AIBMLOG("
DO ^DIE
IF $DATA(Y)
WRITE !,"Update to Merge log file unsucessful ",Y
SET AIBA="A"
GOTO RETURN
+3 GOTO RETURN
UPDATED ;UPDATE DATA LOG FILE
+1 SET DA=AIBLD0
SET DR=".01///"_AIBLKY_";3///NOW;4///"_AIBFTR_";6///"_"""Y"""
+2 KILL Y
SET DIE="^AIBLOG("
DO ^DIE
IF $DATA(Y)
WRITE !,"Update to Data log file unsucessful ",Y
SET AIBA="A"
GOTO RETURN
+3 GOTO RETURN
RETURN ;RETURN TO CALLING PROGRAM
+1 QUIT