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

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

1038


Hi pls anybody tell me about " ANALYSIS DOCUMENT PREPARATION AND ESTIMATION OF TASK " (in real time project)."I want to update a sequential file in my project" for that purpose i need both structures i mean analysis document and estimation of task.

1925


I have File 1 occurs 5 times with Employee-ID,Employee-Name,Employee-Dept (EEE and MECH). I have File 2 occurs 10 times with Employee-ID,Employee-Name,Employee-Dept (EEE,CIVIL,CHEMICAL and MECH). In FIle 1 and FIle 2 , for matching Employee-DEPT (Only MECH) , we need to move entire records from file1 to file 2. We should not use 2D array. Your help is needed here.

1393


how do you define single dimensional array and multidimensional array in your cobol?

904


if we have " ibm mainframe ",in that how to remove first and last leading space eg:"ibm mainframe" like that the answer we need

1115


What is the default value(s) for an initialize and what keyword allows for an override of the default?

999


What are declaratives and what are their uses in cobol?

985


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)?

899


i need a small 3d program using inline and outline.

1964


I have a program with an Array of 5000 occurences which is being passed from 5 sub levels to the front end screen. Thess 5 programs using each 5*2 = 10 different arrays with size as 5000. This is causing the transaction to utilize more storage consupmtion. I am looking to reduce the storage consumption. As part of that initially i thought Dynamic array may solve my problem. After viewing the comments given i see its same as normal array. IS there any other way we can resolve this issue?

1451


how to access the file from prodution from changeman tool and to submit a file to production

7167


which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad

1274


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

1991


how can i see junk values in dclgen or in hostvariable of comp ?

2793


Our issue is there seems to be a disconnect, or no link, between our SELECT statement and our SD. We had SELECT SORT-FILE and SELECT SORT-FILE ASSIGN TO SORTWRK. ASSIGN TO SORTWRK1 SORTWRK2 SORTWRK3 SORTWRK4. with SD SORT_FILE RECORD CONTAINS 7833 CHARACTERS. In either case, at run time, the system ignored our SORTWRK# DD statements and allocated 16 sort works with the SORTWK## naming convention. Any ideas why the system does not recognize the connection? We do not even need the SORTWRK DD statements. Thanks

2661