IBM Z and LinuxONE - Group home

VSAM Batch Logging Process in CICS VR

IBM Z|Anitha Madhavan|Nov 15, 2022

  
What is CICS VR?
  • CICS VSAM Recovery(VR) recovers lost or damaged VSAM datasets. Physical loss or damage of VSAM data may occur due to below reasons:
    1. Any application alters or deletes the data incorrectly
    2. A batch application encounters an abend
    3. A disaster occurs due to which the data at the entire site is destroyed
  • It also recovers logical corruption of VSAM data due to incorrect updates or transactions.
What is the use of Batch logging in CICS VR?
CICS VR VSAM batch logging provides logging of batch changes to VSAM data sets that are not accessed in RLS-mode. i.e., Whenever any updates happen to a VSAM file by any application, those changes will be logged using the batch logging function. This logged information can be used for recovery if the VSAM file gets corrupted.

How Batch logging works:
When a VSAM dataset undergoes updation by a batch job, batch logging takes place, which will call MVS system logger to write the log records into the MVS log stream. The MVS logger is a component of z/OS, which provides a programming interface to access records on a log stream. 

Types of Batch logging:
There are three types of batch logging available:
  1. Forward Recovery Logging (REDO)
  2. Undo Logging (UNDO)
  3. Replication Logging (ALL(REDO & UNDO))
Forward Recovery Logging - writes an after-image log record to a forward recovery log stream for every update made to a VSAM data set by a batch job. Therefore, if a VSAM data set gets corrupted, you can use CICS VR forward recovery processing to recreate the batch updates.
Undo Logging - writes a before-image log record to a log stream for every update made to a VSAM data set by a batch job. If the batch job encounters an abend, CICS VR batch backout processing can use these records to remove the updates made by the failed batch job or batch job step.
Replication Logging - writes before-image and after-image log records to the replication log stream for every update made to a VSAM data set by a batch job. CICS VR batch logger shares forward recovery and replication logs if both forward recovery logging and replication logging are requested.

To Activate Batch logging:
            To enable CICS VR batch logging for a VSAM sphere, the user must update the FRLOG parameter while defining the base cluster.

The FRLOG parameter can contain one of the following values:

FRLOG(NULL)

Indicates the data set is not eligible for VSAM batch logging. Changes made to the data set by batch applications are not logged by batch logging.

FRLOG(NONE)

Indicates the data set is eligible for VSAM batch logging, but batch logging is currently disabled for the VSAM data set. Changes made to the data set by batch applications are not logged by batch logging.

FRLOG(REDO)

Indicates that forward recovery logging is enabled for the VSAM data set. An after-image log record for every update made to the data set by batch jobs are logged by batch logging.

FRLOG(UNDO)

Indicates that undo logging is enabled for the VSAM data set. A before-image log record for every update made to the data set by batch jobs is logged by batch logging.

FRLOG(ALL)

Indicates that forward recovery logging and undo logging is enabled for the VSAM data set. An after-image log record and a before-image log record for every update made to the VSAM data set by batch jobs is logged by batch logging.


The below image represents defining a KSDS VSAM sphere with forward recovery logging FRLOG(REDO) & log stream ID (LSID) parameter.

The below image represents defining a KSDS VSAM sphere with Undo logging FRLOG(UNDO) & log stream ID (LSID) parameter.
 
The below image represents defining an ESDS VSAM sphere with both forward recovery logging & Undo logging with FRLOG(ALL) & log stream ID (LSID) parameters.
 
 
Batch logging Error conditions:
If CICS VR detects a problem with the MVS system logger, CICS VR attempts to trap the error and issues a 3999 condition code. The 3999 condition code indicates that no batch logging occurred for that sphere.
If this message is issued when forward recovery logging is enabled, you might want to consider taking a backup of your spheres because you cannot forward recover updates made after logging fails.

Restrictions:
  • A VSAM data set that is eligible for batch logging (FRLOG NONE, REDO, UNDO, or ALL), cannot be LINEAR, KEYRANGE, or a temporary data set
  • Batch logging cannot be performed when the VSAM data set is empty.
 
 
Author
Anitha Madhavan
Senior Software Engineer I – HCL Software