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

What is an in line perform? When would you use it? Anything else you wish to say about it.

856


I need to compare 3 variables(dates) and do some processing based on the earliest date. There could be more then 1 date record in any of the 3 fields. What is the best way to code this?

2032


What guidelines should be followed to write a structured cobol prgm?

887


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

855


What is the difference between goback, stop run and exit program in cobol?

1252


What is the Purpose of POINTER Phrase in STRING command in COBOL?

988


How do you define a variable of comp-1 and comp-2?

934


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

884


What is the utilization of copybook in cobol? Could we utilize a similar copybook?

967


What is the difference between a binary search and a sequential search what are the pertinent cobol?

945


Write a program to explain size error.

908


How do get the result of your program directly on your pc?

2088


Why would you use find and get rather than to obtain?

922


please..could u give an example about USAGE IS POINTER ..and explain why and when we use it ?

2208


what are decleratives in cobol?

2020