In order to implement automatic database saving and recovery operations, the BMEND utility routine stores information in a job variable. This job variable can be used by other programs or procedures for control purposes.
The job variable is supplied with information if a job variable has been created with LINK-NAME=JVBMEND.
BMEND does not use the contents of the job variable as input, but simply updates it with relevant values at the end of certain functions.
The process of supplying this job variable with information is internally organized in two parts:
initialization with SHOW-LOG-INFORMATION
updating with UPDATE-DATABASE
The initialization of the job variable (SHOW-LOG-INFORMATION statement) provides an initial decision support system for the initiation of recovery procedures.
As the user, you must then decide whether the information returned is sufficient. If necessary, you may have to repeat the initialization by modifying the SHOW-LOG-INFORMATION statement with the LOG-FILE operand.
The job variable contains the following information areas:
status of the processed DBDIR
status of a log pool segment (common log data)
status of a log pool segment (AFIM log data)
sequence numbers to apply further updates
Statement sequence
/CREATE-JV JV-NAME=JOBVAR,PROTECTION=*STD
/SET-JV-LINK LINK-NAME=JVBMEND,JV-NAME=JOBVAR
/ADD-FILE-LINK LINK-NAME=DATABASE,FILE-NAME=SHIPPING.DBDIR
/SELECT-PRODUCT-VERSION
PRODUCT-NAME=UDS-SQL,VERSION=version,SCOPE=*TASK
/START-UDS-BMEND
//SHOW-LOG-INFORMATION LOGFILE=*STD,OUTPUT=*SYSOUT
//END
.
.
Structure of the job variable
DISPL
| ||
( 0) DBDIR_DATA | Describes the status of the accessed DBDIR; deleted by UPDATE | |
( 0) ALOG_SEQ_NR | ALOG_SEQ_NR from the DBDIR | |
( 4) CONSISTENCY_DATA | BACK_UP_DATA from the DBDIR; time at which the database was last updated | |
( 18) CONSISTENT | CONSISTENCY / C‘Y‘ or C‘N‘ C‘N‘: if SYSTEM_BREAK in AK0 or AKn is set or if AK0 is not equal to AKn | |
( 19) FILLER | | |
( 20) COMMON_LOG_DATA | Indicates the limits of the examined ALOG file sequence; the oldest and most recent entry in the history is deleted by UPDATE | |
( 20) HIGHEST_ALOG_SEQ_NR | Highest sequence number for which the history is stored in the ALOG file | |
( 24) LOWEST_ALOG_SEQ_NR | Lowest sequence number for which the history is stored in the ALOG file | |
( 28) LOG_POOL_PART_END_DATA | YYYYMMDDHHMMSS; LOG_INTERVAL_END of the ALOG file assigned in the LOG-FILE operand | |
( 42) LOG_POOL_PART_BEGIN_DATA | YYYYMMDDHHMMSS | |
( 56) AFIM_LOG_DATA
| Details on most recent log interval with contiguous AFIM logging from the history; equal to 0 if examined area has no AFIMs; is deleted by UPDATE | |
|
( 56) UPPER_ALOG_SEQ_NR | Highest sequence number of examined log pool segment with AFIMs |
|
( 60) LOWER_ALOG_SEQ_NR | Lowest sequence number of examined log pool segment with AFIMs |
|
( 64) UPPER_ALOG_DATA | LOG_INTERVAL_END of ALOG file |
|
( 78) LOWER_ALOG_DATA | LOG_INTERVAL_BEGIN of ALOG file |
( 92) BACKOUT_LOG_DATA | Indicates the limits of the most recent BACKOUT area without gaps | |
|
( 92) UPPER_ALOG_SEQ_NR
| Reserved for future extensions |
|
( 96) LOWER_ALOG_SEQ_NR
| Reserved for future extensions |
|
(100) UPPER_ALOG_DATA
| Reserved for future extensions |
|
(114) LOWER_ALOG_DATA
| Reserved for future extensions |
(128) NEXT_SEQ_NR | Contains the sequence number of the next ALOG file to be applied | |
|
(128) UPDATE_START_SEQ_NR
| Lowest ALOG number of all examined realms initialized by SHOW-LOG; is incremented by 1 after reading in all AFIMs of an ALOG file; equal to 0 if the DEADLINE is reached |
|
(132) RESET_START_SEQ_NR
| |
(136) CHAR_TYPE_LOG_DATA | Details in character representation | |
(136) DBNAME
| Name of processed database | |
(153) COPYNAME
| CHAR (8); COPYNAME of processed shadow database | |
(161) ALOG_SEQ_CHAR
| CHAR (9); ALOG_SEQ_NR from DBDIR | |
(170) UPDATE_START_SEQ_CHAR
| CHAR (9); UPDATE_START_SEQ_NR | |
(179) END
| |
Results of initialization
Information from the ALOG BOTTOM PAGE of the assigned ALOG file and from the DBDIR are used for initialization.
The difference between the lowest and highest sequence number of the ALOG files sequence can also be less than 63. This situation is possible with a smaller number of ALOG files or after an inconsistent switch in the ALOG file (old ALOG file no longer accessible).
If an original database is involved, initialization of the job variable returns the following information:
consistency of the original DBDIR
time at which the DBDIR was last updated
highest sequence number of the ALOG file sequence
the most recent interval with AFIM logging is output (limit values as sequence numbers and with time stamps)
The time of a maximum DEADLINE will have also been stored (LOG END of the most recent AFIM logging interval).
The returned value can be used to read in a suitable recovery log for the UPDATE function.
Since only the last 63 log files are examined, it is not always clear whether the logging period with no gap extends further in the past.
If the ALOG file sequence needs to be examined by going back further in the past, the job variable will need to be reinitialized. When this is done, it is generally advisable to begin with the lowest alog-seq-no of the examined sequence in order to obtain overlapped segments.
If a shadow database was assigned, it is not possible to obtain any information from the DBDIR with regard to which ALOG file sequence numbers were used when the database was last processed. The highest sequence numbers of the used ALOG files can only be determined if the original is assigned. In the case of shadow databases, only the sequence number at the time of saving the DBDIR can be output.
Job variable fields are supplied with information in the same way for a shadow database as when an original is assigned.
Updating with UPDATE-DATABASE
The UPDATE-DATABASE statement results in the deletion of all values of job variables that affect the DBDIR or backout logging.
When an ALOG file has been read in (i.e. applied), the sequence number of the next ALOG file to be applied is entered. When the DEADLINE is reached, a binary zero is entered.
Statement sequence
/CREATE-JV JV-NAME=JOBVAR,PROTECTION=*STD
/SET-JV-LINK LINK-NAME=JVBMEND,JV-NAME=JOBVAR
/ADD-FILE-LINK LINK-NAME=DATABASE,FILE-NAME=SHIPPING.DBDIR
/SELECT-PRODUCT-VERSION
PRODUCT-NAME=UDS-SQL,VERSION=version,SCOPE=*TASK
/START-UDS-BMEND
//UPDATE-DATABASE REALM-NAME=*ALL,DEADLINE=STD,DELETE=NO
//END
.
.