Page 1 of 1

Skip and continuew reading in COBOL.

Posted: Sat Feb 11, 2017 8:59 am
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.

Re: Skip and continuew reading in COBOL.

Posted: Sat Feb 11, 2017 9:22 am
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.

Re: Skip and continuew reading in COBOL.

Posted: Wed Feb 15, 2017 2:00 pm
by Technocrat
hmm...ok, yes, that could be done. Thanks.

Re: Skip and continuew reading in COBOL.

Posted: Thu Feb 16, 2017 11:42 am
by Anuj Dhawan
I think no language can do skipping of records - it's "logic" which "mimics" it, no?