Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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.

Answers were Sorted based on User's Feedback



i have two file, each file having : file1 is having 2 fields field1 field2 file..

Answer / visitor

FD FILE1
01 FILE1-REC
05 FIELD1 PIC X(3)
05 FIELD2 PIC X(3)

FD FILE2
01 FILE2-REC
05 FIELD1 PIC X(3)
05 FIELD2 PIC X(3)
05 FIELD3 PIC X(3)

FD FILE3
01 FILE3-REC
05 FELD1 PIC X(3)
05 FELD2 PIC X(3)
05 FELD1 PIC X(3)
05 FELD2 PIC X(3)
05 FELD3 PIC X(3)

PROCEDURE DIVISION
oPEN INPUT FILE1
FILE2
OUTPUT FILE3

READ FILE1
READ FILE2

WRITE FILE3-REC FROM FILE1-REC,FILE2-REC.

STOP RUN.

Is This Answer Correct ?    6 Yes 0 No

i have two file, each file having : file1 is having 2 fields field1 field2 file..

Answer / sumanth toom

Quikjob is best for your case. (if your company has this
mainframe tool. It is a JCL tool similar to a SORT).

Is This Answer Correct ?    3 Yes 0 No

i have two file, each file having : file1 is having 2 fields field1 field2 file..

Answer / sruthi

By using move reference modification it is very simple.
first open 2 input files and 1 output file.read 2 input
files.write the logic as following.
move filerec1 to filerec3(1:10).
move filerec2 to filerec3(11:10).
write filerec3.

Is This Answer Correct ?    4 Yes 1 No

i have two file, each file having : file1 is having 2 fields field1 field2 file..

Answer / thavasi

Simple and Best answer to your requirement is ICETOOL with
SPLICE operator. It will get you the expected result with
very less no of line of coding.


I had a requirement like this a year before and generated
the o/p using ICETOOL.

Is This Answer Correct ?    2 Yes 0 No

i have two file, each file having : file1 is having 2 fields field1 field2 file..

Answer / shailendra

i think the last ans will give som error due the same
varable name is declare in the same level in fd file3.

Is This Answer Correct ?    1 Yes 0 No

i have two file, each file having : file1 is having 2 fields field1 field2 file..

Answer / viks

Hi Asmara i think u didnt get my question asking
for.Actually my requirement is to not only merge all 5
fields but they shud come in 1 row(2 flds from file 1 and 3
flds from file 2) into file3(output file)


file1 is having 2 fields

field1 field2
123 234


file2 is having 3 fields
field1 field2 field3

456 678 789

output file3
Fld1 fld2 fld1 fld2 fld3
123 234 456 678 789

Is This Answer Correct ?    0 Yes 0 No

i have two file, each file having : file1 is having 2 fields field1 field2 file..

Answer / navatha

declare field1,field2(file3rec1) in 1 group then
field1,field2,feild3 in another group(file3rec2) then
declare it as whole record then using reference
modification u can do as
move filerec1 to file3rec1(1:10)
move filerec2 to file3rec2(1:10)
write file3


i think this will get ur answer............

Is This Answer Correct ?    0 Yes 0 No

i have two file, each file having : file1 is having 2 fields field1 field2 file..

Answer / sivakumar sekharannair

Have an output file with 5 fields
Output file layout
field1field2filed3field4field5
MOVE FIELD1 OF FILE1 TO FIELD1 OF OUTPUT
MOVE FIELD2 OF FILE1 TO FIELD2 OF OUTPUT
MOVE FIELD3 OF FILE1 TO FIELD3 OF OUTPUT
MOVE FIELD1 OF FILE1 TO FIELD4 OF OUTPUT
MOVE FIELD2 OF FILE1 TO FIELD5 OF OUTPUT
WRITE OUPUT FILE

Is This Answer Correct ?    0 Yes 1 No

i have two file, each file having : file1 is having 2 fields field1 field2 file..

Answer / 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

More COBOL Interview Questions

I have a occurs for 100 times but it has executed 101 time what could be the reason?

4 Answers  


What is EIBCALEN? Why it is used?

9 Answers   ADP,


Explain about level numbers?

3 Answers  


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.

2 Answers   IBM, Steria,


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 ?

0 Answers  


If a file has 1000 records.. if i have to replace the first and last characters of the file with another character. how it can be done....

1 Answers   HCL,


What is an in line perform? When would you use it? Anything else you wish to say about it.

0 Answers  


how many maximum no of variables can be declared in linkage section ?

2 Answers   HCL,


01 A pic 9(100) find record length of it

6 Answers   TCS,


what is internal sort and external sort ? which is preferable ?

2 Answers   TCS,


how can count the number of character in feild ?? suppose for instance i have a feild with value ' rajesh sarkar' then how can v count the number of characters whitout spaces...........

4 Answers   Wipro,


How do you reference the fixed block file formats from cobol programs

0 Answers  


Categories