Reading a Vsam or flat file from a specific record number



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Reading a Vsam or flat file from a specific record number

Postby Nazma » Thu Jul 02, 2009 9:44 pm

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.
Nazma
 
Posts: 7
Joined: Fri Jun 13, 2008 4:25 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby dick scherrer » Thu Jul 02, 2009 11:34 pm

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

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

Postby Anuj Dhawan » Mon Jul 06, 2009 1:09 pm

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.
Anuj
Anuj Dhawan
 
Posts: 273
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times

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

Postby nayanpatra » Mon Jul 06, 2009 4:58 pm

You can write the output in another sequential file and then append it to the previous one.
nayanpatra
 
Posts: 19
Joined: Mon Jul 06, 2009 4:35 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby dick scherrer » Tue Jul 07, 2009 12:04 am

Hello,

This approach might work for someone's own testing, but would not be a good solution for regular production.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post