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 / dimpy19
FILE-CONTROL.
SELECT INP ASSIGN TO INF
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD INP
RECORDING MODE IS F.
01 INP-REC.
10 STUDENT-ID PIC 9(3).
10 STUDENT-NAME PIC X(20).
FILE-CONTROL.
SELECT INP ASSIGN TO INF
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD INP
RECORDING MODE IS F.
01 INP-REC.
10 STUDENT-ID PIC 9(3).
10 STUDENT-NAME PIC X(20).
WORKING-STORAGE SECTION.
01 C PIC 99 VALUE ZEROS.
01 D PIC 99V99 VALUE ZEROS.
01 E PIC 99.99.
01 I PIC 99 VALUE ZEROS.
01 WS-INP-REC.
10 WS-STUDENT-ID PIC 9(3).
10 WS-STUDENT-NAME PIC X(20).
05 EOF PIC X VALUE 'N'.
01 PRINT-CHAR PIC X(20).
PROCEDURE DIVISION.
OPEN INPUT INP.
READ INP INTO WS-INP-REC.
PERFORM UNTIL EOF = 'Y'
ADD 1 TO I
DISPLAY I
DIVIDE 2 INTO I GIVING C REMAINDER D
MOVE D TO E
DISPLAY E
IF (D IS ZERO)THEN
DISPLAY WS-STUDENT-NAME
END-IF
READ INP INTO WS-INP-REC AT END MOVE 'Y' TO EOF
END-READ
END-PERFORM.
CLOSE INP.
GOBACK.
output :
01
01.00
02
00.00
BRPITA
03
01.00
04
00.00
DRPITA
05
01.00
06
00.00
FRPITA
input :
000001 070 ARPITA
000002 080 BRPITA
000003 090 CRPITA
000004 100 DRPITA
000005 110 ERPITA
000006 120 FRPITA
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Can we change the password using ALTER? anyone tried and changed?
) How do u handle errors in BMS macro?
What are the pertinent COBOL commands?
How to find out the closest prime number of an input number? I believe it has something to do with SEARCH and COBOL Linear Array.
How to traceback if I am getting SOC7 or SOC4 abend? List down the steps
When is inspect verb is used in cobol?
State the various causes of s0c1, s0c5 and s0c7.
What are declaratives and what are their uses in cobol?
how do you reference the variable unblock file formats from cobol programs
how to access the file from prodution from changeman tool and to submit a file to production
please..could u give an example about USAGE IS POINTER ..and explain why and when we use it ?
what happens if parmparameter passes zero bytes to the program
) How do u handle errors in BMS macro
If you are current on the owner of a set, what is the difference between obtain next and obtain first?
What is perform what is varying?