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
write a cobol logic. i have file that has 10 records .1 record go to first output file and second record goes to 2 output and etc
What are the different rules for performing sort operation?
Difference between array and sub-script ?
What is a report item?
Why is it necessary that file needs to be opened in I-O mode for REWRITE?
Differentiate cobol and cobol-ii. (Most of our programs are written in cobolii, so, it is good to know, how, this is different from cobol)?
When is inspect verb is used in cobol?
what is the use of outrecord?
) how do u code after getting data?
In COBOL, what is the different between index and subscript?
System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..
What is the compute verb? How is it used?
Name some of the examples of COBOl 11?
What happens when we move a comp-3 field to an edited (say z (9). Zz-)?
example for sub strings ? and refernce modifications whit output pls