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
 

 

Is SPLICE supposed to work this way?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
helga

New User


Joined: 11 Sep 2006
Posts: 23

PostPosted: Fri Jul 27, 2007 1:53 am    Post subject: Is SPLICE supposed to work this way?
Reply with quote

I ran a SPLICE in ICETOOL:

Code:
SPLICE FROM(IN1) TO(OUT1) ON(001,005,CH) KEEPNODUPS -
  WITHEACH WITH(013,005) WITH(019,005) USING(CTL1)


Where the input was:

Code:
ITEM1 XXXXX
ITEM4 XXXXX
ITEM5 XXXXX
ITEM7 XXXXX
ITEM2       XXXXX
ITEM4       XXXXX
ITEM6       XXXXX
ITEM7       XXXXX
ITEM3             XXXXX
ITEM5             XXXXX
ITEM6             XXXXX
ITEM7             XXXXX





I expected the results to be:

Code:
ITEM1 XXXXX
ITEM2       XXXXX
ITEM3             XXXXX
ITEM4 XXXXX XXXXX
ITEM5 XXXXX       XXXXX
ITEM6       XXXXX XXXXX
ITEM7 XXXXX XXXXX XXXXX



But instead I got:

Code:
ITEM1 XXXXX
ITEM2       XXXXX
ITEM3             XXXXX
ITEM4 XXXXX XXXXX
ITEM5 XXXXX
ITEM6
ITEM7 XXXXX XXXXX XXXXX



ie the WITHEACHing stopped as soon as it found a record with spaces in one of the WITH fields (look at ITEM5 and ITEM6).

Is that how it's supposed to work?
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: Fri Jul 27, 2007 2:41 am    Post subject:
Reply with quote

SPLICE is working as expected:

WITHEACH WITH(013,005) WITH(019,005)

tells DFSORT to overlay 13,5 from the second record with the same key onto the base record, and to overlay 19,5 from the third record with the same key onto the base record.

So when you have:

Code:

ITEM5 XXXXX                 <--- base
ITEM5             11111     <--- second record


you get

Code:

ITEM5 XXXXX   


ITEM5 XXXXX comes from the base record. Blanks come from 13,5 of the second record overlay the blanks in 13,5 of the base record. Since there's no third record, you don't get 19,5 from anywhere.

When you have:

Code:

ITEM6       XXXXX           <--- base
ITEM6             22222      <--- second record


you get:

Code:

ITEM6


ITEM6blanksXXXXX comes from the base record. Blanks from 13,5 of the second record overlay the XXXXX in the base record. Since there's no third record, you don't get 19,5 from anywhere.

Now is your next question, how can I get what I want?
Back to top
View user's profile Send private message
helga

New User


Joined: 11 Sep 2006
Posts: 23

PostPosted: Fri Jul 27, 2007 3:04 am    Post subject: Re: Is SPLICE supposed to work this way?
Reply with quote

Yes icon_razz.gif


Thanks Frank, that makes perfect sense when you explain it that way and also makes me realise why the examples in the book are the way they are.

So SPLICE works very well with "reliable" data, ie a list of state codes and then an invoice total by states for whatever states you sold in, or in this case a specific number of records for each state activity, say gross sales and taxes paid.

It's a little bit trickier if you're merging two files with some state codes on one file and some state codes on another and either might or might not have repeated records. Though I have managed somethign along those lines. How come I always seem to be pushing the envelope? icon_surprised.gif

To make the above example work, all I have to do is insert records for the "blank" fields before I get to the SPLICE
Back to top
View user's profile Send private message
helga

New User


Joined: 11 Sep 2006
Posts: 23

PostPosted: Fri Jul 27, 2007 3:24 am    Post subject: Re: Is SPLICE supposed to work this way?
Reply with quote

...what I hadn't realised was that with WITHEACH each WITH applies to an individual duplicate record. I was looking at it like OCCURS and using the WITHs to select fields from all the duplicate records. This wouldn't work anyway as if every WITH applied to every duplicate record, they'd overwrite the WITHs from the previous duplicate record.


...erm I think icon_lol.gif



Good stuff, but like I said, suited mostly to dependalbe file configurations.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid 2 commands instream work. In ... descann Compuware & Other Tools 2 Tue May 16, 2017 3:31 pm
No new posts What is the maximum number of sort wo... Pravina M SYNCSORT 2 Mon Mar 14, 2016 4:51 pm
No new posts Matching records using splice for COM... hiravibk DFSORT/ICETOOL 4 Sun Sep 27, 2015 12:05 pm
No new posts JCL -> Rexx -> XMITIP : Doesnt ... enrico-sorichetti CLIST & REXX 2 Thu Aug 06, 2015 11:09 pm
No new posts Select Variable=string Rexx does not ... Csongor CLIST & REXX 11 Thu May 07, 2015 9:33 pm


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