How to retrive the 9th records out of ten records using the
cobol program ?

Answers were Sorted based on User's Feedback



How to retrive the 9th records out of ten records using the cobol program ?..

Answer / kk

Hi,

just use count variable in working storage.then when read
the file add 1 to count.after that u give if statement if
count = 9 display rec.

Is This Answer Correct ?    20 Yes 0 No

How to retrive the 9th records out of ten records using the cobol program ?..

Answer / ramesh

IDENTIFICATION DIVISION.
PROGRAM-ID. RAMESH.
ENVIRONMANT DIVISION.
DATA DIVISION.
FILE-SECTION.
FD INFILE.
01 IN-REC
05 NAME
05 AGE
WORKING-STORAGE SECTION.
01 WS-COUNT PIC 99.
PROCEDURE DIVISION.
ACC-PARA.
accept ws-num
move 0 to ws-count
ADD-PARA.
read infile
add 1 to ws-count.
perform add-para until ws-count = ws-num

display in-rec.

Note: as per ur requirementprovide ws-num=9
COMPILE IT .PASS WS-NUM THRU RUN JCL SYSIN AS 9 .You will
get the 9th record.

Is This Answer Correct ?    10 Yes 0 No

How to retrive the 9th records out of ten records using the cobol program ?..

Answer / shan

If you are sure that ur file will always have 10 records,
then move high-values to record format and read prior twice.

Is This Answer Correct ?    6 Yes 6 No

Post New Answer

More COBOL Interview Questions

I want to remove a duplicates form a given input field using cobol program. please Any one help me out to solve this ... Thanks in Advance.

3 Answers   IBM,


I have a file it contain 10 records.i got abend at 8th record because of soc7.how do you know that perticular record got abend?

3 Answers   IBM,


plz,could any one tell me? what about EBCDIC in cobol?briefly?

1 Answers  


what is level 66 means??

7 Answers  


What is Comm?

2 Answers   IBM, Kemper Corporation,






How is sign stored in Packed Decimal fields and Zoned Decimal fields?

6 Answers   ABC, HCL, TCS,


i have the job which has written updated 100 records into the table and for 101th record it got abended and i want to start the job again and should wirte from 101th record not from 1st record..how to do it..?

6 Answers  


What is Static and Dynamic linking ?

3 Answers  


how do you reference the variable block file formats from cobol programs

0 Answers  


how many bytes does s9(15) occupy in comp1 comp2 and comp3 ?

4 Answers   TCS,


What are different file OPEN modes available in COBOL?

4 Answers   Sun Life,


hi, can you ppl tell me, how to check whether the rewrite we gave for the ksds file is successful or not in the program.? i gave rewrite, the rewrite code is executing and maxcc=0 but updation doenot happen in the file?

1 Answers   CGI,


Categories