Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Can DFsort implement search function?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Can DFsort implement search function?
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Tue Dec 08, 2009 7:15 pm    Post subject:
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

Site Director


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

PostPosted: Tue Dec 08, 2009 10:38 pm    Post subject: Reply to: Can DFsort implement search function?
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 Moderator


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

PostPosted: Wed Dec 09, 2009 5:50 am    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed Dec 09, 2009 11:35 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Dec 10, 2009 11:11 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Dec 11, 2009 9:56 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts Replace function abdulrafi COBOL Programming 13 Mon Sep 12, 2016 10:12 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us