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...
Answers were Sorted based on User's Feedback
Answer / 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 | 2 No |
Answer / santhosh
We can do it through JCL by using sort utility ..Through splitby=3 in outfil statement giving two different outputs..It will store two alternative records into two datasets alternatively
Is This Answer Correct ? | 0 Yes | 0 No |
How do you submit JCL via a Cobol program?
how do you reference the fixed unblock file formats from cobol programs
1.Can we define condition-name conditions in FD entry.
what is the maximum error code in mainframe
What happens when we move a comp-3 field to an edited (say z (9). Zz-)?
what is the difference between Normal vaiable and comp variable.
01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i need to get the miuns sign in the result?
Can JUSTIFIED be used for all the data types?
When the working storage variables get allocated? a.At Compile time b.At starting of the run time c.At end of the run time. d.None of these
Explain what you understand by passing by value.
What is the significance of the PROGRAM-ID paragraph? If this name doesnt match with the name of the COBOL program, does it make a difference? Is the name specified in the PROGRAM-ID paragraph used as a name for the load module or any such thing?
what are the isolation levels and where we use it in the db2 program