MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Arithmetic operations in DFSORT/ICETOOL report generation

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
sreenivask
Beginner


Joined: 23 Jun 2006
Posts: 10
Topics: 4
Location: CHENNAI

PostPosted: Fri Jun 23, 2006 8:25 am    Post subject: Arithmetic operations in DFSORT/ICETOOL report generation Reply with quote

My input file looks like this.The fields are Acct,type and number of mails respectively.

Code:
0007 A 1
0007 A 1
0007 B 2
0007 B 2
0007 B 1
0007 B 1
0007 C 1
0008 A 1
0008 B 2
0008 B 2
0008 B 2
0008 B 2


I have to generate a report which looks like this

Code:
ACCT-ID  TYPE   NUM-OF-MAILS       
-------  ----   ------------       
0007     A      2                 
         B      3                 
         C      1                 
0008     A      1                 
         B      2                 


Right now I am doing it with eztrieve.Can it be done by using DFSORT/ICETOOL or in any other simple way.The problem is while calculating the number of mails.How to perform arithmetic operations using sort/icetool?The following operation needs to be performed.

NUM-OF-MAILS = (Number of 2s in number of mails field)/2 + Number of 1s in the number of mails field

NOTE:Number of 2s in the number of mails field will always be even.

Thanks
Sree
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Fri Jun 23, 2006 9:06 am    Post subject: Reply with quote

sreenivask,

Try this job.

Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT DD SYSOUT=*                                   
//SORTIN DD *                                           
0007 A 1                                               
0007 A 1                                               
0007 B 2                                               
0007 B 2                                               
0007 B 1                                               
0007 B 1                                               
0007 C 1                                               
0008 A 1                                               
0008 B 2                                               
0008 B 2                                               
0008 B 2                                               
0008 B 2                                               
//SORTOUT DD SYSOUT=*                                   
//SYSIN DD *                                           
  SORT FIELDS=(1,4,CH,A,                               
               6,1,CH,A)                               
  INREC IFTHEN=(WHEN=INIT,                             
        OVERLAY=(41:SEQNUM,8,ZD,RESTART=(1,4))),       
        IFTHEN=(WHEN=(8,1,CH,EQ,C'1'),                 
        OVERLAY=(49:C'00000001',                       
                 57:C'00000000')),                     
        IFTHEN=(WHEN=(8,1,CH,EQ,C'2'),                 
        OVERLAY=(49:C'00000000',                       
                 57:C'00000001'))                       
  SUM FIELDS=(49,8,ZD,                                 
              57,8,ZD)                                 
  OUTREC IFTHEN=(WHEN=(41,8,ZD,GT,1),                   
         OVERLAY=(01:4X),HIT=NEXT),                     
         IFTHEN=(WHEN=(8,1,CH,EQ,C'2'),                 
         OVERLAY=(57:57,8,ZD,DIV,+2,M11,LENGTH=8))     
  OUTFIL OUTREC=(1,7,                                   
                 49,8,ZD,ADD,57,8,ZD,M10,LENGTH=8,     
                 80:X)                                 
/*                                                     


Hope this helps....

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group