How to retrive the 9th records out of ten records using the
cobol program ?
Answers were Sorted based on User's Feedback
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 |
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 |
How To Separate The Numerics From An Alphanumric Data Item Which Contains Both Alphabates And Numerics ?
what is difference between the sysabend and userabend?
how to change picture class of copy book variable inside program?
What is an explicit scope terminator?
what is call by value and call by reference ?
3 Answers Infosys, ITC Indian Tobacco Company,
How to read the last 100 records from a COBOL file. The file contains N number of records.
Write a program to concert an Indexed file into Sequential file?
If i initialize the 01 level variable in array, will it initialize all the array elements (occurs)?
Read filea And file b write the same records in both files? Records in a but not in b record in b but not in a
File status must be checked both while opening and reading the file or only while reading the file?
if we have a 10 steps how to override the 4th step in jcl?
In a COBOL program, 2 tables TABLE1 and TABLE2 are defined that are indexed by INDEX1 and INDEX2 respectively. Can we use INDEX1 with TABLE2 and INDEX2 with TABLE1?