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

What is the difference between a subscript and an index in a table definition?

3 Answers   TCS,


Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.

0 Answers   iNautix,


how to refer the data field?

0 Answers  


How to execute a set of JCL statements from a COBOL program?

2 Answers   Patni, Syntel,


What is the Importance of GLOBAL clause According to new standards of COBOL?

2 Answers   Infosys,






in cobol i have one file it contains records like 10,4,23,98,7,90..... total records 100. iwant 10 to 20 in reverse order in cobol environ ment any one please give the answer......

2 Answers   IBM,


What happens in the background of spool when we submit a job for compilation and execution... This is a recent question in ibm...Kindly help me.....

3 Answers   IBM,


How do you reference the following file formats from cobol programs?

0 Answers  


What happens when we move a comp-3 field to an edited (say z (9). Zz-)?

0 Answers  


Can anybody give me example of subscript and index

5 Answers  


The disposition parameter in the jcl is share ( DISP+SHR ) and the program opens file in extend mode what will happen?

6 Answers   Cognizant,


Can you call an OS VS COBOL pgm from a VS COBOL II pgm ?

3 Answers   Microsoft,


Categories