Page 1 of 1

Using The ADD function

PostPosted: Fri Mar 19, 2010 4:56 pm
by rayngerfan
I have a flat file RECFM=FB,LRECL=160 which contatins th following data. I would like to add the 3 EMAILS record counts which start in COL 126. I was going to use the OUTREC, with the ADD function, but I wasn't sure of the ADD function format.

I want to copy the first 1 - 125 records and then add the email totals in col starting in col 126.

01 26,192 02 26,192 03 26,192 04 26,192 05 26,192 06 26,192
07 26,192 08 26,192 09 26,192 10 26,192 11 26,192 12 26,192 EMAILS 942,946
01 15,734 02 15,734 03 15,734 04 15,734 05 15,734 06 15,734
07 15,734 08 15,734 09 15,734 10 15,734 11 15,734 12 15,734 EMAILS 566,449
01 5,276 02 5,276 03 5,276 04 5,276 05 5,276 06 5,276
07 5,276 08 5,276 09 5,276 10 5,276 11 5,276 12 5,276 EMAILS 189,955


Thanks

Re: Using The ADD function

PostPosted: Fri Mar 19, 2010 8:04 pm
by Alissa Margulies
Here is an example you can modify to accommodate your actual data:
//SORT1 EXEC PGM=SORT                                                     
//SORTOUT DD SYSOUT=*                                                     
//SYSOUT  DD SYSOUT=*                                                     
//SORTIN  DD *                                                             
01 26,192 02 26,192 03 26,192 04 26,192 05 26,192 06 26,192               
07 26,192 08 26,192 09 26,192 10 26,192 11 26,192 12 26,192 EMAILS 942,946
01 15,734 02 15,734 03 15,734 04 15,734 05 15,734 06 15,734               
07 15,734 08 15,734 09 15,734 10 15,734 11 15,734 12 15,734 EMAILS 566,449
01  5,276 02  5,276 03  5,276 04  5,276 05  5,276 06  5,276               
07  5,276 08  5,276 09  5,276 10  5,276 11  5,276 12  5,276 EMAILS 189,955
//SYSIN    DD *                                                           
  SORT FIELDS=COPY                                                         
  OUTFIL TRAILER1=(52:'TOTAL EMAILS ',                                     
         TOT=(68,7,UFF,EDIT=(II,III,IIT))),REMOVECC                       
/*                                                                         

Based on the above data and control statements, the following output would be produced:
01 26,192 02 26,192 03 26,192 04 26,192 05 26,192 06 26,192               
07 26,192 08 26,192 09 26,192 10 26,192 11 26,192 12 26,192 EMAILS 942,946
01 15,734 02 15,734 03 15,734 04 15,734 05 15,734 06 15,734               
07 15,734 08 15,734 09 15,734 10 15,734 11 15,734 12 15,734 EMAILS 566,449
01  5,276 02  5,276 03  5,276 04  5,276 05  5,276 06  5,276               
07  5,276 08  5,276 09  5,276 10  5,276 11  5,276 12  5,276 EMAILS 189,955
                                                   TOTAL EMAILS  1,699,350

Re: Using The ADD function

PostPosted: Sat Mar 20, 2010 7:50 pm
by rayngerfan
Hi Alissa

That code worked perfect. Can you tell me what parameters UFF & (II,III,IIT) mean?

I know they have to do with the format of how the total record number will be displayed, but I want to understand what each parameter is doing.

Thanks

Re: Using The ADD function

PostPosted: Sat Mar 20, 2010 9:35 pm
by dick scherrer
Hello,

Suggest you download the documentation. . .

UFF is Unsigned Free Format and EDIT=(II,III,IIT) is the edit mask.

Re: Using The ADD function

PostPosted: Sat Mar 20, 2010 9:41 pm
by rayngerfan
Hi Dick

Thanks for the information. Do you have a link to where I could download the documentation.

Re: Using The ADD function

PostPosted: Sat Mar 20, 2010 11:00 pm
by dick scherrer
Hello,

Send Alissa a note.

There is no "open" Syncsort download site.

Re: Using The ADD function

PostPosted: Mon Mar 22, 2010 8:03 pm
by Alissa Margulies
rayngerfan,

Contact me offline at alissa.margulies@syncsort.com and I would be happy to assist you with acquiring the manuals.