i have two file, each file having :
file1 is having 2 fields
field1 field2
file2 is having 3 fields
field1 field2 field3
my req is to make it one file like:
field1 field2 field1 field2 field3
if anyone know please send me syntax, i tried this with
DFSORT but could not succeed.
Answer Posted / asmara
THRU SORTING AND MERGING IT WILL BE POSSIBLE
IF IT ALREADY SORTED MEANS DO THE MERGING OF TWO FILES,
HERE I AM GIVING THE PROGRAM HOW TO STORE ALL THOSE IN ONE
PROGRAM
IDENTIFICATION DIVISION.
PROGRAM-ID. MERGEFILES.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT STUDENTFILE ASSIGN TO "STUDENTS.DAT"
ORGANIZATION IS LINE SEQUENTIAL.
SELECT DEPARTMENTFILE ASSIGN TO "TRANSINS.DAT"
ORGANIZATION IS LINE SEQUENTIAL.
SELECT NEWSTUDENTFILE ASSIGN TO "STUDENTS.NEW"
ORGANIZATION IS LINE SEQUENTIAL.
SELECT WORKFILE ASSIGN TO "WORK.TMP".
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD STUDENTFILE.
01 STUDENTREC PIC X(30). // THIS IS THE STUDENT REC AS FILE1
FD DEPARTMENTFILE.
01 DEPARTMENTREC PIC X(30).// THIS IS THE DEPT. REC AS FILE2
FD NEWSTUDENTFILE.
01 NEWSTUDENTREC PIC X(30).//THIS IS THE FILE3 IN WHICH YOU
ARE GOING TO STORE THE TWO FILE DETAILS
SD WORKFILE.
01 WORKREC.
02 STUDENTIDWF PIC 9(7).
02 FILLEER PIC X(23).
PROCEDURE DIVISION.
/*HERE I AM MERGING THE TWO FILES AND STORING IN
NEWSTUDENTFILE.*/
BEGIN.
MERGE WORKFILE
ON ASCENDING KEY STUDENTIDWF
USING INSERTIONSFILE, STUDENTFILE
GIVING NEWSTUDENTFILE.
STOP RUN.
---IF I AM WRONG INFORM ME. THANKS
Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
What are the rules of the move verb?
I have File 1 occurs 5 times with Employee-ID,Employee-Name,Employee-Dept (EEE and MECH). I have File 2 occurs 10 times with Employee-ID,Employee-Name,Employee-Dept (EEE,CIVIL,CHEMICAL and MECH). In FIle 1 and FIle 2 , for matching Employee-DEPT (Only MECH) , we need to move entire records from file1 to file 2. We should not use 2D array. Your help is needed here.
Can you please let me know the centre name of INS certification in Kolkata.
Name the divisions, which are available in a cobol program?
How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?
Define cobol?
how do you reference the printer file formats from cobol programs
What is length is cobol?
How to remove the spaces at the end of each record in the output file of variable length, via cobol program?
I have to write to a outfile where the number of records in that file should be the header of that file using IMS.. can anyone help me in this issue
Differentiate between structured cobol programming and object-oriented cobol programming.
Whats the difference between search & search ALL?
I need to compare 3 variables(dates) and do some processing based on the earliest date. There could be more then 1 date record in any of the 3 fields. What is the best way to code this?
What is the difference between PIC 9.99 and PIC9v99?
Describe the cobol database components?