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

Answer Posted / abhijit

Suppose file has 100 Record

1,2,3.........................100

a) Read the file and Count the number of records into a variable
Suppose CNT_VAR = 100

b) Suppose you want to read 2nd record from Last

So Set N = 2

c) Now to find the search variable compute the below

SRC_VAR = CNT_VAR - N i.e (100 - 2)

SRC_VAR = 98

d) Now Read the file to pick 98th record from top

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between static and dynamic call in cobol?

777


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

927


Is it possible that the redefines clause has different picture clauses compared to the one it redefined?

676


What are the rules of the move verb?

706


If you are current on the owner of a set, what is the difference between an obtain next and obtain first? Actually in which topic will we use dis???Plz explain it clearly

2658






how do you reference the fixed unblock file formats from cobol programs

712


What are the cobol coding sheets?

664


Name the divisions, which are available in a cobol program?

685


Write a cobol program making use of the redefine clause.

731


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

1958


i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?

897


How to traceback if I am getting SOC7 or SOC4 abend? List down the steps

892


how to move the records from file to array table. give with code example

2219


How do you reference the fixed block file formats from cobol programs

705


how we sort two input files based on a common column and giving one o/p file please send me the coding logic?

1652