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 the code to count the sum of n natural numbers.
Whats the difference between search & search ALL?
What is the LINKAGE SECTION used in COBOL?
What type of SDLC u followed? Why?
What is the difference between next sentence and continue in cobol programing language?
HOw can I get the negative sign while deduct high value from low value
Describe the cobol database components?
What is the difference between external and global variables in COBOL?
Can we redefine the field of x(200) to less than 200?
example for sub strings ? and refernce modifications whit output pls
i need a small 3d program using inline and outline.
I need to compare 3 variables(dates) and do some processing based on the earliest date. There could be more then 1 date record in any of the 3 fields. What is the best way to code this?
Name some of the examples of COBOl 11?
how do you reference the variable unblock file formats from cobol programs
A table has two indexes defined. Which one will be used by the SEARCH?