Page 1 of 1

Overlap using SPLICE

PostPosted: Tue Sep 16, 2008 10:18 pm
by ranga_subham
Hi,

I am running below SORT with ICETOOL to overlap a three byte field in file1 with four byte field from file2 but with truncation.

//SORT100  EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//SSMSG    DD SYSOUT=*                                               
//IN1      DD *                                                     
123ABC123                                                           
234BCD234                                                           
345CDE345                                                           
//IN2      DD *                                                     
GABB123                                                             
ARSN345                                                             
//TE1      DD DSN=&&TE1,DISP=(MOD,PASS,DELETE),SPACE=(TRK,(1,1),RLSE)
//OT1      DD SYSOUT=*                                               
//TOOLIN   DD *                                                     
COPY FROM(IN1) TO(TE1) USING(GAB1)                                   
COPY FROM(IN2) TO(TE1) USING(GAB2)                                   
SPLICE FROM(TE1) TO(OT1) ON(1,3,ZD) WITH(1,7)                       
/*                                                                   
//GAB1CNTL DD *                                                     
 OUTREC FIELDS=(1,9,4X)                                             
/*                         
//GAB2CNTL DD *             
 OUTREC FIELDS=(1:5,3,4:1,4)
/*                         
//                         


With above job the output appears as shown below:

123GABB23
345ARSN45


I expected the output to be as shown below:

123GABB123
345ARSN345


Is it possible to achieve it as I expected? What alterations I need to make to my SORT?

Thanks.

Used this to Overlap using SPLICE.

PostPosted: Tue Sep 16, 2008 10:30 pm
by ranga_subham
Hi,

I have achieved it by changing my control cards as given below..... ;)

//GAB1CNTL DD *                 
 OUTREC FIELDS=(1,3,4,3,X,8:7,3)
/*                             
//GAB2CNTL DD *                 
 OUTREC FIELDS=(1:5,3,4:1,4,X) 
/*                                                     


Hope it helps.... :D
Thanks.

Re: Overlap using SPLICE

PostPosted: Tue Sep 16, 2008 11:13 pm
by Alissa Margulies
You can also achieve this using SYNCSORT's JOIN feature:
//STEP1  EXEC PGM=SORT                                     
//SORTJNF1 DD *                             
123ABC123                                   
234BCD234                                   
345CDE345                                   
//SORTJNF2 DD *                             
GABB123                                     
ARSN345                                     
//SORTOUT  DD SYSOUT=*                     
//SYSOUT   DD SYSOUT=*                     
//SYSIN    DD *                             
    JOINKEYS FILE=F1,FIELDS=(1,3,A)         
    JOINKEYS FILE=F2,FIELDS=(5,3,A)         
    REFORMAT FIELDS=(F1:1,3,F2:1,4,F1:7,3) 
    SORT FIELDS=COPY                       
/*

Re: Overlap using SPLICE

PostPosted: Fri Feb 20, 2009 7:40 pm
by bodhi
Hi Alissa,

I have to do the extact the same operation which mentioned above with the some specfic condtion.what i have to do is read the first file and find the key in second file and join that field with record of the first file.Could you please help me out with this problem.Records are not in sequence

Ex:
1 file record
aa 1234 rohit
ab 12345 vimal

2 second file
12345 mumbai
1234 delhi

outfile
aa 1234 rohit delhi.
ab 12345 vimal mumbai.


Thanks
Bodhi

Re: Overlap using SPLICE

PostPosted: Sat Feb 21, 2009 12:31 am
by Alissa Margulies
Are all your fields variable? If so, please identify the maximum possible length of each field.

Re: Overlap using SPLICE

PostPosted: Sat Feb 21, 2009 3:26 pm
by bodhi
Hi Alissa,

Now is it working fine but i am facing some other problem. The problem is that in the output file i am getting duplicate records for each records means if i have 100 records in input file then i am getting the 200 records in output file beacuse of this my job abended with space abend as the record count is 1800000

My card is like this

//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(18,9,A)
JOINKEYS FILE=F2,FIELDS=(12,9,A)
REFORMAT FIELDS=(F1:1,99,F2:1,50)
SORT FIELDS=COPY
/*


Could you please suggest why it is happening.

Re: Overlap using SPLICE

PostPosted: Sat Feb 21, 2009 10:29 pm
by dick scherrer
Hello,

It may help if you post a bit of the actual inputs and the output written from that input.

Re: Overlap using SPLICE

PostPosted: Fri May 15, 2009 8:58 pm
by Alissa Margulies
bodhi,

If you have duplicate records in either input file, that will cause multiple JOIN records to be produced. In order to get rid of the duplicates, modify your control statements as follows:

//SYSIN DD *
  JOINKEYS FILE=F1,FIELDS=(18,9,A)
  JOINKEYS FILE=F2,FIELDS=(12,9,A)
  REFORMAT FIELDS=(F1:1,99,F2:1,50)
  SORT FIELDS=(1,149,CH,A)
  SUM FIELDS=NONE
/*