How File Read in CICS with UPDATE Option Maintains Integrity

CICS follows data integrity in different ways for different file types.

CICS File UPDATE

CICS File UPDATE

UPDATE guarantees read integrity. The mechanism used to ensure data integrity depends on the type of file resource:

  • For a VSAM file accessed in RLS mode, the record to be updated is locked by the SMSVSAM server.
  • For a VSAM file accessed in non-RLS mode, the record to be updated is locked by CICS and, in addition, the control interval containing the record is held in exclusive control by VSAM.
  • For a VSAM file accessed in non-RLS mode, and log(UNDO), CICS holds a record lock until the task syncpoints.
  • For a BDAM file, the record to be updated is held in exclusive control by BDAM.
  • For a user-maintained data table, the record to be updated is locked by CICS.
  • For a CICS-maintained data table, the record to be updated is locked by CICS and, in addition, the control interval containing the record is held in exclusive control by VSAM. The VSAM control interval lock is required because changes to the data table are reflected in the source data set, which is accessed in non-RLS mode.

JCL: GDG Create, Delete, Alter, GDGs all Examples

GDG Sample JCLs

GDG Sample JCLs

  1. Create a GDG file. This JCL calling IDCAMS will do it. In this example LIMIT(15) is the number of generations you wish to create and keep. Of course, change the GDG file name to your requirements:
    //STEP1 EXEC PGM=IDCAMS
    //SYSPRINT DD SYSOUT=*
    //SYSIN DD *
    DEFINE GDG(NAME(STEWART.APPLY.LOG.GDGROUP1) –
    LIMIT(15) –
    NOEMPTY –
    SCRATCH)
    /*
  2. Create a model or template for the individual generations of data sets. Here the default DCB attributes for the Apply or Capture log were used. Note that the space is rather small (5 tracks) in this example so you might want to increase it.
    //STEP020 EXEC PGM=IEFBR14
    //GDGMODEL DD DSN=STEWART.APPLY.LOG.GDMODEL1,
    // DISP=(NEW,KEEP,DELETE),
    // UNIT=SYSDA,
    // SPACE=(TRK,5),
    // DCB=(LRECL=1024,RECFM=VB,BLKSIZE=6144,DSORG=PS)

  3. As a test you can create your first generation of data sets by running this JCL example. Each time you run this step a new generation of data set will be created in your group.
    //STEP010 EXEC PGM=IEBGENER
    //SYSPRINT DD SYSOUT=*
    //SYSIN DD DUMMY
    //SYSUT1 DD *
    TEST DATA LINE 1
    TEST DATA LINE 2
    /*
    //SYSUT2 DD DSN=STEWART.APPLY.LOG.GDGROUP1(+1),
    // DISP=(NEW,CATLG,DELETE),
    // SPACE=(TRK,5),
    // DCB=STEWART.APPLY.LOG.GDMODEL1

After you have created several generations of log files an ISPF 3.4 display of your GDG would look like this:
STEWART.APPLY.LOG.GDGROUP1
STEWART.APPLY.LOG.GDGROUP1.G0003V00
STEWART.APPLY.LOG.GDGROUP1.G0004V00
STEWART.APPLY.LOG.GDGROUP1.G0005V00
.
.
.
STEWART.APPLY.LOG.GDMODEL1
The ISPF 3.4 screen header will also tell you how many generations of datasets you have. For example:
Data Sets Matching STEWART.APPLY.LOG.GDGROUP1.G* Row 1 of 15
There are 15 generations of the dataset.

  1. Because the Apply or Capture log file is not referenced by a DD statement you must use IEBGENER to copy your app.log or cap.log file to the GDG. Place this step ahead of your Apply or Capture JCL. This step creates a new generation of data in your group. Consider using the LOGREUSE=N parm when you start Capture or Apply so that each generation of the log is unique to the specific instance when Capture or Apply was run.
    //COPYLOG EXEC PGM=IEBGENER
    //SYSPRINT DD SYSOUT=*
    //SYSUT1 DD DSN=STEWART.DSN9.STEVE1.APP.LOG,
    // DISP=SHR
    //SYSUT2 DD DSN=STEWART.APPLY.LOG.GDGROUP1(+1),
    // DISP=(NEW,CATLG,DELETE),
    // SPACE=(TRK,5),
    // DCB=STEWART.APPLY.LOG.GDMODEL1
    //SYSIN DD DUMMY
    //SYSOUT DD SYSOUT=*
    //SYSUDUMP DD SYSOUT=*
  • If you need to delete your GDG, delete the individual data sets (G0003V00, G0004V00, etc.) and then run this IDCAM job to delete the GDG.
    //STEP010 EXEC PGM=IDCAMS
    //SYSPRINT DD SYSOUT=*
    //SYSIN DD *
    DELETE (STEWART.APPLY.LOG.GDGROUP1) GDG FORCE
    /*

  • Finally, this example of a GDG was created with 15 generations of data sets using the LIMIT(15) parameter. If you wish to change the number of generations run this IDCAMS alter example where the number of generation is increased to 50. Use the GDG name in the ALTER statement that you created from Step 1.
    //STEP010 EXEC PGM=IDCAMS
    //SYSPRINT DD SYSOUT=*
    //SYSIN DD *
    ALTER STEWART.APPLY.LOG.GDGROUP1 LIMIT(50)
    /*
    The maximum value for LIMIT is 255.

    Ref:IBM

    How CICS RLS Mode handles during Files Updates

    This is possible by using RLS -Record Level Sharing

    Sysdump Vs Sysudump

                                             SYSDUMP Vs SYSUDUMP

    Record-level sharing (RLS) is a VSAM function, that enables VSAM data to be shared, with full update capability, between many applications running in many CICS regions.

    RLS Mode Other Advantage:

    With RLS, CICS regions that share VSAM data sets can reside in one or more MVS™ images within an MVS parallel sysplex. RLS also provides some benefits when data sets are being shared between CICS regions and batch jobs.

    If you open a file in RLS mode, locking takes place at the record level instead of the Control-Interval level, thus reducing the risk of deadlocks.

    CICS supports record-level sharing (RLS) access to the following types of VSAM data set:

    • Key sequenced data sets (KSDS). Note that if you are using KSDS, you cannot use the relative byte address (RBA) to access files.
    • Entry sequenced data sets (ESDS). Note that although RLS access mode is permitted for entry sequenced data sets (ESDS), it is not recommended, as it can have a negative effect on the performance and availability of the data set when you are adding records. (See Performance aspects of VSAM record-level sharing ).
    • Relative record data sets (RRDS), for both fixed and variable length records.

    How Many JOB Cards Can I have in a JCL

    You can have any number of Job cards in a JCL. The maximum limit is 255. Each job is separately pooled in job spool area, after running a JCL with multiple job cards. A job is a collection of related job steps. A job is identified by a JOB statement.

    How to Create SORT card with IKJEFT01 Utility

    How to Create SORT card with IKJEFT01 Utility

    Differences of INCLUDE and JCLLIB:

    // INCLUDE -include Identifies a member of a partitioned data set
    (PDS) or partitioned data set extended (PDSE) that contains JCL statements to include in the job stream.
    // JCLLIB JCL -library Identifies the libraries that the system will
    search for:  INCLUDE groups,  Procedures named in EXEC statements.

    How many characters you need for delimiter:

    You need only 2 characters for delimiter. Read more about DD * or DD Data HERE.

    COBOL Evaluate Multiple When Conditions

    COBOL Evaluate 'OR' Condition

    COBOL Evaluate ‘OR’ Condition

    Sample Evaluate Code is as follows for ‘or’ condition. This is one of the most frequently used coding across different workshops.

    Evaluate Marital-code
    When ‘M’
    ADD 2 to People-count
    When ‘S’
    When ‘D’
    When ‘W’
    ADD 1 to People-Count
    End-Evaluate;

    The way above code tells, WHEN in sequence you have 3 WHEN. That means, if you get in input either of the values, adding ‘1’ to people count.

    Related:

    2 More things on Advanced COBOL Programming