Page 1 of 1

help me to convert this to ICETOOL code

PostPosted: Tue Jun 05, 2012 7:31 pm
by ranga_subham
Hi,

Request you to convert the below given two step solution into one step ICETOOL solution. We are using "Z/OS DFSORT V1R10".

//*=======================================================
//STEP0001 EXEC PGM=SORT                                 
//SORTIN   DD DSN=INPUT.GDG.FILE(0),DISP=SHR
//SORTOUT  DD DUMMY                                       
//SORTXSUM DD DSN=&&TEMP1,DISP=(NEW,PASS,DELETE),         
//            UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE)       
//SYSOUT   DD SYSOUT=*                                   
//SYSIN    DD *                                           
 INCLUDE COND=(40,3,CH,NE,C'   ')                         
 INREC FIELDS=(26,10,X,40,3,X,36,3)                       
 SORT FIELDS=(1,14,CH,A),EQUALS                           
 SUM FIELDS=NONE,XSUM                                     
//*=======================================================
//STEP0002 EXEC PGM=SORT                                 
//SORTJNF1 DD DSN=INPUT.GDG.FILE(0),DISP=SHR
//SORTJNF2 DD DSN=&&TEMP1,DISP=(OLD,PASS,DELETE)         
//SORTOUT  DD SYSOUT=*                                   
//SYSOUT   DD SYSOUT=*                                   
//SYSIN    DD *                                           
 SORT FIELDS=COPY                                         
 JOINKEYS FILE=F1,FIELDS=(26,10,A,40,3,A)                 
 JOINKEYS FILE=F2,FIELDS=(1,10,A,12,3,A)                 
 REFORMAT FIELDS=(F1:1,43) 
/*


Please help.

Thanks.

Re: help me to convert this to ICETOOL code

PostPosted: Tue Jun 05, 2012 9:23 pm
by skolusu
The above job doesn't make sense at all.

1. You are reading latest generation of gdg file and including the records that are greater than spaces in pos 40 for 3 bytes.

2. You are creating a new record with 10 bytes from pos 26 and 3 bytes from pos 40 as a key. I have no idea as to why you are using the 3 bytes from pos 36 as it not used any where.

3. You sum sort on the newly created 14 bytes and write out the duplicates to SORTXSUM.

4. Now you take the same latest generation of gdg file(which is the same file you used to get the sortxsum dataset) and match it with the SORTXSUM dataset using JOINKEYS? Aren't you getting a many to many match as the sortxsum dataset has only the duplicates? What is the purpose of this JCL?


It would be a good idea to show us a sample of 10 unique records (which may have duplicates) and also show us the desired output. I am guessing the lrecl's of the file is 43 and RECFM=FB. Is that correct?

And for the record it can be done in a single pass of data.

Re: help me to convert this to ICETOOL code

PostPosted: Fri Jun 08, 2012 2:17 pm
by ranga_subham
Hi,

The job has definitely produced results for me......that way it made some sense........however, its a roundabout method because I am NOT a SORT expert and seeking your advice ;) The GDG file has lots of duplicates and I got one of them into SORTXSUM and using that as input again I am trying to get all the duplicates......I know I have not done a clean job but got the results in a crooked manner.

Input:
----+----1----+----2----+----3----+----4----+
20120606221337705765ASRTA    ABC123AGT OO1
20120606221337705765ASRTA    ABC123AGV OO2
20120606221337705765ASRTA    ABC123APC     
20120606221337705765ASRTA    ABC123ATU KUR
20120606221337705765ASRTA    ABC123AKJ PIC
20120606221337705765ASRTA    ABC123ALU OO2


The key fields are at 30th(6 characters), 36th(3 characters) and 40th(3 characters) positions. The main ones are fields at 30th and 40th columns. My expected output is as shown below:

----+----1----+----2----+----3----+----4----+
20120606221337705765ASRTA    ABC123AGV OO2
20120606221337705765ASRTA    ABC123ALU OO2


Thanks.

Re: help me to convert this to ICETOOL code

PostPosted: Fri Jun 08, 2012 10:12 pm
by skolusu
Ranga_subham,

You definitely have complicated a simple request. You just need ALLDUPS after eliminating any records with spaces.

Here is a simple 1 pass ICETOOL solution. Your JCL showed the key as starting from 26 for a length of 10 bytes , but your latest post shows that the key starts from pos 30th for a length of 6 bytes. Your sample data shows that they byte 26-29 are just spaces , so I took the key as starting from pos 30 for a length of 6 bytes.

//STEP0100 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD *                                                     
----+----1----+----2----+----3----+----4----+----5----+----6----+----
20120606221337705765ASRTA    ABC123AGT OO1                           
20120606221337705765ASRTA    ABC123AGV OO2                           
20120606221337705765ASRTA    ABC123APC                               
20120606221337705765ASRTA    ABC123ATU KUR                           
20120606221337705765ASRTA    ABC123AKJ PIC                           
20120606221337705765ASRTA    ABC123ALU OO2                           
//OUT      DD SYSOUT=*                                               
//TOOLIN   DD *                                                     
  SELECT FROM(IN) TO(OUT) ON(30,6,CH) ON(40,3,CH) ALLDUPS USING(CTL1)
//CTL1CNTL DD *                                                     
  INCLUDE COND=(40,3,CH,NE,C'   ')                                   
//*


The output from this job is
20120606221337705765ASRTA    ABC123AGV OO2
20120606221337705765ASRTA    ABC123ALU OO2

Re: help me to convert this to ICETOOL code

PostPosted: Sun Jun 10, 2012 10:33 am
by ranga_subham
Hi,

Thanks a lot. :D