How to read the last 100 records from a COBOL file. The file
contains N number of records.

Answer Posted / heeraj r

Pls post the correct question. I am not sure what you mean
by COBOL file, is it PS or VSAM or Tape etc etc? If you
want last 100 records of a file use below SORT JCL, and if
required that output file can be read in your COBOL.

//S1 EXEC
PGM=ICETOOL
//TOOLMSG DD
SYSOUT=*
//DFSMSG DD
SYSOUT=*
//IN DD DSN=... input
file
//OUT DD DSN=... output file
//TOOLIN DD
*
SUBSET FROM(IN) TO(OUT) KEEP INPUT LAST(100)
/*

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In COBOL, what is the different between index and subscript?

759


What is rmode(any) ?

686


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

631


What rules are to be followed while using the corresponding options?

641


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

710






What is length is cobol?

650


how do you reference the rrds file formats from cobol programs

800


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

6686


How to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that

2732


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

648


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

697


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

1790


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

676


What is comp-1 and comp-2?

764


What are the different rules for performing sort operation?

763