Page 1 of 1

Reading a Vsam or flat file from a specific record number

PostPosted: Thu Jul 02, 2009 9:44 pm
by Nazma
Hi,

Can anyone suggest me how to read and display the records from a VSAM or Flat file from a specific record.

For example, if we are reading VSAM file and writing the data into a flat output file, it has written 50 records once.
If we want to append the remaining data from 50 onwards, how we need to read the file.

Re: Reading a Vsam or flat file from a specific record number

PostPosted: Thu Jul 02, 2009 11:34 pm
by dick scherrer
Hello,

COBOL does not support reading from some specific record number.

Is this some kind of restart (like after an abend)?

What you will need to do is provide restart info to the program and code has to be incorporated to accomodate getting back to the proper syncronization.

Most organizations have a standard concerning how restarts are to be handled. Eash person should not invent their own. As the systems and dasd have gotten so much faster in recent years, many places do not attempt to restart any more. They simnply re-run from the beginning and save a lot of effort and problems.

Re: Reading a Vsam or flat file from a specific record number

PostPosted: Mon Jul 06, 2009 1:09 pm
by Anuj Dhawan
if we are reading VSAM file and writing the data into a flat output file, it has written 50 records once.
If this is a usual process, I mean you always wan to Append the records at "end of file"... opeing file in I-O mode can be your choice but this is true only when you are not dealing with a situation as Dick has mentioned.

Re: Reading a Vsam or flat file from a specific record number

PostPosted: Mon Jul 06, 2009 4:58 pm
by nayanpatra
You can write the output in another sequential file and then append it to the previous one.

Re: Reading a Vsam or flat file from a specific record number

PostPosted: Tue Jul 07, 2009 12:04 am
by dick scherrer
Hello,

This approach might work for someone's own testing, but would not be a good solution for regular production.