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 

Sum of amounts using SPLICE

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


Joined: 29 Jan 2004
Posts: 62
Topics: 19

PostPosted: Tue Apr 11, 2006 9:16 am    Post subject: Sum of amounts using SPLICE Reply with quote

Hi,

Could you please suggest me how to use SPLICE in below situation.

File 1
Account Policy Cleint name Adderss Amount 1

File 2
Account Policy Amount 2

Output file
Account Policy Sum(Amount1+2) Client name Address

File 1 and File 2 are table unload and I am getting Amount 1 and 2 using SUM function.

Thanks
Rahul

P.S: I can align the column position for Amount field
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Apr 11, 2006 9:26 am    Post subject: Reply with quote

Rahull,

Why do you need SPLICE here? All you need is make the files of the same length and sort on the ACCOUNT POLICY and sum on the amounts.

Please post the File layouts and DCB properties of both files , so that we can suggest a solution

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rahull
Beginner


Joined: 29 Jan 2004
Posts: 62
Topics: 19

PostPosted: Tue Apr 11, 2006 9:37 am    Post subject: Reply with quote

Hi Kolusu,

Thanks for the quick reply. I thought of SPLICE because I need to have final single record with account , policy , sum and all other fields( Which is different in both the unload)

I was thinking of using ON operation of SPLICE on account and policy and WITH to get other stuff. But if the SORT is quick and consume less I/O overhead, I am good.


Rec length of file1 : 80 (FB) (Account(10), Policy(20), SUM1, Client Name(20))
Rec length of file2 = 80 (FB) (Account(10), Policy(20), Sum2, Client Address(20))
Rec length of output = 80 (FB) (Account , policy, SUM(1+2), client name, client address)

SUM is a scaler function and during unload its taking 9 bytes with C and D for signs.

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


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

PostPosted: Tue Apr 11, 2006 10:09 am    Post subject: Reply with quote

Rahull,

In your first post you said that file1 has both the client name and address and now you Changed the client address to be on file2?

You also haven't provided the format of the fields. Just provide the cobol layout for the files.

ex:
Code:

Client-account pic x(10).
Client-policy  pic x(20).
Client-sum1    pic S9(16) COMP-3.
...


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rahull
Beginner


Joined: 29 Jan 2004
Posts: 62
Topics: 19

PostPosted: Tue Apr 11, 2006 10:25 am    Post subject: Reply with quote

Hi Kolusu,

Sorry for the misunderstanding.

Whatever I posted in my last post is the final layout for each file. Also please find the layout of Files :

File 1 :
Account Pic X(10).
Policy Pic X(20).
Sum Pic S9(16) COMP-3.
Name Pic X(20).
Filler Pic X (21)

File 2 :
Account Pic X(10).
Policy Pic X(20).
Sum Pic S9(16) COMP-3.
Address Pic X(20).
Filler Pic X (21)

File 3 :
Account Pic X(10).
Policy Pic X(20).
Sum Pic S9(16) COMP-3.
Name Pic X(20)
Address Pic X(20).
Filler Pic X (1)

Since everything I am talking about is unload from table, I didn't mentioned the cobol layout earlier. My input to my program would be File3.

One additional requirement I got just now is that in File 3 dont include the records when the Sum is greater then or equal to Zero. Can we include this condition in a single sort step.

Let me know if you need more information.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Apr 11, 2006 11:35 am    Post subject: Reply with quote

The following DFSORT/ICETOOL Jcl will give you the desired results. If your shop has syncsort then change the pgm name to synctool.

Code:
     
//STEP0100 EXEC PGM=ICETOOL                               
//TOOLMSG   DD SYSOUT=*                                   
//DFSMSG    DD SYSOUT=*                                   
//IN1       DD DSN=YOUR FILE1 INPUT,                     
//             DISP=SHR                                   
//IN2       DD DSN=YOUR FILE2 INPUT,                     
//             DISP=SHR                                   
//T1        DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T2        DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//CON       DD DSN=&T1,DISP=SHR,VOL=REF=*.T1             
//          DD DSN=&T2,DISP=SHR,VOL=REF=*.T2             
//OUT       DD DSN=YOUR FINAL OUTPUT FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//TOOLIN    DD *               
  COPY FROM(IN1) USING(CTL1)   
  COPY FROM(IN2) USING(CTL2)   
  SORT FROM(CON) USING(CTL3)   
//CTL1CNTL  DD *               
  OUTFIL FNAMES=T1,             
  OUTREC=(1,59,20Z,X)           
//CTL2CNTL  DD *               
  OUTFIL FNAMES=T2,             
  OUTREC=(1,39,20Z,40,20,X)     
//CTL3CNTL  DD *               
  OPTION EQUALS
  SORT FIELDS=(01,10,CH,A,     
               11,20,CH,A)     

  SUM FIELDS=(31,09,PD,         
              40,08,BI,         
              48,08,BI,         
              56,04,BI,         
              60,08,BI,         
              68,08,BI,         
              76,04,BI)         
                               
  OUTFIL FNAMES=OUT,           
  INCLUDE=(31,9,PD,LT,0)       
/*                             


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