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
Have you used the sort in your project?for this type of questions any working on real time project give the eg. with real time scenario.
Name some of the examples of COBOl 11?
System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..
Mention the guidelines to write a structured cobol program?
how do you reference the ksds vsam file formats from cobol programs
What is the default value(s) for an initialize? What keyword will allow for an override of the default?
What is the difference between comp and comp-3?
What is the Purpose of POINTER Phrase in STRING command in COBOL?
Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?
In which area will you utilize 88 level items in cobol?
how we sort two input files based on a common column and giving one o/p file please send me the coding logic?
What is comp-1 and comp-2?
what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.
What is the difference between PIC 9.99 and PIC9v99?
Define cobol?