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
What is comp-1 and comp-2?
What is Pic 9v99 Indicates in COBOL?
What is cobol?
Which division and paragraphs are mandatory for a COBOL program?
What is link edit in cobol?
input 1 input2 ouput1 output2 output 3 1 re 300 1 re 200 1 re 300 3 rc 500 1 re 200 2 rr 400 1 re 300 2 rr 400 1 rc 400 3 rc 500 1 rc 400 2 rr 700 2 rr 700 5 tt 900 5 tt 900 2 inputs r in flat file and output 1 is matched records,ouptput2 is unmatched of input1,output3 is unmatched of input2! how vl u get the output files using sequential order and to check with each and every records! let me know the procedure division ?
1.give the details about WHEN OTHER. 2. how many form are available in evaluate.
How to get the last record in vsam file in cluster? And how can you get the ksds file records into cobol program?
What is the difference between comp and comp-3 usage?
what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.
how to convert the recors form vsam file to db2 table tru file aid
Explain what you understand by passing by value.
Difference between cobol and cobol-ii?
How do you get the data to code the BMS macro?
What are all the divisions of a COBOL program?