Job calling cobol running for long time

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
Posts: 3
Joined: Mon Feb 15, 2016 9:40 am

Job calling cobol running for long time

Post by nitika » Wed May 04, 2016 10:51 am

Basically my program logic revolves around 4 KSAM files(Index files) out of which 1 file will act as input and getting write/rewrite based on keys matched/unmatched

from other 3 files, will try to explain more below -

Its reading one file and getting the key which will get match with keys of other three, as i said if it matches with that one particular record will be rewritten in

that file and if not while matching with other file it will a new record write in that file.

Like wise it will happen for other 2 files as well and match with that one file to deicde if its write/rewrite of a record.

Initially, I have coded all the three READ scenario and matching logic in one cobol which never ended when i ran job because everytime while going to next read

scenario I have close the file and open it again as EOF file is set at above read, so I tried splitting cobol in to three separate read.

Anyone have suggestion on it, please share.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Thu May 05, 2016 3:27 pm

Is the program eventually to run on a Mainframe? KSAM is not a Mainframe dataset-type.

Doing lots of keyed reads will take lots of time. You should test your program with very small files, so that you know the program logic works, before using bigger files.

You should be doing keyed reads, not serially searching files (so EOF not found, no need to CLOSE and re-OPEN).
Last edited by William Collins on Tue May 10, 2016 10:51 am, edited 1 time in total.

User avatar
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Mon May 09, 2016 6:01 pm

if on mainframe aned the keyed files are vsam, why not unload each to a qsam file,
in order of the primary key of the primary file,
and process this stuff as qsam, output qsam and use SORT to reload the qasm to vsam.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Post Reply


Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Mainframe Interview questions

Other References
Mainframe Tools and others