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
 

 

Help needed on grouping and filtering using SORT

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

New User


Joined: 03 Nov 2009
Posts: 19
Location: chennai

PostPosted: Thu Sep 02, 2010 10:27 pm    Post subject: Help needed on grouping and filtering using SORT
Reply with quote

My input file contains the below,

Code:

Field 1       Field 2
A                   1
A                   1
B                   1
B                   2
C                   1
C                   1
C                   2
D                   1


My output file should contain,

Code:

Field 1        Field 2
A                    1
A                    1
D                    1


I do not want records in my output which have DIFFERENT values in Field 2.

Please help on this using SORT/ICETOOL. Thanks in advance.
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Thu Sep 02, 2010 10:31 pm    Post subject:
Reply with quote

veeramanimurugesan,

How many different values does FIELD2 have? is it always just 1 and 2?
Back to top
View user's profile Send private message
veeramanimurugesan

New User


Joined: 03 Nov 2009
Posts: 19
Location: chennai

PostPosted: Fri Sep 03, 2010 1:39 am    Post subject: Reply to: Help needed on grouping and filtering using SORT
Reply with quote

Field 2 could have multiple values. 1 and 2 was just a sample to understand the requirement. Field 2 values are unpredictable. It is actually a 9 character
field.

For example,
Field 1 - Client Number
Field 2 - Account Number

A single client can have multiple accounts. If he has DIFFERENT multiple accounts, then i need to eliminate those records. If he has 2 records with same accounts, then i can have him in output. Only clients with DIFFERENT accounts need to be filtered out.
Back to top
View user's profile Send private message
smijoss

Active User


Joined: 30 Aug 2007
Posts: 114
Location: pune

PostPosted: Fri Sep 03, 2010 2:59 pm    Post subject:
Reply with quote

i got the output as u suggested, now check with ur actual data



Code:
//S020        EXEC PGM=ICETOOL                       
//FILE1   DD  *                                     
A    1                                               
A    1                                               
B    1                                               
B    2                                               
C    1                                               
C    1                                               
C    2                                               
D    1                                               
/*                                                   
//TEMP1    DD DSN=TEMP.TEST.DELETE,             
//             DISP=(NEW,CATLG),UNIT=DISK,           
//             SPACE=(27998,(400,100),RLSE)         
//FILEOUT  DD DSN=TEMP.TEST.FILEOUT,             
//             DISP=(NEW,CATLG),UNIT=DISK,           
//             SPACE=(27998,(400,100),RLSE)         
//SYSOUT   DD  SYSOUT=*                             
//TOOLIN   DD  *                                     
   COPY FROM(FILE1) TO(TEMP1) USING(CTL1)           
   COPY JKFROM TO(FILEOUT) USING(CTL2)               
/*                                                   
//CTL1CNTL DD  *                                     
   SORT FIELDS=(1,1,CH,A)                     
  OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,1,     
    TRAILER3=(1,2,MIN=(6,1,ZD),MAX=(6,1,ZD))) 
/*                                             
//CTL2CNTL DD  *                               
   JOINKEYS F1=FILE1,FIELDS=(1,1,A)           
   JOINKEYS F2=TEMP1,FIELDS=(1,1,A),SORTED     
   REFORMAT FIELDS=(F1:1,6,F2:1,6)             
   OPTION COPY                                 
   OUTREC FIELDS=(1,6)                         
/*                                             
//JNF2CNTL DD  *                               
  OMIT COND=(3,1,CH,NE,5,1,CH)                 
/*                                             
//DFSMSG   DD  SYSOUT=*                       
//TOOLMSG  DD  SYSOUT=*                       
Back to top
View user's profile Send private message
veeramanimurugesan

New User


Joined: 03 Nov 2009
Posts: 19
Location: chennai

PostPosted: Fri Sep 03, 2010 4:27 pm    Post subject:
Reply with quote

Hi smijoss

Thanks for your response.

JOINKEYS wont work in my version of DFSORT. The sort version on mainframe here is Z/OS DFSORT V1R10.

Error :
COPY JKFROM TO(FILEOUT) USING(CTL2) 00240001
DFSORT CALL 0002 FOR COPY FROM JOINKEYS TO FILEOUT USING CTL2CNTL TERMINATED
OPERATION RETURN CODE: 16

Please advise.
Back to top
View user's profile Send private message
smijoss

Active User


Joined: 30 Aug 2007
Posts: 114
Location: pune

PostPosted: Fri Sep 03, 2010 5:50 pm    Post subject:
Reply with quote

Code:
//S020        EXEC PGM=ICETOOL                                   
//FILE1   DD  DSN=TEMP.TEST.INDATA,DISP=SHR                   
//TEMP1    DD DSN=TEMP.TEST.TEST1,DISP=(NEW,CATLG),UNIT=DISK,
//             SPACE=(27998,(4000,1000),RLSE)                                       
//CONCAT   DD DSN=*.TEMP1,VOL=REF=*.TEMP1,DISP=OLD               
//         DD DSN=TEMP.TEST.INDATA,DISP=SHR                   
//FILEOUT  DD DSN=TEMP.TEST.FILEOUT,                         
//             DISP=(NEW,CATLG),UNIT=DISK,                       
//             SPACE=(27998,(400,100),RLSE)                       
//SYSOUT   DD  SYSOUT=*                                           
//TOOLIN   DD  *                                                 
   COPY FROM(FILE1) TO(TEMP1) USING(CTL1)                         
   SPLICE FROM(CONCAT) TO(FILEOUT) ON(1,1,CH) -                   
   WITH(6,1) WITHALL  USING(CTL2)                                 
/*                                                               
//CTL1CNTL DD  *                                                 
   SORT FIELDS=(1,1,CH,A)                                         
   OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,1,                       
    TRAILER3=(1,1,20:MIN=(6,1,ZD),MAX=(6,1,ZD),80:X))             
/*                                                               
//CTL2CNTL DD  *                                       
   OUTFIL OMIT=(20,1,CH,NE,22,1,CH),OUTREC=(1,10)       
/*                                                     
//DFSMSG   DD  SYSOUT=*                                 
//TOOLMSG  DD  SYSOUT=*                                 


INFILE :
Code:
----+----1----+----2--
**********************
A    1               
A    1               
B    1               
B    2               
C    1               
C    1               
C    2               
D    1   
Back to top
View user's profile Send private message
veeramanimurugesan

New User


Joined: 03 Nov 2009
Posts: 19
Location: chennai

PostPosted: Fri Sep 03, 2010 9:08 pm    Post subject:
Reply with quote

Thanks ! I will test this with my actual data.

It would be very helpful if you could explain the logic in TOOLIN, CTL1CNTL, CTL2CNTL control cards OR some short notes on how did you arrive at the output.
Back to top
View user's profile Send private message
smijoss

Active User


Joined: 30 Aug 2007
Posts: 114
Location: pune

PostPosted: Fri Sep 03, 2010 9:43 pm    Post subject:
Reply with quote

i knew u would ask the icon_smile.gif

TOOLIN :
you code the commands here for ICETOOL as you do in SYSIN for sortcard

to understand the purpose of CTL1CNTL -
check the output file TEMP.TEST.TEST1


download DFSORT getting started pdf, its explained very well
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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