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


Please Help Members By Posting Answers For Below Questions

How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?

648


Difference between cobol and cobol-ii?

704


What are the pertinent COBOL commands?

2623


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.

5681


What is the problem of ordered sequential files access?

701






What is the local-storage section?

681


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.

1783


example for sub strings ? and refernce modifications whit output pls

1846


Which mode is used to operate the sequential file?

667


How do you define a variable of comp-1 and comp-2?

701


Explain how you can characterize tables in cobol?

638


How do we get current date from system with century in COBOL?

805


how do you reference the fixed unblock file formats from cobol programs

712


What are various search techniques in cobol? Explain.

648


What is the difference between next sentence and continue in cobol programing language?

709