have in 100 records in a file i want to read first 3 records
and skip next 3 records and agan i want to read 3 records and
again i want to skip 3 records...
Answer Posted / kairoon
In working storage declare
01 ws-count1 pic s9(4) comp value zeroes.
01 ws-count2 pic s9(4) comp value zeroes.
In procedure division
PERFORM 200000-PROCESS THRU 200000-EXIT
UNTIL WS-EOF-IN = 'Y'.
200000-PROCESS.
READ IN-FILE AT END MOVE 'Y' TO WS-EOF-IN
GO TO 200000-EXIT.
ADD 1 TO WS-COUNT1
IF WS-COUNT1 <= 3
MOVE IN-REC TO OUT-REC
WRITE OUT-REC
ELSE
ADD 1 TO WS-COUNT2
IF WS-COUNT2 = 3
MOVE ZEROES TO WS-COUNT1
WS-COUNT2
END-IF
END-IF.
200000-EXIT.
EXIT.
| Is This Answer Correct ? | 26 Yes | 3 No |
Post New Answer View All Answers
How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?
How do define dynamic array in cobol.
Write a program to explain size error.
Name some of the examples of COBOl 11?
Why is it necessary that file needs to be opened in I-O mode for REWRITE?
What is difference between static and dynamic call in cobol?
What is the difference between comp and comp-3?
How to get the last record in vsam file in cluster? And how can you get the ksds file records into cobol program?
What are the different data types in cobol?
A table has two indexes defined. Which one will be used by the SEARCH?
what is the use of outrecord?
How you can read the file from bottom?
How are the next sentence and continue different from each other?
What are the different types of condition in cobol and write their forms.
What is the utilization of copybook in cobol? Could we utilize a similar copybook?