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
how do you reference the variable block file formats from cobol programs
Explain the configuration section of a cobol program with examples of syntax.
How you can read the file from bottom?
What is the usage of comp fields in cobol?
What is a report item?
Have you used comp and comp-3 in your project? And how?
Can we redefine the field of x(200) to less than 200?
What are INPUT PROCEDURE and OUTPUT PROCEDURE?
Define static linking and dynamic linking.
Explain what you understand by passing by value.
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)?
A table has two indexes defined. Which one will be used by the SEARCH?
What is the difference between Global and External Variables?
how to move the records from file to array table. give with code example
how to convert the recors form vsam file to db2 table tru file aid