Sequential file processing.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
pinball
Registered Member
Posts: 26
Joined: Sun Jul 07, 2013 1:28 am

Sequential file processing.

Post by pinball »

Hi,

I'm accessing a SEQUENTIAL file. I reached some 'x' record and now I wish to go to the top of file (1st record) without closing & opening the file. Is that possible?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Sequential fiel processing.

Post by Robert Sample »

No, it is not possible. A sequential file means sequential -- as in, read the first record then read the second record then read the third record then .... If you want to do anything else, you either don't use a sequential file or you close and re-open the sequential file and re-read every record starting with the first one.
Priya
Registered Member
Posts: 50
Joined: Tue Jul 02, 2013 11:43 pm

Re: Sequential fiel processing.

Post by Priya »

So in case, someone needs a kind of processing, which needs to go to the start of the file -- sequential files are not a good choice but then other than VSAM -- what do we have?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Sequential fiel processing.

Post by Robert Sample »

VSAM KSDS would be the first choice; the second choice would be a data base. IBM used to have ISAM files, which were non-VSAM indexed files, but ISAM is not available any more. If you have a good hash key, using a BDAM or VSAM RRDS would also work; "good hash key" means that one (or more) fields of each record can fairly easily be turned into a sequential number. In such a case reading from the start of the file would merely mean grabbing the record at offset 0 (record 1) via direct read.
Priya
Registered Member
Posts: 50
Joined: Tue Jul 02, 2013 11:43 pm

Re: Sequential file processing.

Post by Priya »

Thanks Robert.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”