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 |
what is the difference between Plan & package
If i initialize the 01 level variable in array, will it initialize all the array elements (occurs)?
What are 77 levels used for?
What is the difference between Global and External Variables?
what modification we need to do in jcl if we use sort in cobol? I mean whether we need to include tempary file used for sorting in assign statement?
how many bytes do SPPPP999 will store?
I HAVE FOLLOWING DECLARATION. 02. A PIC X(10) VALUE 'XXXXXXXXXX'. 02. B REDEFINES A. 05. C PIC X(3). 05. D PIC X(3). 05. E PIC 9(3). IN MY PROG, I HAVE MOVE 1 TO E. DISPLAY A. WHAT WILL BE DISPLAYED AS A RESULT OF THIS? PLEASE EXPLAIN THE ANSWER. THANKS.
01rec1. 05 a pic 999v99 value 123.12 05 b pic 99v9 value 45.9 02 rec2. 05 x pic 999v99 05 y pic 99v99 05 z pic x(3) value 'abc' if rec1 is moved to rec2 then what is the value of rec2?
1.Can we define condition-name conditions in FD entry.
Explain about level numbers?
How to find How Many Lines in Sysin DD * Parameter Thru Cobol Coding? If any one knows the Answer Please Reply .....Thanks From Shree
We have 3 programms A,B,C.In the middle of the program A the controls goes to program B and in the middle of the program B control wants to go program C,after completion of program C again control comes to program B and again after completion of program B control comes to program A.How the process will takes and what are the controls we use for that process.If it is possible anybody of you explain with example?