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 the Purpose of POINTER Phrase in STRING command in COBOL?
What is the difference between Call and a Link?
Name the sections present in data division.
which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad
If you are current on the owner of a set, what is the difference between obtain next and obtain first?
Are you comfortable in cobol or jcl?
i made it to stage 3 of an interview process wednessday they will quiz my knowledge again face to face for an analyst role recruiter said it will be based on Business requirements system is cobol and good ideas what they might ask etc
how can we apply for HSBC exam(Mainframe) in India??? i went to their site and was told to submit my CV ,. etc..( totally confusing...)
For rewrite, why is it mandatory that file needs to be opened?
What is the default value(s) for an initialize? What keyword will allow for an override of the default?
What is the difference between next sentence and continue in cobol programing language?
Explain how will you differentiate between an internal and an external sort, the pros and cons, internal sort syntax etc
Mention the guidelines to write a structured cobol program?
Can we redefine the field of x(200) to less than 200?
what is the difference between COBOL2 AND COBOL390?