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 / narayan
You Can do it through JCL sort. Just add a seq number at the
last position of each record and sort it in descending order
of that seq number.
Here is the exacet code.
SORT FIELSD=COPY
OUTREC=(1,80,SEQNUM,4,ZD)
If your ps file is 80 byte long then this sort card a 4
digit seq num at 81 postion.
Now Sort the file on this seq num in descending
SORT FIELSD=(81,4,ZD,D)
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Difference between array and sub-script ?
Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.
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
How to use the same COBOL program in Batch and CICS on lines? explain with an example
A table has two indexes defined. Which one will be used by the SEARCH?
Can you please let me know the centre name of INS certification in Kolkata.
how do you reference the printer file formats from cobol programs
What guidelines should be followed to write a structured cobol prgm?
Describe the cobol database components?
if we display var1 then what will b displayed in below condition. 77 var1 pic s9(2) value -10. 77 var1 pic s9(2) value -11. " " " -12. " " " -13. -14 ... ... -19.
What is difference between static and dynamic call in cobol?
Name some of the examples of COBOl 11?
What is the default value(s) for an initialize? What keyword will allow for an override of the default?
Difference between cobol and cobol-ii?
can you please let me know if there is any walkins for COBOL/PLI/DB2/IMS/JCL in pune other than IBM and ITC infotech