View previous topic :: View next topic
|
Author |
Message |
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
For instance, I have the following two input file:
FILEA:
Code: |
----+----1----+----2----+---
****************************
CCCCCC333
AAAAAA111
BBBBBB111
CCCCCC111
AAAAAA222
CCCCCC222
****************************
|
FILEB:
Code: |
----+----1----+----2----+
*************************
CCCCCC
AAAAAA
************************* |
The output should be:
Code: |
----+----1----+----2----+---
****************************
AAAAAA111
AAAAAA222
CCCCCC111
CCCCCC222
CCCCCC333
****************************
|
In the above sample, the key is from column 1 with 6bytes.
I'm using the keywords provided in FILEB to search FILEA, all records with the same keyword are output.
by the way, the version of DFSort in my system is :Z/OS DFSORT V1R5 |
|
Back to top |
|
|
neontech Warnings : 1 New User
Joined: 08 Dec 2009 Posts: 11 Location: mumbai
|
|
|
|
If you intend to use sort then.. you can simply sort your filea based on first 6 bytes.. and omit BB records... which will give u the desired output.. whereas if you intend to write the output file based on key in file2 .. then i dont think there is any way that you use sort.. you will have to write a program..
somebody correct me if i am worng |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Please search the forum for the use of SPLICE or SELECT for matching files using keys.
This is a link to the DFSORT smart tricks documentation which has many examples of matching records.
Please click HERE to access it.
Can you also post the line ICE201I from a sort sysout to allow the sort guys to know the release that you are using, as this can affect the solution offered.
neontech
You are wrong. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Expat,
Quote: |
neontech
You are wrong. |
More often than not. . . unfortunately
d |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
dejunzhu,
What is the RECFM and LRECL of each input file?
What is the approx. maximum number of records in FileB?
Can FileB have duplicate keys (e.g. two CCCCCC keys)? |
|
Back to top |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
Frank Yaeger wrote: |
dejunzhu,
What is the RECFM and LRECL of each input file?
What is the approx. maximum number of records in FileB?
Can FileB have duplicate keys (e.g. two CCCCCC keys)? |
1. RECFM=FB,LRECL=80
2. The total record number of FILEB is 10.
3. Because records in FILEB are all keys which is used to be searched with, it has no duplicate records. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Given that the maximum number of records in FILEB is small, I'd suggest a DFSORT/ICETOOL job like this:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILEA DD *
CCCCCC333
AAAAAA111
BBBBBB111
CCCCCC111
AAAAAA222
CCCCCC222
//FILEB DD *
CCCCCC
AAAAAA
//CTL2CNTL DD DSN=&&C2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
// DD *
SORT FIELDS=(1,9,CH,A)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(FILEB) TO(CTL2CNTL) USING(CTL1)
SORT FROM(FILEA) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
OUTFIL FNAMES=CTL2CNTL,REMOVECC,
HEADER1=(' INCLUDE COND=(1,1,CH,NE,1,1,CH,OR,'),
BUILD=(C' 1,6,CH,EQ,C''',1,6,C''',OR,',80:X),
TRAILER1=(' 1,1,CH,NE,1,1,CH)')
/*
|
|
|
Back to top |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
Hello, Frank,
Thanks for your kind reply.
Would you please make an exhaustive exposition on the following control card in the HEADER AND TRAILER?
Besides, how if the size of FILEB has almost the same record number with FILEA? Is there an alternative way to implement this?
Thank you. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
1,1,CH,NE,1,1,CH is a NOP - it will never be true. It's just there to make the INCLUDE syntax work for the actual conditions derived from FileA.
Code: |
INCLUDE COND=(NOP,
actual conditions,
NOP)
|
Quote: |
Is there an alternative way to implement this? |
Yes, there are several alternative ways to implement this. I gave you the best one based on the maximum number of records you said you had.
For a large number of records in FILEB, a SPLICE or JOINKEYS solution would be needed. There are lots of examples of both techniques on this board. |
|
Back to top |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
Thank you, Frank.
But as I'm using DFSORT V1R5, I'm afraid JOINKEYS is not supported by this version. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
JOINKEYS is supported for z/OS DFSORT V1R5. You just need to ask your System Programmer to install z/OS DFSORT V1R5 PTF UK51706 (Nov, 2009). |
|
Back to top |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
I got it , Frank.
Thank you. |
|
Back to top |
|
|
|