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

Write a cobol program making use of the redefine clause.

721


i want to learn mainframe..any websites and material to learn from basic..? my mail id : rajeswaribe2010@gmail.com

1757


What is the difference between next sentence and continue in cobol programing language?

699


What the difference is between continue and next sentence?

651


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

1895






How are the next sentence and continue different from each other?

753


1.Is it possible to move the data from 99.99 to 99v99? 2.What is the CICS-vsam Compilation process? 3.In My GDG 5 generation will be there GDG3 got an abend what will happen? 4.In my GDG first generation is +1 And I want to add the new generation what will happen previous generation? 5.How can you give the PIC clause below conditions A). s9 (reddy), B). s9 (5) occurs 5 times? 6.How override the proc from a particular step? and what is symbolic and override Procs?

5355


input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.

1772


What is the difference between PIC 9.99 and PIC9v99?

770


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

659


what happens if parmparameter passes zero bytes to the program

1650


how to access the file from prodution from changeman tool and to submit a file to production

6663


How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?

1917


State the various causes of s0c1, s0c5 and s0c7.

656


Why occurs cannot be used in 01 level in COBOL?

707