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

hi, can you ppl tell me, how to check whether the rewrite we gave for the ksds file is successful or not in the program.? i gave rewrite, the rewrite code is executing and maxcc=0 but updation doenot happen in the file?

1 Answers   CGI,


I encountered an error when I move spaces to a numeric field?What should I do to move spaces on that field?help please.

9 Answers  


What is the difference between a binary search and a sequential search what are the pertinent cobol?

0 Answers  


if i am reading a file with some 50000 records and moving to a DB2 table and suddenly the program abends in between, is there anyway i could restart from the exact record at which the job failed once the program restarts.

2 Answers   UST,


What will happen if we generate GDG +2 version instead of +1 version?

2 Answers   T systems,


If you were passing a table via linkage, which is preferable - a subscript or an index?

3 Answers   TCS,


When is a scope terminator mandatory?

3 Answers  


Consider the following COBOL entries 05 X PIC 99 VALUE 10. ADD 40 X TO X. COMPUTE X = 3 * X - 40. The result in X is

12 Answers   TCS,


How does IDMS insure data integrity?

1 Answers  


In an EVALUATE statement, can I give a complex condition on a when clause?

2 Answers  


I have sequential file recl 1000 i want to add another 15 bytes to it. The record length should not change..How?

1 Answers   CTS, HCL,


9(2).99 how many bytes take? Why . consider as a byte?

2 Answers  


Categories