IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to combine two files columnwise?


IBM Mainframe Forums -> Compuware & Other Tools
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 271

PostPosted: Wed Sep 05, 2007 12:04 pm
Reply with quote

Dear all,

I have to combine two files columnwise. Presume File1 has 1452 columns and file2 has 8388. the combined file should have column 9840.Is there any option to combine in FILEAID? If so let me know.

Regards,
Murali.
Back to top
View user's profile Send private message
manihcl85
Warnings : 1

New User


Joined: 11 Jan 2007
Posts: 52
Location: chennai

PostPosted: Wed Sep 05, 2007 12:14 pm
Reply with quote

Hi,

I dont think fileaid has such an option. u can do the same using Sort or Rexx.

Regards,
Mani
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 271

PostPosted: Wed Sep 05, 2007 12:26 pm
Reply with quote

can you help me how to join two files using sort, i tried with icetool splice it doesn't work. i used the following example but this example itself is not working.

I have two files with a key in bytes 1-3 and data in bytes 5-9.
File A has the following records:
000 $$$$$
001 AAAAA
002 CCCCC
003 EEEEE
004 GGGGG
and File B has the following records:
001 BBBBB
003 DDDDD
004 FFFFF
005 HHHHH
I want to join the data fields for pairs of records with the same key to get the following output:
001 AAAAA BBBBB
003 EEEEE DDDDD
004 GGGGG FFFFF
Can I do that using DFSORT/ICETOOL?
Below is an ICETOOL job that can do it. The trick is to reformat the fields of the IN1 and IN2 files so you can join them with the SPLICE operator. SPLICE helps you perform various file join and match operations.
Note: For this example, the key and data fields are in the same locations in both files. But this same technique can be used if the key and/or data fields are in different locations in the files by reformatting the two files appropriately.
//DFSORT EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... file 1
//IN2 DD DSN=... file 2
//TMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//OUT DD DSN=... output file
//TOOLIN DD *
* For this example, the fields (p,m) are as follows:
* IN1: sort key - 1,3
* f1fld - 5,5
* IN2: sort key - 1,3
* f2fld - 5,5
*
* Reformat the IN1 data set so it can be spliced
COPY FROM(IN1) TO(TMP1) USING(CPY1)

* Reformat the IN2 data set so it can be spliced
COPY FROM(IN2) TO(TMP1) USING(CPY2)

* Splice records with matching IN1/IN2 keys
SPLICE FROM(TMP1) TO(OUT) ON(1,3,CH) WITH(11,5)
/*
//CPY1CNTL DD *
* Use OUTREC to create |key |f1fld |blank|
OUTREC FIELDS=(1:1,3,5:5,5,11:5X)
/*
//CPY2CNTL DD *
* Use OUTREC to create:|key |blank |f2fld|
OUTREC FIELDS=(1:1,3,11:5,5)
/*
Back to top
View user's profile Send private message
manihcl85
Warnings : 1

New User


Joined: 11 Jan 2007
Posts: 52
Location: chennai

PostPosted: Wed Sep 05, 2007 12:47 pm
Reply with quote

Hi,

If my guess is correct error ur getting might be the following one
//TOOLIN DD *
COPY FROM(IN1) TO(TMP1) USING(CPY1)
COPY FROM(IN2) TO(TMP1) USING(CPY2)
SPLICE FROM(TMP1) TO(OUT) ON(1,3,CH) WITH(11,5)
/*
//CPY1CNTL DD *
OUTREC FIELDS=(1:1,3,5:5,5,11:5X)
/*
//CPY2CNTL DD *
OUTREC FIELDS=(1:1,3,11:5,5)
/*

Sol : use one space before COPY, SPLICE, OUTREC e.t.c

If i am not correct please post the error message ur getting.

Regards,
Mani
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 271

PostPosted: Mon Sep 10, 2007 12:34 pm
Reply with quote

Hi ,

This is the output i got when i run the job,

********************************* Top of Data **********************************
001 AAAAA BBBBB001 BBBBB..................................................
003 EEEEE DDDDD003 DDDDD..................................................
004 GGGGG FFFFF004 FFFFF..................................................
******************************** Bottom of Data ********************************

why the highlighted data is repeating agian please let me know the explanation about the syntax so that i can join two files with columns 1452 & 8388. (ouput 9841)

Regards,
Murali
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Oct 15, 2007 10:20 pm
Reply with quote

Murali,

I don't usually look at this Forum, but somebody pointed me to it.

When I run that ICETOOL job with DFSORT's ICETOOL, I get the following output:

Code:

001 AAAAA BBBBB
003 EEEEE DDDDD
004 GGGGG FFFFF


I don't know what you're doing exactly to get the output you got.

If you want to send me (yaeger@us.ibm.com) the JES, //TOOLMSG and //DFSMSG messages from your job, I'll take a look. Please put "DFSORT" in your Subject line to catch my attention.

Mani,

One space is required before OUTREC. One space is NOT required before COPY or SPLICE.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Compuware & Other Tools

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top