Skip and continuew reading in COBOL.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Previous topicNext topic

Topic Author
Technocrat
Registered Member
Posts: 29
Joined: Thu Oct 03, 2013 1:32 pm

Skip and continuew reading in COBOL.

Post by Technocrat » Sat Feb 11, 2017 8:59 am

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: 1352
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Skip and continuew reading in COBOL.

Post by Robert Sample » Sat Feb 11, 2017 9:22 am

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.




Topic Author
Technocrat
Registered Member
Posts: 29
Joined: Thu Oct 03, 2013 1:32 pm

Re: Skip and continuew reading in COBOL.

Post by Technocrat » Wed Feb 15, 2017 2:00 pm

hmm...ok, yes, that could be done. Thanks.


Regards

User avatar

Anuj Dhawan
Founder
Posts: 2615
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Zodiac: Sagittarius

Re: Skip and continuew reading in COBOL.

Post by Anuj Dhawan » Thu Feb 16, 2017 11:42 am

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.

Previous topicNext topic

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