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
 

 

show the merged value when duplicated on key

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

New User


Joined: 23 Mar 2008
Posts: 13
Location: china

PostPosted: Wed Feb 11, 2009 8:07 pm    Post subject: show the merged value when duplicated on key
Reply with quote

urgent: show the merged value when duplicated on key

1-6 are the key field. if there are duplicated on the key field, then need to merge 12-14, and then show the merged value in all duplicated records.



input:

AAABBB 111 1 A1
AAABBB 222 0 A2
AAABBB 333 1 A3
AAABBB 444 1 A4
CCCDDD 555 1 A5
EEEFFF 666 1 A6

output:

AAABBB 111 011 A1
AAABBB 222 011 A2
AAABBB 333 011 A3
AAABBB 444 011 A4
CCCDDD 555 1 A5
EEEFFF 666 1 A6


thanks for you all help
Back to top
View user's profile Send private message

liangl

New User


Joined: 23 Mar 2008
Posts: 13
Location: china

PostPosted: Wed Feb 11, 2009 8:19 pm    Post subject:
Reply with quote

Sorry, I need to fix my post:
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 Feb 11, 2009 10:44 pm    Post subject:
Reply with quote

You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. You'll need z/OS DFSORT PTF UK90013 (July, 2008) to use the WITHANY function. If you don't have this PTF, ask your System Programmer to install it.

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD *
AAABBB 111   1     A1
AAABBB 222 0       A2
AAABBB 333     1   A3
AAABBB 444     1   A4
CCCDDD 555 1       A5
EEEFFF 666   1     A6
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(T1) ON(1,6,CH) KEEPNODUPS -
  WITHANY WITH(12,1) WITH(14,1) WITH(16,1)
COPY FROM(IN) TO(T1)
SPLICE FROM(T1) TO(OUT) ON(1,6,CH) WITHALL -
  WITH(1,11) WITH(17,64)
/*


In the future, please post inline text rather than GIF files.
Back to top
View user's profile Send private message
liangl

New User


Joined: 23 Mar 2008
Posts: 13
Location: china

PostPosted: Wed Feb 11, 2009 10:55 pm    Post subject:
Reply with quote

Thank to reply me, but it is true our system doesn't support WITHANY function, has any other way to solve it?
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 Feb 11, 2009 11:17 pm    Post subject:
Reply with quote

Run this job and show me the //SYSOUT messages:

Code:

//S1    EXEC  PGM=SORT                                           
//SYSOUT    DD  SYSOUT=*                                 
//SORTDIAG DD DUMMY       
//SORTIN DD *                                                   
RECORD 1                                                                                           
//SORTOUT DD DUMMY 
//SYSIN    DD    *                                               
  OPTION COPY       
/*                                             
Back to top
View user's profile Send private message
liangl

New User


Joined: 23 Mar 2008
Posts: 13
Location: china

PostPosted: Wed Feb 11, 2009 11:37 pm    Post subject:
Reply with quote

I think you want to the current version of my system, right?

this is part of message:

BLOCKSET TECHNIQUE IN CONTROL
RECORD TYPE IS F - DATA STARTS IN POSITION 1
C5-K26318 C6-K90007 C7-K90000 C8-K23476 E9-K90007 C9-BASE E5-K31980
BLOCKSET COPY TECHNIQUE SELECTED
VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
- CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 13:05 ON WED FE
OPTION COPY
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 Feb 12, 2009 12:18 am    Post subject:
Reply with quote

I believe this DFSORT/ICETOOL job will work with your level of DFSORT:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD *
AAABBB 111   1     A1
AAABBB 222 0       A2
AAABBB 333     1   A3
AAABBB 444     1   A4
CCCDDD 555 1       A5
EEEFFF 666   1     A6
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
SPLICE FROM(IN) TO(T1) ON(1,6,CH) KEEPNODUPS -
  WITHEACH WITH(14,1) WITH(16,1) USING(CTL1)
COPY FROM(IN) TO(T1)
SPLICE FROM(T1) TO(OUT) ON(1,6,CH) WITHALL -
  WITH(1,11) WITH(17,64)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,6,CH,A,12,1,CH,D,14,1,CH,D,16,1,CH,D)
/*
Back to top
View user's profile Send private message
liangl

New User


Joined: 23 Mar 2008
Posts: 13
Location: china

PostPosted: Thu Feb 12, 2009 12:47 am    Post subject:
Reply with quote

wo, it really works, thank you so much
Back to top
View user's profile Send private message
liangl

New User


Joined: 23 Mar 2008
Posts: 13
Location: china

PostPosted: Thu Feb 12, 2009 1:04 am    Post subject:
Reply with quote

one more question:

if I change input second line from AAABBB 222 0 A2 to AAABBB 222 A2, which means replace '0' as blank, then this JCL doesn't work, can you tell me why?
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 Feb 12, 2009 1:54 am    Post subject:
Reply with quote

With the WITHANY solution, the output would be:

Code:

AAABBB 111   1 1   A1     
AAABBB 222   1 1   A2     
AAABBB 333   1 1   A3     
AAABBB 444   1 1   A4     
CCCDDD 555 1       A5     
EEEFFF 666   1     A6     


With the WITHEACH solution, the output would be:

Code:

AAABBB 111     1   A1     
AAABBB 222     1   A2     
AAABBB 333     1   A3     
AAABBB 444     1   A4     
CCCDDD 555 1       A5     
EEEFFF 666   1     A6     


WITHANY takes the values in 12, 14 and 16 no matter where they are in any of the duplicate records so it does what you want.

WITHEACH takes the value in 14 from the second duplicate record and the value in 16 from the third duplicate record. With a blank in 14 of every duplicate, you get a blank for the second value. We would have to do more coding to ensure that if 14 has all blanks, 16 is the second record.

WITHANY is much better for this kind of thing (that's why I added it to DFSORT). Ask your System Programmer to install z/OS DFSORT V1R5 PTF UK90013 (July, 2008) so you can use WITHANY. The PTF is free.
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 Joinkeys with duplicated keys juares castro SYNCSORT 19 Fri Sep 23, 2016 5:58 am
No new posts How to show message using batch jobs madprasy TSO/ISPF 7 Fri Sep 09, 2016 6:55 pm
No new posts Need to show date in "DYYMMDD.TH... deepak_shrivastava DFSORT/ICETOOL 2 Tue Jan 05, 2016 7:15 pm
No new posts Create dynamic gdg generations based ... Aditya Prakash Joshi DFSORT/ICETOOL 12 Tue May 20, 2014 8:13 am
No new posts Why command history does not show? dejunzhu TSO/ISPF 3 Thu Jun 20, 2013 2:41 pm


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