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
Can we redefine the field of x(200) to less than 200?
What kind of error is trapped by on size error option?
What is the difference between perform … with test after and perform … with test before?
How do you reference the fixed block file formats from cobol programs
Whats the difference between search & search ALL?
I have program P1 which calls file F1 which has 100 records and following structure 001 .................. 002 .................. 003 .................. 098 .................... 099 ................... 100 .................... Now I want to read these files and write these records in file F2 in following manner. 001 ...... 051 ..... 002 ...... 052 ..... 003 ...... 053 ..... .......... ....... .......... ....... .......... ....... 048 ........ 098 ...... 049 .......... 099 ....... 050 .... 100 ......
What is the difference between next sentence and continue in cobol programing language?
) how do u code after getting data?
How do you get the data to code the BMS macro?
What is the difference between binary search and sequential search?
What is amode(31)
Why would you use find and get rather than to obtain?
What is the default value(s) for an initialize and what keyword allows for an override of the default?
Write some characteristics of cobol as means of business language.
here is my requirement A1 is alphanumeric with value 'A1B2C3D4' as defined below 05 A1 PIC X(8) VALUE IS 'A1B2C3D4' but i need to have A2,A3 as ABCD & 1234 repectively...... A2 = ABCD A3 = 1234 Can you please explain me what are the different ways to do it?