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.
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)
/*
********************************* 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)
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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.