Page 1 of 1

Adding sequence numbers using input procedure in cobol

PostPosted: Tue Oct 15, 2013 10:15 pm
by Deepak kumar25
Dear experts
I am having a file which have 10 records. I want to add sequence numbers in input records by using input procedure.
How can i achieve this. Please help.

Re: Adding sequence numbers using input procedure in cobol

PostPosted: Tue Oct 15, 2013 10:33 pm
by Robert Sample
Are you using the COBOL SORT verb? If not, what does "input procedure" mean to you?

If you are using SORT with an INPUT PROCEDURE, why not just add another variable under the SD 01 level that has a sequence number of the appropriate size [that is, PIC 9(?)], define a WORKING-STORAGE counter to increment, and move the counter to the SD variable in the INPUT PROCEDURE?

Re: Adding sequence numbers using input procedure in cobol

PostPosted: Wed Oct 16, 2013 4:45 pm
by Deepak kumar25
thanks
bt my requirement is that i want to reverse a file records. And want to add sequence number so that i can sort it in descending order using sequence number.

I will use wht u said make a working storage variable and increment the counter until as end of file is not come....



Deepak kumar

Re: Adding sequence numbers using input procedure in cobol

PostPosted: Wed Oct 16, 2013 7:41 pm
by dick scherrer
Hello,

So, you can create the sequence number in the INPUT procedure and specify to sort descending on the SORT statement.

Re: Adding sequence numbers using input procedure in cobol

PostPosted: Thu Oct 17, 2013 12:24 pm
by Deepak kumar25
@disk scherrer
Yes exactly...