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

Differentiate cobol and cobol-ii. (Most of our programs are written in cobolii, so, it is good to know, how, this is different from cobol)?

619


What is the difference between binary search and sequential search?

634


Why would you use find and get rather than to obtain?

674


Which Search verb is equivalent to PERFORM…VARYING?

677


What is link edit in cobol?

731






Write a program that uses move corresponding.

665


Explain about different table spaces.

642


Discuss about changing dataset name in proc.

757


What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?

664


input 1 input2 ouput1 output2 output 3 1 re 300 1 re 200 1 re 300 3 rc 500 1 re 200 2 rr 400 1 re 300 2 rr 400 1 rc 400 3 rc 500 1 rc 400 2 rr 700 2 rr 700 5 tt 900 5 tt 900 2 inputs r in flat file and output 1 is matched records,ouptput2 is unmatched of input1,output3 is unmatched of input2! how vl u get the output files using sequential order and to check with each and every records! let me know the procedure division ?

1862


What is the Purpose of Pointer in the string?

635


HOw can I get the negative sign while deduct high value from low value

1779


i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?

883


2 input fles: 2 flat files, with different number of records. both are having unique key for each record and already sorted in ascending order . match these files using unique key and in output only matching key value has to be written. please procide cobol logic

2088


What is rmode(any) ?

676