|
View previous topic :: View next topic
|
| Author |
Message |
tampakenny
New User
Joined: 15 Feb 2006 Posts: 11 Location: Tampa, FL
|
|
|
|
I'm having some difficulty with the Splice operator. I don't seem to be getting the results I want. I've included a few sample rows of my data that get concatenated in DD FILEIN and the ICETOOL statements I'm using.
DATASET 1
-------------
010500 000000000 GPD1LLTPA
017990 373600000 SN0144A01
018040 124670000 SN0144A01
018250 356710000 SN0444A04
018740 203680000 SN0644A02
018760 305910000 SN0644A02
019040 344690000 SN0644A02
DATASET 2
-------------
010500 000000000 PD0101105
017990 373600000 SN0144A09
018040 124670000 SN0144A08
018250 356710000 SN0144A11
018740 203680000 SN0644A06
018760 305910000 SN0644A06
019040 344690000 SN0444A04
ICETOOL STATEMENTS
---------------------------
SPLICE FROM(FILEIN) -
TO(FILEOUT) -
ON(1,17,CH) -
WITH(1,29)
** I also tried WITH(18,12), but got the same results.
OUTPUT RECEIVED
----------------------
010500 000000000 PD0101105 010500 000000000 PD0101105
017990 373600000 SN0144A09 017990 373600000 SN0144A09
018040 124670000 SN0144A08 018040 124670000 SN0144A08
018250 356710000 SN0144A11 018250 356710000 SN0144A11
018740 203680000 SN0644A06 018740 203680000 SN0644A06
018760 305910000 SN0644A06 018760 305910000 SN0644A06
019040 344690000 SN0444A04 019040 344690000 SN0444A04
OUTPUT DESIRED
--------------------
010500 000000000 GPD1LLTPA 010500 000000000 PD0101105
017990 373600000 SN0144A01 017990 373600000 SN0144A09
018040 124670000 SN0144A01 018040 124670000 SN0144A08
018250 356710000 SN0444A04 018250 356710000 SN0144A11
018740 203680000 SN0644A02 018740 203680000 SN0644A06
018760 305910000 SN0644A02 018760 305910000 SN0644A06
019040 344690000 SN0644A02 019040 344690000 SN0444A04
Ultimately, I'd get the record from Dataset 1 and the matching record's columns 18-29 from Dataset 2. Worst case would be Dataset 1 record and the entire matching Dataset 2 record on one row as shown above.
What am I doing wrong? I've reviewed the ICETOOL Mini-User Guide from Dec 2004 and been through some of the previous posts, but still can't quite get the process to work as I want. Can it? Thanks in advance for any clarification. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I can't tell what your data really looks like ... if there are blanks, they've been removed. I don't think you have all of the data starting in position 1 for both files or you wouldn't have gotten the output you say you got.
You need to reformat the records so that the WITH data from input file2 is where you want it to be in the output file. I'd suggest reading through the discussion of SPLICE in "z/OS DFSORT Application Programming Guide" carefully. Here's a link to that discussion:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/6.13?DT=20050222160456
Just to give an example, I'll assume that the data in both files starts at position 1. Here's the DFSORT/ICETOOL job you'd need. I assumed your input files had RECFM=FB and LRECL=26, but the job can be changed appropriately for other attributes.
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/26)
//IN2 DD DSN=... input file2 (FB/26)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/55)
//TOOLIN DD *
* Reformat file1 records to:
* |key|f1data|blanks|
COPY FROM(IN1) TO(T1) USING(CTL1)
* Reformat file2 records to:
* |key|blanks|f2data|
COPY FROM(IN2) TO(T1) USING(CTL2)
* SPLICE to get:
* |key|f1data|f2data|
SPLICE FROM(T1) TO(OUT) ON(1,17,CH) WITH(30,26)
/*
//CTL1CNTL DD *
OUTREC FIELDS=(1,26,55:X)
/*
//CTL2CNTL DD *
OUTREC FIELDS=(1,17,30:1,26)
/*
|
If you need more help, you need to tell me exactly what your input records look like - where does the data start in each case? |
|
| Back to top |
|
 |
fixdoubts
New User
Joined: 21 Oct 2005 Posts: 54
|
|
|
|
Hi,
Apart from what frank has told one reason may be that you are using
the same input file twice since the data in the output file for both the
input looks the same. Am not sure but this might be another reason
for the incorrect output.
Regards, |
|
| Back to top |
|
 |
tampakenny
New User
Joined: 15 Feb 2006 Posts: 11 Location: Tampa, FL
|
|
|
|
| Thanks for the help. Both my files were 29 byte records in the same layout. I was able to take the sample code and modify it ever so slightly to accomodate the bigger record size and it appears to be working based on initial testing. And I'm definitely adding the link you provided to my documentation stash. Thanks again! |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Glad I could help. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|