Skip and continuew reading in COBOL.

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

Topic author
Technocrat
Registered Member
Posts: 18
Joined: Thu Oct 03, 2013 1:32 pm

Skip and continuew reading in COBOL.

Postby 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

Online
User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1275
Joined: Fri Jun 28, 2013 1:22 am
Location: East Dubuque Illinois
Has thanked: 2 times
Been thanked: 90 times

Re: Skip and continuew reading in COBOL.

Postby 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: 18
Joined: Thu Oct 03, 2013 1:32 pm

Re: Skip and continuew reading in COBOL.

Postby Technocrat » Wed Feb 15, 2017 2:00 pm

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


Regards

User avatar

Anuj Dhawan
Founder
Posts: 2392
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Has thanked: 152 times
Been thanked: 66 times

Re: Skip and continuew reading in COBOL.

Postby 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


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

Who is online

Users browsing this forum: CommonCrawl [Bot] and 2 guests