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 will happen if a variable is declared as below.. Explain with an example? Working storage section:- 01 WS-VARX PIC X(10) VALUE 'ABCDEFGHIJ'. 01 WS-VARN REDEFINES WS-VARX PIC 9(5) VALUE '12345'. What will happen I want Display WS-VARX and WS-VARN?
What is the difference between index and subscript?
Can we put move statement in COBOL copybook
What is the size of s9(19)comp3? explain
what r the types of perform statement
Difference between next and continue clause
TYPES OF SORTINGS. which is more prefarable.
What is the difference between static call & Dynamic call?
how can u find out just by seeing wheater it is main program or sub program ? any two ways to identify reply soon ?
Re: 01 NAME1 PIC X(13) VALUE "COBOL PROGRAMMING". 01 NAME2 PIC X(13). now I want to display the value of NAME1 in reverse order i.e value should be displayed as "GNIMMARGORP LOBOC" HOW can I do that ??? please let me know if any one knows it.
what is the result of the following? DIVIDE A INTO B GIVING C. a.C=A/B b.the reminder of B/A is stored in C c.C=B/A d.the reminder of A/B is stored in C
I have a Main Program which is calling Sub-Program which is a DB2 pgm. What will happen if I am not closing the cursor used in the Sub-program? Please advise..