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 |
db2 variable decimal(15,2) what is the equalent size of cobol variable
what if any ,is the syntex error in the following piece of code 01 B PIC A(7) 02 C PIC 9(4) ........ IF(B NUMERIC) ADD 10 TO C a.the condition in the if statement is wrong b.noting is wrong c.because C is initialised.ADD 10 TO C is wrong d.both B and C shoud have same size.
What is R-mode and A-mode?
what is lrec=f,what is difference between f,fb,v,vb?what is default value?how do we came to know that records are in f,fb,v,vb?
COBOL Snippet: Tell where the control will when the below code execute IF (A=B) CONTINUE ELSE NEXT SENTENCE PERFORM <IMP-STMT> END-IF.
I hav vari declaration like..... 77 a pic s9(9).99. 77 b pic s9(9).99 comp. 77 c pic s9(9).99 comp-3. if i use MOVE 123456789.99 to a,b,c what happen every one working fine ?
Can 88 level variable be declared in FD section..?
When would you use in-line perform?
How to read a 100 record from a file through cobol?
What is COMP-1? COMP-2?
What are the different data types available in COBOL?
How can you add a particular field/coloumn in copybook?