I had 100 records and i want to execute last three records by
using cobol programming?what will be coding?

Answers were Sorted based on User's Feedback



I had 100 records and i want to execute last three records by using cobol programming?what will be..

Answer / farid

In jcl we can do as follows.........

1st skip the 97 recordes and write rest 3 into another file
using sort utilities(with the help of jcl).now cobol program
can use the 2nd file which has only last 3 records

Is This Answer Correct ?    6 Yes 0 No

I had 100 records and i want to execute last three records by using cobol programming?what will be..

Answer / atul

Using Short card you can write the last 3 records.
Short card as :

SORT FIELDS=COPY SKIPREC=97 STOPAFT=03


It will copy the last three records and put it in a file.

Cobol program can use this file containing records.

Is This Answer Correct ?    2 Yes 0 No

I had 100 records and i want to execute last three records by using cobol programming?what will be..

Answer / sandip

In cobol apply counter while reading file if counter reach at 97 start writing record to another file.

Is This Answer Correct ?    2 Yes 0 No

I had 100 records and i want to execute last three records by using cobol programming?what will be..

Answer / harsha

Read file sequentially and load it in table. keep check on
the number of ocurances(i.e. number of records).

Once the table is fully loaded, you know the total
occurances. Say it is X. Now read the table with occurance
X-3

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More COBOL Interview Questions

I have a source program compiled with Cobol-2. The output file has a record length of 100 defined in the program but a record of 60 bytes getting written into it. i.e. The rest of 40 bytes I am not Writing anything. But it by default puts some values into the last 40 bytes. However it does not impact anything. But when Compiled the module with Enterprise Cobol the last 40 bytes were spaces as fillers. Can anyone explain?

5 Answers   Cognizant,


What is the LINKAGE SECTION used in COBOL?

0 Answers   UGC Corporation,


There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.

0 Answers  


what is record label is empty or standard in file description of data division?

2 Answers   HCL,


what is sync clause?

2 Answers   DELL,






Suppose i have a variable with s9(18)v99 comp3 . what is the size of variable . If s9(18) comp3 is 10 bytes . There should be some difference between two allocations ? Thanks krishna chaitanya

2 Answers   CSC,


What is an in-line perform ?

4 Answers   Accenture,


What is the difference between a binary search and a sequential search?

10 Answers  


can we redefine 77 level item is it possible

4 Answers   HCL,


example for sub strings ? and refernce modifications whit output pls

0 Answers   College School Exams Tests, IBM,


how to display comp3 variables reply soon ?

4 Answers   Patni,


System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..

0 Answers   Amdocs,


Categories