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


Please Help Members By Posting Answers For Below Questions

Write a program to enter and display the names of students in a class using the occurs clause.

642


What is cobol?

736


What are the access modes of START statement?

706


How do you reference the following file formats from cobol programs?

689


In COBOL programming, what is PERFORM? What is VARYING?

665






how to convert the recors form vsam file to db2 table tru file aid

2749


What are the rules of the move verb?

695


Define cobol?

854


What are the different data types in cobol?

781


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 ?

1862


What rules are followed by the search verb.

629


There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.

920


Explain how to differentiate call by context by comparing it to other calls?

679


What is the difference between binary search and sequential search?

634


) How do u handle errors in BMS macro

1498