View previous topic :: View next topic
|
Author |
Message |
Raymond Sachs
New User
Joined: 13 Dec 2007 Posts: 45 Location: USA
|
|
|
|
Dear Listers,
Any pointers on how to achieve this in SORT.
System: MVS z/OS
Input File A: LRECL = 900 FB
Input File B: LRECL = 900 FB
Input File C: LRECL = 900 FB
Key 1 is from position 10 and is 4 characters
Key 2 is from position 890 and is 5 characters
File A :
Key1 Key 2
XXXX .... 12345
XXXX .... 12345
XXXX .... 12345
XXXX .... 88888
XXXX .... 88888
XXXX .... 99999
XXXX .... 99999
YYYY .... 12345
YYYY .... 12345
YYYY .... 12345
YYYY .... 55555
YYYY .... 55555
YYYY .... 77777
ZZZZ .... 44444
File B
XXXX .... 12345
YYYY .... 55555
ZZZZ .... 44444
File C
XXXX .... 12345
XXXX .... 12345
XXXX .... 12345
YYYY .... 55555
YYYY .... 55555
ZZZZ .... 44444
Appreciate the help |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Ray,
Fromyour post, its not clear what you are looking for? Could you explain bit clearly. |
|
Back to top |
|
|
Raymond Sachs
New User
Joined: 13 Dec 2007 Posts: 45 Location: USA
|
|
|
|
Hello Murali,
What I am trying to accomplish is the following:
Using File B as a driver on File A, whenever there is a match on Key1,
get ALL the values of Key2 from File A with the additional match
condition of Key 2 and write it out to File C
e.g. File B has the keys XXXX and 12345. File A is the super
set of the file B that has XXXX paired with values other than
12345. Without writing a program, I would like to write out to
a third file all the values of XXXX that have 12345 and so on
Hope this helps |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Ray,
Try this -
Code: |
//S@@ EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//FILE1 DD FILE1....
//FILE2 DD DRIVER-FILE.....
//T1 DD DSN=&&T1,DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(FILE2) TO(T1) USING(CTL1)
COPY FROM(FILE1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(10,5,CH) ON(890,4,CH) -
WITH(902,1) KEEPNODUPS USING(CTL3) WITHALL
/*
//CTL1CNTL DD *
INREC OVERLAY=(901:C'22')
/*
//CTL2CNTL DD *
INREC OVERLAY=(901:C'11')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,OMIT=(901,2,CH,EQ,C'22',OR,
901,2,CH,EQ,C'11'),
BUILD=(1,900)
/* |
|
|
Back to top |
|
|
Raymond Sachs
New User
Joined: 13 Dec 2007 Posts: 45 Location: USA
|
|
|
|
Hello Murali,
Thanks a bunch for your efforts.
I tried to execute the above and realized that we use SYNCSORT in our shop and do not have ICETOOL.
Is is not possible to use the SYNCSORT to achieve this. I understand that this is not a SYNCSORT list ... |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Raymond Sachs
Try running Murli's JOB with SYNCTOOL instead of ICETOOL. |
|
Back to top |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Hi Ray.
Here is a SyncSort for z/OS 1.2 job that should give you the desired results:
Code: |
//STEP1 EXEC PGM=SORT
//SORTJNF1 DD DSN=INPUT.FILE1
//SORTJNF2 DD DSN=INPUT.FILE2
//SORTOUT DD DSN=MATCHED.RECORDS
//SYSOUT DD SYSOUT=*
JOINKEYS FILES=F1,FIELDS=(10,4,A,890,5,A)
JOINKEYS FILES=F2,FIELDS=(10,4,A,890,5,A)
REFORMAT FIELDS=(F1:1,900)
SORT FIELDS=COPY
/*
|
|
|
Back to top |
|
|
Raymond Sachs
New User
Joined: 13 Dec 2007 Posts: 45 Location: USA
|
|
|
|
Hi Krisprems/Murali,
The solution worked. I used PGM=SYNCTOOL instead of PGM=SORT.
Well what is SYNCTOOL? I know that we have ICETOOL and SYNCSORT. Is it a new tool or a hybrid? Who supports SYNCTOOL.
I have yet to try out Syncsort support solution using JOINKEYS. Will do that later. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Ray,
ICETOOL is a DFSORT product (IBM). Whereas SYNCTOOL is SYNCSORT. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
Raymond Sachs
New User
Joined: 13 Dec 2007 Posts: 45 Location: USA
|
|
|
|
Hello Alissa,
When I executed with your cards (Using JOINKEYS), the output file had Zero records!
Ray[/img][/code] |
|
Back to top |
|
|
Aham
New User
Joined: 24 Oct 2007 Posts: 42 Location: chennai
|
|
|
|
Ray,
The job given by murali says (10,5,CH) and (890,4,CH) but your initial post at the top says 10,4 and 890,5. Sort job given alissa also says 10,4 and 890,5. If that is not working for you but job given by murali is working then probably your join keys are 10,5 and 890,4 is it? I had a very similar requirement and alissa's job worked fine for me. |
|
Back to top |
|
|
Raymond Sachs
New User
Joined: 13 Dec 2007 Posts: 45 Location: USA
|
|
|
|
Aham/Murali/Alissa
I made sure the Join keys are correct when I coded for either solutions. I re-examined the solution provided by Murali using SYNCTOOL and I found that it did not do what I had expected. I have tried to explain below what is going on:
Requirement:
File A :
Key1 other data Key 2
XXXX ABCDEFGH ... 12345
XXXX LMNOPQRS ... 12345
XXXX PQRTSUVS ... 12345
XXXX ABCDEFGH ... 88888
XXXX LMMMMMMI ... 88888
XXXX PQRTSUVS ... 99999
XXXX LMNOPQRS ... 99999
YYYY LLLLLLLLLLI ... 12345
YYYY MMMMMMM ... 12345
YYYY OOOOOOO ... 12345
YYYY PPPPPPPPP ... 55555
YYYY QQQQQQQ ... 55555
YYYY RRRRRRRR ... 77777
ZZZZ MMMMMMM ... 44444
File B
XXXX ABCDEFGH ... 12345
YYYY OOOOOOO ... 55555
ZZZZ MMMMMMM ... 44444
Desired Output:
File C
XXXX ABCDEFGH ... 12345
XXXX LMNOPQRS ... 12345
XXXX PQRTSUVS ... 12345
YYYY PPPPPPPPP ... 55555
YYYY QQQQQQQ ... 55555
ZZZZ MMMMMMM ... 44444
With Murali Solution: I get the following. (The Key 2 is picked correctlywith Key 1 and the number of rows are correct but I lose
the "other data". i.e. rec#2 should be LMNOPQRS and not
ABCDEFGH
XXXX ABCDEFGH ... 12345
XXXX ABCDEFGH ... 12345
XXXX ABCDEFGH ... 12345
YYYY PPPPPPPPP ... 55555
YYYY PPPPPPPPP ... 55555
ZZZZ MMMMMMM ... 44444
With Allissa's solution: I do not get any records.
I made sure the keys are coded correctly(key 1 = 4 char and Key 2 = 5 char)
Any pointers? |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Assuming Files are LRECL=80, RECFM=FB, this is the SYNCTOOL solution. Change as per your requirement.
Code: |
//*******************************************************
//STEP001 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
----+----1----+----2----+----3----+----4----+----5----+--
XXXX ABCDEFGH ... 12345
XXXX LMNOPQRS ... 12345
XXXX PQRTSUVS ... 12345
XXXX ABCDEFGH ... 88888
XXXX LMMMMMMI ... 88888
XXXX PQRTSUVS ... 99999
XXXX LMNOPQRS ... 99999
YYYY LLLLLLLL ... 12345
YYYY MMMMMMM ... 12345
YYYY OOOOOOO ... 12345
YYYY PPPPPPP ... 55555
YYYY QQQQQQQ ... 55555
YYYY RRRRRRR ... 77777
ZZZZ MMMMMMM ... 44444
/*
//IN2 DD *
XXXX ABCDEFG ... 12345
YYYY OOOOOOO ... 55555
ZZZZ MMMMMMM ... 44444
/*
//TMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//BOTH DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN2) TO(TMP1) USING(NKK2)
COPY FROM(IN1) TO(TMP1) USING(NKK1)
SPLICE FROM(TMP1) TO(BOTH) ON(1,4,CH) WITH(82,1) WITH(6,12) -
ON(19,5,CH) USING(NKK3) KEEPNODUPS WITHALL
/*
//NKK2CNTL DD *
OUTREC OVERLAY=(81:C'11')
/*
//NKK1CNTL DD *
OUTREC OVERLAY=(81:C'22')
/*
//NKK3CNTL DD *
OUTFIL FNAMES=BOTH,INCLUDE=(81,2,CH,EQ,C'12'),BUILD=(1,80)
/*
|
|
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
observe my coding
in the SPLICE statement. |
|
Back to top |
|
|
Aham
New User
Joined: 24 Oct 2007 Posts: 42 Location: chennai
|
|
|
|
Alissa's code was missing the //SYSIN DD name. I have tested the below code for your input and it does give the desired output. You can use this
Code: |
//STEP05 EXEC PGM=SORT
//SORTJNF1 DD DSN=INPUT.FILE1,
// DISP=SHR
//SORTJNF2 DD DSN=INPUT.FILE2,
// DISP=SHR
//SORTOUT DD DSN=MATCHED.RECORDS
//SYSOUT DD SYSOUT=*
//SYSIN DD *
----+----1----+----2----+----3----+----4----+
JOINKEYS FILES=F1,FIELDS=(10,4,A,890,5,A)
JOINKEYS FILES=F2,FIELDS=(10,4,A,890,5,A)
REFORMAT FIELDS=(F1:1,900)
SORT FIELDS=COPY
/*
|
|
|
Back to top |
|
|
yogeshpawar
New User
Joined: 01 Mar 2006 Posts: 37 Location: Sussex-UK
|
|
|
|
Kris,
Is SYNCTOOL exactly similar to ICETOOL in functioning or do we need to make any changes in the job to use SYNCTOOL instead of ICETOOl as mentioned above. (apart from mentioning SYNCSORT libraries in steplib as DFSORT is installed on my site) |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
Back to top |
|
|
yogeshpawar
New User
Joined: 01 Mar 2006 Posts: 37 Location: Sussex-UK
|
|
|
|
Thanks for the quick reply Kris.. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
yogeshpawar,
You seem to be confused whether to use DFSORT/ICETOOL or Syncsort/SYNCTOOL. To tell which one is your primary sort product at your site, look at the messages you get when you use PGM=SORT and PGM=ICETOOL:
PGM=SORT
DFSORT - ICE messages
Syncsort - WER messages
PGM=ICETOOL
DFSORT's ICETOOL - ICE messages
Syncsort's SYNCTOOL - SYT messages
If you have DFSORT, then you have DFSORT's ICETOOL and there would be no reason to use Syncsort's SYNCTOOL. DFSORT's ICETOOL is fully documented and fully supported (has been since 1991) and its function and documentation have been enhanced many times since then. SYNCTOOL is undocumented so if it did have any functions not found in ICETOOL, there would be no documentation of those functions. Likewise, there would be no documentation of functions missing from SYNCTOOL. |
|
Back to top |
|
|
Aham
New User
Joined: 24 Oct 2007 Posts: 42 Location: chennai
|
|
|
|
Frank - More than documentation we have the kernel developer himself to help us in the forum |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Yes, that's true.
I'm quite proud of the fact that I "invented" and developed DFSORT's ICETOOL in 1991, as well as all subsequent enhancements. I even wrote all of the documentation. I'll continue to enhance and document it in the future. |
|
Back to top |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Aham wrote: |
Alissa's code was missing the //SYSIN DD name. |
Although my JCL did not specify the SYSIN DD, it should not matter. The SYSIN DD statement will be automatically be generated before the first line that does not have // or /* (etc.) in the first and second columns.
Ray, if you are still having problems with this application, please send me a PM or direct email and I would be happy to assist you further.
Happy New Year to all. |
|
Back to top |
|
|
|