Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to combine two files columnwise?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Compuware & Other Tools
View previous topic :: :: View next topic  
Author Message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 237

PostPosted: Wed Sep 05, 2007 12:04 pm    Post subject: How to combine two files columnwise?
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    Post subject:
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: 237

PostPosted: Wed Sep 05, 2007 12:26 pm    Post subject:
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    Post subject:
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: 237

PostPosted: Mon Sep 10, 2007 12:34 pm    Post subject:
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 Moderator


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

PostPosted: Mon Oct 15, 2007 10:20 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Compuware & Other Tools All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us