How to read records in reverse order in flat file?
I know we can do it by reading all records into an array....
Then read records in reverse order by using subscript or index
but can any body give me the exact code.

Answer Posted / muttaiah

Narayan if we use your sort card we will get records in
reverse order but along with sequence numbers in cols 81-
84. You are not trimming the seq numbers

Stp1:
SORT FIELSD=COPY
OUTREC=(1,80,SEQNUM,4,ZD)

stp2:
SORT FIELSD=(81,4,ZD,D)
Outrec=(1,80)

The output file will have the records in reverse order.

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning

686


What type of SDLC u followed? Why?

1523


What is the difference between structured cobol programming and object alternativelyiented cobol programming?

711


How do you code cobol to access a parameter that has been defined in jcl? And do you code the parm parameter on the exec line in jcl?

705


How to remove 2 duplicate records and copy only one using job control language?

755






how do you reference the variable block file formats from cobol programs

689


What is the difference between structured cobol programming and object alternativelyiented cobol?

757


what happens if parmparameter passes zero bytes to the program

1669


How do you define a variable of comp-1 and comp-2?

707


How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?

650


What is difference between static and dynamic call in cobol?

781


Define cobol?

866


Can you please let me know the centre name of INS certification in Kolkata.

1717


What rules are followed by the search verb.

638


1.Is it possible to move the data from 99.99 to 99v99? 2.What is the CICS-vsam Compilation process? 3.In My GDG 5 generation will be there GDG3 got an abend what will happen? 4.In my GDG first generation is +1 And I want to add the new generation what will happen previous generation? 5.How can you give the PIC clause below conditions A). s9 (reddy), B). s9 (5) occurs 5 times? 6.How override the proc from a particular step? and what is symbolic and override Procs?

5379