sample code for read a 2nd record from last in flatfile how
can do?

Answer Posted / nsingh

ADD SEQUENCE NUMBER

SORT FIELDS=COPY
OUTREC FIELDS = (1,80,SEQNUM,ZD,A)

NOW SORT SEQ NUM IN DESCENDING ORDER
SORT FIELDS=(81,4,ZD,D)

INCLUDE ONLY 2ND LAST REC
SORT FILEDS = COPY
INCLUDE COND = (81,4,ZD,EQ,0002')

REMOVE SEQ NUM FROM FILE & THIS REC IS SELECTED
SORT FIELDS =COPY
OUTREC FIELDS = (1,80)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why did you choose to work with ibm mainframe cobol programming?

631


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

709


) How do u handle errors in BMS macro?

1427


How do you code cobol to access a parameter that has been defined in jcl? And do you code the parm parameter on the exec line in jcl?

700


How do you reference the following file formats from cobol programs?

694






Differentiate between structured cobol programming and object-oriented cobol programming.

667


What is the difference between external and global variables in COBOL?

813


For rewrite, why is it mandatory that file needs to be opened?

623


how do you reference the rrds file formats from cobol programs

798


Write the code implementing the perform … varying.

646


How many sections are there in data division in COBOL?

678


What is the problem of ordered sequential files access?

702


A table has two indexes defined. Which one will be used by the SEARCH?

758


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

755


What the difference is between continue and next sentence?

659