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
write a cobol logic. i have file that has 10 records .1 record go to first output file and second record goes to 2 output and etc
Explain how to differentiate call by context by comparing it to other calls?
How to remove 2 duplicate records and copy only one using job control language?
if we display var1 then what will b displayed in below condition. 77 var1 pic s9(2) value -10. 77 var1 pic s9(2) value -11. " " " -12. " " " -13. -14 ... ... -19.
Explain how you can characterize tables in cobol?
Why did you choose to work with ibm mainframe cobol programming?
I have program P1 which calls file F1 which has 100 records and following structure 001 .................. 002 .................. 003 .................. 098 .................... 099 ................... 100 .................... Now I want to read these files and write these records in file F2 in following manner. 001 ...... 051 ..... 002 ...... 052 ..... 003 ...... 053 ..... .......... ....... .......... ....... .......... ....... 048 ........ 098 ...... 049 .......... 099 ....... 050 .... 100 ......
What are the rules of the move verb?
How to find out the closest prime number of an input number? I believe it has something to do with SEARCH and COBOL Linear Array.
What are the different rules to perform a Search?
If you are current on the owner of a set, what is the difference between obtain next and obtain first?
How can you get the ksds file records into your cobol program?
What is the difference between binary search and sequential search?
What is the use of intialize verb?
Can you please let me know the centre name of INS certification in Kolkata.