Skip and continuew reading in COBOL.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Technocrat
Registered Member
Posts: 31
Joined: Thu Oct 03, 2013 1:32 pm

Skip and continuew reading in COBOL.

Post by Technocrat »

Is there a way to skip records in COBOL?

I need to read an input file and validate it. While validating input records, I need to see if there are any invalid records, if yes, I have to skip processing for that records and process next records. If I continue to read the next record will it break the loop or keep on processing next records? Please suugest.
Regards
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Skip and continuew reading in COBOL.

Post by Robert Sample »

No there is no way to skip reading records with COBOL sequential files. If you are reading a sequential file, you read record 1, then record 2, then record 3, then .... until the end of file. HOWEVER, there is nothing in COBOL to prevent you from reading a record and then immediately reading the next record without doing anything to the former record.
Technocrat
Registered Member
Posts: 31
Joined: Thu Oct 03, 2013 1:32 pm

Re: Skip and continuew reading in COBOL.

Post by Technocrat »

hmm...ok, yes, that could be done. Thanks.
Regards
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Skip and continuew reading in COBOL.

Post by Anuj Dhawan »

I think no language can do skipping of records - it's "logic" which "mimics" it, no?
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
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.”