have in 100 records in a flat file i want to move records
like 1,3,5,7,9,11,.. to Output file1 and
2,4,6,8,10,12,14 .. records moved to Output file2..Pls
Provide real time answer..
Answer Posted / xxx
Since I assume this is a COBOL question (and not JCL), I have tried below code.
-------------------------------------------------------
OPEN INPUT DASA
OPEN OUTPUT DASB DASC
INITIALIZE WS-NUM.
MOVE 'N' TO WS-EOF-SW.
READ DASA INTO WS-NUM
AT END MOVE 'Y' TO WS-EOF-SW
END-READ
PERFORM UNTIL WS-EOF-SW = 'Y'
DIVIDE WS-NUM BY 2 GIVING WS-Q REMAINDER WS-R
IF WS-R = 1
WRITE DASB-RCD FROM WS-NUM
ELSE
WRITE DASC-RCD FROM WS-NUM
END-IF
READ DASA INTO WS-NUM
AT END MOVE 'Y' TO WS-EOF-SW
END-READ
END-PERFORM
CLOSE DASA DASB DASC
STOP RUN
.
Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?
Difference between cobol and cobol-ii?
What are the pertinent COBOL commands?
if we display var1 then what will b displayed in below condition. 77 var1 pic s9(2) value -10. 77 var1 pic s9(2) value -11. " " " -12. " " " -13. -14 ... ... -19.
What is the problem of ordered sequential files access?
What is the local-storage section?
input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.
example for sub strings ? and refernce modifications whit output pls
Which mode is used to operate the sequential file?
How do you define a variable of comp-1 and comp-2?
Explain how you can characterize tables in cobol?
How do we get current date from system with century in COBOL?
how do you reference the fixed unblock file formats from cobol programs
What are various search techniques in cobol? Explain.
What is the difference between next sentence and continue in cobol programing language?