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
 

 

Group having specific values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rajesh_m

New User


Joined: 15 Apr 2008
Posts: 39
Location: India

PostPosted: Tue Feb 16, 2010 5:09 am    Post subject: Group having specific values
Reply with quote

Hi,

I have below requirement, could anyone please help me in achieving this.


Sample Input.
KEY1 A
KEY1 B
KEY1 C
KEY1 D
KEY2 A
KEY2 B
KEY3 E
KEY3 F
KEY4 A
KEY4 B

Output Should be:
KEY2 A
KEY2 B
KEY4 A
KEY4 B

We would need keys which is having values A and B, we should OMIT remaining keys.
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Feb 16, 2010 5:20 am    Post subject:
Reply with quote

Hi,

have you tried anything ? Have you searched for INCLUDE DFSORT ?


Gerry
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Feb 16, 2010 5:42 am    Post subject: Reply to: Group having specific values
Reply with quote

rajesh_m,

With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009), DFSORT now supports the JOINKEYS function which is used for matching the keys and get the desired results

Use the same file for both SORTJNF1 and SORTJNF2 and for JNF2 file select all the records without an 'A' or 'B' in col 6 and eliminate the dups. Once you join these records to file1 records we can eliminate all the matching records and write out just unpaired records from F1

Code:

//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//SORTJNF1 DD DSN=Your input file,DISP=SHR
//SORTJNF2 DD DSN=Your input file,DISP=SHR
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                       
  OPTION COPY                         
  JOINKEYS FILES=F1,FIELDS=(1,4,A)   
  JOINKEYS FILES=F2,FIELDS=(1,4,A)   
  JOIN UNPAIRED,F1,ONLY               
//JNF2CNTL DD *                       
  OMIT COND=(6,1,SS,EQ,C'A,B')       
  SUM FIELDS=NONE                     
//*


For complete details on JOINKEYS and the new date conversion functions available with the Nov, 2009 DFSORT PTF, see:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174

gcicchet wrote:
have you tried anything ? Have you searched for INCLUDE DFSORT ?


Gerry,

I would be really interested to know how it can be done with an INCLUDE condition. The condition here is check if each key has just an 'A' and 'B' record alone and it cannot have any other codes
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Feb 16, 2010 6:11 am    Post subject:
Reply with quote

Hi Skolusu,

my mistake, I misinterpreted the request.


Gerry
Back to top
View user's profile Send private message
rajesh_m

New User


Joined: 15 Apr 2008
Posts: 39
Location: India

PostPosted: Tue Feb 16, 2010 6:25 am    Post subject:
Reply with quote

Thanks Skolusu! Its is working, great logic.

But, if we want to select 'C' also along with 'A' and 'B' it is failing, for example.

Sample Input.
KEY1 A
KEY1 B
KEY1 C
KEY1 D
KEY2 A
KEY2 B
KEY2 C
KEY3 E
KEY3 F
KEY4 A
KEY4 B

The desired output should be
KEY2 A
KEY2 B
KEY2 C

But i'm getting
KEY2 A
KEY2 B
KEY2 C
KEY4 A
KEY4 B

Any idea how to avoid this situation.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Feb 16, 2010 6:49 am    Post subject: Reply to: Group having specific values
Reply with quote

rajesh_m,

Use the following control cards

Code:

//SYSIN    DD *                                                       
  OPTION COPY                                                         
  JOINKEYS FILES=F1,FIELDS=(1,4,A)                                   
  JOINKEYS FILES=F2,FIELDS=(1,4,A)                                   
  JOIN UNPAIRED,F1,ONLY                                               

  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(241:SEQNUM,1,ZD,RESTART=(1,4))), 
  IFTHEN=(WHEN=GROUP,BEGIN=(241,1,ZD,EQ,1),PUSH=(161:1,80),RECORDS=3),
  IFTHEN=(WHEN=GROUP,BEGIN=(241,1,ZD,EQ,2),PUSH=(081:1,80),RECORDS=2)
  OUTFIL INCLUDE=(241,1,ZD,EQ,3),BUILD=(161,80,/,81,80,/,1,80)
//*       
//JNF2CNTL DD *                                                       
  OMIT COND=(6,1,SS,EQ,C'A,B,C')                                     
  SUM FIELDS=NONE                                                     
//*
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Feb 16, 2010 5:09 pm    Post subject:
Reply with quote

Hi,

as I don't have z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009) installed, here is another solution

Code:
//STEP0001 EXEC PGM=ICETOOL                 
//TOOLMSG  DD SYSOUT=*                       
//DFSMSG   DD SYSOUT=*                       
//IN       DD *                             
KEY1 A                                       
KEY1 B                                       
KEY1 C                                       
KEY1 D                                       
KEY2 A                                       
KEY2 B                                       
KEY2 C                                       
KEY3 E                                       
KEY3 F                                       
KEY4 A                                       
KEY4 B                                       
/*
//T1       DD DSN=&&T1,                                                 
//            DISP=(,PASS,DELETE),                                     
//            UNIT=SYSDA,                                               
//            SPACE=(TRK,(5,5),RLSE)                                   
//T2       DD DSN=&&T2,                                                 
//            DISP=(,PASS,DELETE),                                     
//            UNIT=SYSDA,                                               
//            SPACE=(TRK,(5,5),RLSE)                                   
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
  SELECT FROM(IN) TO(T1) ON(1,4,CH) EQUAL(3)                           
  COPY FROM(T1) TO(T2) USING(CTL1)                                     
  SELECT FROM(T2) TO(OUT) ON(1,4,CH) EQUAL(3)                           
/*                                                                     
//CTL1CNTL DD *                                                         
  INCLUDE COND=(6,1,CH,EQ,C'A',OR,                                     
                6,1,CH,EQ,C'B',OR,                                     
                6,1,CH,EQ,C'C')                                         
/*                                                                     



Gerry
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Feb 17, 2010 12:19 am    Post subject:
Reply with quote

Gerry,

You really don't need 3 passes to get the desired results. Here is a two pass DFSORT/ICETOOL job

Code:

//STEP0100 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                     
//DFSMSG   DD SYSOUT=*                                     
//IN       DD *                                           
KEY1 A                                                     
KEY1 B                                                     
KEY1 C                                                     
KEY1 D                                                     
KEY2 A   - RECORD 1                                       
KEY2 B   - RECORD 2                                       
KEY2 C   - RECORD 3                                       
KEY3 D                                                     
KEY3 E                                                     
KEY3 F                                                     
KEY4 A                                                     
KEY4 B                                                     
KEY5 A                                                     
KEY5 B                                                     
KEY5 D                                                     
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT      DD SYSOUT=*                                     
//TOOLIN   DD *                                           
  SELECT FROM(IN) TO(T1) ON(1,4,CH) EQUAL(3) USING(CTL1)   
  SELECT FROM(T1) TO(OUT) ON(1,4,CH) EQUAL(3)             
//*                                                       
//CTL1CNTL DD *                                           
  OUTFIL FNAMES=T1,INCLUDE=(6,1,SS,EQ,C'A,B,C')           
//*
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Feb 17, 2010 3:30 am    Post subject:
Reply with quote

Hi Skolusu

thanks for the process improvement, one minor issue, FNAMES=P1 should be FNAMES=T1


Gerry
Back to top
View user's profile Send private message
rajesh_m

New User


Joined: 15 Apr 2008
Posts: 39
Location: India

PostPosted: Wed Feb 17, 2010 12:13 pm    Post subject:
Reply with quote

Thanks Skolusu and Gerry!!
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Feb 18, 2010 1:57 am    Post subject:
Reply with quote

gcicchet wrote:
Hi Skolusu

thanks for the process improvement, one minor issue, FNAMES=P1 should be FNAMES=T1


Gerry


Sorry. Corrected the post.
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
No new posts Why TS/OP would Not contact site supp... RahulG31 All Other Mainframe Topics 2 Wed Mar 22, 2017 7:46 am
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Route a product's job to specific lpar vasanthz All Other Mainframe Topics 9 Thu Mar 02, 2017 2:22 am
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm


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