IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can DFsort implement search function?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Tue Dec 08, 2009 6:07 pm
Reply with quote

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
View user's profile Send private message
neontech
Warnings : 1

New User


Joined: 08 Dec 2009
Posts: 11
Location: mumbai

PostPosted: Tue Dec 08, 2009 6:38 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Dec 08, 2009 7:15 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Dec 08, 2009 10:38 pm
Reply with quote

Hi Expat,

Quote:
neontech
You are wrong.
More often than not. . . unfortunately icon_sad.gif

d
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Dec 09, 2009 5:50 am
Reply with quote

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
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Wed Dec 09, 2009 8:50 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Dec 09, 2009 11:35 pm
Reply with quote

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
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu Dec 10, 2009 10:03 am
Reply with quote

Hello, Frank,
Thanks for your kind reply.

Would you please make an exhaustive exposition on the following control card in the HEADER AND TRAILER?
Code:
1,1,CH,NE,1,1,CH


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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Dec 10, 2009 11:11 pm
Reply with quote

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
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Dec 11, 2009 7:43 am
Reply with quote

Thank you, Frank.

But as I'm using DFSORT V1R5, I'm afraid JOINKEYS is not supported by this version.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 11, 2009 9:56 pm
Reply with quote

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
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Sat Dec 12, 2009 6:47 pm
Reply with quote

I got it , Frank.
Thank you.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top