|
|
| Author |
Message |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4150 Location: San Jose, CA
|
|
|
|
Have you even tried to work this out for yourself based on the previous example?
You've changed the requirement 3 times already. How many more changes will there be? Come back tomorrow morning and assure me there will be no more changes in the requirement and I'll give you one final solution. |
|
| Back to top |
|
 |
References
|
Posted: Thu Mar 20, 2008 1:19 am Post subject: Re: |
 |
|
|
 |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
Hi Frank,
There is no change in the requirement. I assure you that this is the final one.
Please give me the JCL. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4150 Location: San Jose, CA
|
|
|
|
Here's the DFSORT/ICETOOL job:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
SPLICE FROM(IN) TO(T1) ON(49,4,CH) KEEPNODUPS KEEPBASE -
WITHALL WITH(6,60) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
OPTION VLSCMP
INCLUDE COND=(15,4,SS,EQ,C'PART,NAME')
INREC IFTHEN=(WHEN=(15,4,CH,EQ,C'NAME'),
BUILD=(1,4,5:C'0',49:23,4,66:27,16)),
IFTHEN=(WHEN=NONE,BUILD=(1,4,5:C'1',6:5))
SORT FIELDS=(49,4,ZD,A,5,1,CH,A)
OUTFIL FNAMES=T1,OMIT=(16,4,CH,NE,C'PART'),
BUILD=(1,4,5:6)
/*
//CTL2CNTL DD *
SORT FIELDS=(30,6,ZD,A)
/*
|
|
|
| Back to top |
|
 |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
Hi Frank,
Thanks for the JCL above.
Please tell me which option of the SPLICE allows the duplicates from the OVERLAY record? |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4150 Location: San Jose, CA
|
|
|
|
| Quote: |
| Please tell me which option of the SPLICE allows the duplicates from the OVERLAY record? |
WITHALL tells ICETOOL to splice the base record with each overlay record if that's what you mean. |
|
| Back to top |
|
 |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
I have used DFSORT SPLICE for one of my requirements.
I am getting the results as below.
If there is no base record for a particular key, I am getting only one overlay record spliced(others are eliminated from the output).
If there are more than one base records for a particular key, I am getting only one overlay record spliced and also one base record.
I need the results as below:
If there is no base record for a particular key, I should get all the overlay records in the output and spaces for the positions where the base record should have values in the output.
If there are more than one base records for a given key, I should get all the overlay records in the output. And for the Base record positions in the output file, i should get the values from the first base record(since there are more than one base records for a given key). And I should not get any base record
Please let me know with which options I can handle this.
Note: I am just using the KEEPNODUPS option with my SPLICE operand(except WITHALL and WITH) |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 7342 Location: 221 B Baker St
|
|
|
|
Hello,
Please post some example input and output data that demonstrate your situation as well as the jcl and control statements for this process. |
|
| Back to top |
|
 |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
As in my first example,
If I have a data like this.. in the input file,
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+
-------- PART 01232K01121{03051AZZZZ-------------
-------- PART 01232B01421A09011AXXXX-------------
-------- PART 01122{08015{01021AMMMM-------------
-------- PART 01122{08015{01021AMMMM-------------
++++++++ NAME ZZZZHARI 4
++++++++ NAME XXXXRAMU 2 |
The output I am getting is like below..
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+---
-------- PART 01232K01121{03051AZZZZ-------------HARI
-------- PART 01232B01421A09011AXXXX-------------RAMU
-------- PART 01122{08015{01021AMMMM------------- |
The part number MMMM is appearing twice in the input file.. For this part there is no 'NAME' record.
So, I am getting only one record in the output for the part MMMM.
I am using this below SPLICE command.
SPLICE FROM(IN) TO(OUT) ON(48,4,CH) WITHALL KEEPNODUPS -
WITH(5,60)
I am using the 'NAME' record as the base and 'PART as the overlay records.
Please let me know how what changes can be done in SPLICE to get all the records of PART(overlay) if there is no part 'NAME'(base record) reocrd exists for a given key. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4150 Location: San Jose, CA
|
|
|
|
If you go back to the example I showed, you'll see I have the KEEPBASE operand for the SPLICE operator. It's missing from your SPLICE operator.
You need KEEPBASE to keep the first duplicate without a match.
If adding KEEPBASE doesn't give you what you want, then show me your complete ICETOOL job. |
|
| Back to top |
|
 |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
Hi Frank,
Atlast my problem got resolved.
Thanks a lot for the solution.
I have a question about the base and overlay records.
As I understood, the base records are assumed as NAME records and overlay records as PART records.
My question is how does the SPLICE command consider the base records as NAME and overlay records as PART records. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4150 Location: San Jose, CA
|
|
|
|
The SPLICE command treats the first record of a set of duplicates as the "base" record and the second (and subsequent)
record(s) of a set of duplicates as the "overlay" record(s). So we just had to set things up so the NAME records were first. |
|
| Back to top |
|
 |
|
|
|