Page 2 of 2

Re: Query regarding WITHALL WITHEACH

PostPosted: Sat Oct 27, 2012 5:55 pm
by porwalrox
Hello Billy Sir! I've posted what my exact expected output is? Which is same as the definition of WITHEACH & WITHALL says?
Please check the link of manual: http://publib.boulder.ibm.com/infocente ... 00/spl.htm

I am doing somewhat same as the manual is doing with WITHEACH & WITHALLL. Could you please tell me that if i am deviating from the actual definition?

Re: Query regarding WITHALL WITHEACH

PostPosted: Sat Oct 27, 2012 5:58 pm
by porwalrox
Sorry BillyBoyo! I'll be able to post ICE201I message on monday only.

Re: Query regarding WITHALL WITHEACH

PostPosted: Mon Oct 29, 2012 11:33 am
by porwalrox
Hi Billy!
ICE201I message is

ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1

Re: Query regarding WITHALL WITHEACH

PostPosted: Mon Oct 29, 2012 1:17 pm
by BillyBoyo
OK, thanks, that is pretty up-to-date.

It looks like you are investigating the SPLICE to understand how it operates?

I'd suggest while doing this, you put your "fields-involved-in-SPLICE" "out-of-the-way" of existing data - I put mine at 30, 40, 50 with your data.

I think the thing is, you've missed something with WITHEACH, I think.

WITHEACH is working with "pairs" from a set of duplicates and will deal with all pairs in a duplicate to create one record, BUT those output records can only, from SPLICE itself, contain data from the two records in the pair. As well, the WITH that you give relates, on a "positional" basis, to the pair concerned. Your first WITH is for the first pair of records, your second for the second pair of records, etc. Note that for WITHEACH, "blanks" in the field on the second of the pair will overwrite data from the first of the pair.

For WITHALL, you get multiple records for pairs, one fewer than the number of records. Again, the content of the second in the pair which is defined in a WITH overwrites the content of the first in the pair.

You have to read the whole section on SPLICE, you have to work through the examples and your own examples.

Often there will be other ways of doing what you want for which you've initially thought of using SPLICE.

Re: Query regarding WITHALL WITHEACH

PostPosted: Mon Oct 29, 2012 3:35 pm
by porwalrox
Hi Billy! Now i'm more confused. In WITHEACH first record is treated as a base reocrd and subsequent records overwrite the base record.
After processing the INREC, First 3 records will be like this
ID1 N5
ID1    N2
ID1       N8

If i do splicing with WITHEACH according to the manual, output should be like this
ID1       N8

if i got your point correctly, output will be the same as above. But manual tells it will be
ID1 N5 N2 N8

& moreover, the output is coming all the blanks like


You are right that i am doing some investigation only because of i'm not able to get the working of WITHEACH at all.

Re: Query regarding WITHALL WITHEACH

PostPosted: Mon Oct 29, 2012 4:12 pm
by BillyBoyo
Note that in the manual example, none of the field retained in the "base" record are specified in a WITH. Your example is different.

You are "losing" the field from the first record of a group (the base record) because you specify it in a WITH, so the data at that point will come from a duplicate record, containing space at the time.

Re: Query regarding WITHALL WITHEACH

PostPosted: Mon Oct 29, 2012 4:58 pm
by porwalrox
BillyBoyo Thanks a lot!

I misinterpreted a very important line in WITHEACH. The first WITH field specifies the bytes to be overlaid from the second duplicate record on to the first duplicate record. The second WITH field specifies the bytes to be overlaid from the third duplicate record on to the first duplicate record, and so on.

Re: Query regarding WITHALL WITHEACH

PostPosted: Mon Oct 29, 2012 5:41 pm
by BillyBoyo
Glad it helped.

Much of what used to be done with SPLICE before JOINKEYS and WHEN=GROUP became available no longer needs to be done with SPLICE.

To my mind, it is the most complicated of ICETOOL's functions. I'd even say the "only" complicated one :-)

EDIT: Have a look here, for example...

http://ibmmainframes.com/about58321.html#293357