Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to subtract Decimal fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
mak_tcs

New User


Joined: 23 Nov 2005
Posts: 69
Location: Minneapolis, MN USA

PostPosted: Wed Jul 18, 2007 8:03 pm    Post subject: How to subtract Decimal fields
Reply with quote

Hello,

My input record is like this

Code:
3400015.67;0000015.45;07/14/2007


I am trying to subtract the field2 (0000015.45) from field1(3400015.67)

Code:
  OUTREC FIELDS=(1,10,ZD,SUB,12,10,ZD)
is not working

Please help me to find out how to handle the decimal characters in the input record. Do I need to format them before I do this SUB operation?

Kindly advise! I am sorry if this is already been discussed

Thanks,
Mak
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Jul 18, 2007 8:13 pm    Post subject:
Reply with quote

You can use DFSORT's UFF (unsigned free form) format to do that:

Code:

   OUTREC FIELDS=(1,10,UFF,SUB,12,10,UFF,EDIT=(TTTTTTT.TT))


I assumed you wanted the output field in the same form as the input field. If not, tell me what you want the output field to look like.
Back to top
View user's profile Send private message
mak_tcs

New User


Joined: 23 Nov 2005
Posts: 69
Location: Minneapolis, MN USA

PostPosted: Wed Jul 18, 2007 8:54 pm    Post subject:
Reply with quote

Hi Frank,

I am getting the following error

Code:
SYSIN :                                                           
   SORT FIELDS=COPY                                               
   OUTREC FIELDS=(1,10,UFF,SUB,12,10,UFF,EDIT=(TTTTTTT.TT),180X) 
                       *                                         
WER268A  OUTREC STATEMENT  : SYNTAX ERROR   


I am using
Code:
//STEP01  EXEC PGM=SORT               


I appreciate your help on this.

Thanks!
Mak
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Jul 18, 2007 10:20 pm    Post subject:
Reply with quote

mak_tcs
You are getting the error WER268A, because you are using SYNCSORT not DFSORT, and that its not supporting UFF feature.
Back to top
View user's profile Send private message
mak_tcs

New User


Joined: 23 Nov 2005
Posts: 69
Location: Minneapolis, MN USA

PostPosted: Wed Jul 18, 2007 10:24 pm    Post subject:
Reply with quote

Please let me know if there is any alternate way of doing it.

Thanks,
Mak
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Jul 18, 2007 11:09 pm    Post subject:
Reply with quote

mak_tcs
Alternative solution is
Code:
//STEP001  EXEC PGM=SYNCTOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
3400015.67;0000015.45;07/14/2007                                       
/*                                                                     
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
 COPY FROM(IN1)  TO(TMP1) USING(CP01)                                   
 COPY FROM(TMP1) TO(OUT) USING(CP02)                                   
/*                                                                     
//CP01CNTL DD   *                                                       
  OUTREC BUILD=(1,7,9,10,20,13)                                         
/*                                                                     
//CP02CNTL DD   *                                                       
  INREC  FIELDS=(1,9,ZD,SUB,11,09,ZD,EDIT=(IIIIIII.TT))                 
/*                                                                     

OUT contains:
Code:
----+----1----+----2
3400000.22         
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Convert Decimal to hexadecimal Steve Ironmonger DFSORT/ICETOOL 5 Fri May 27, 2016 4:19 pm
This topic is locked: you cannot edit posts or make replies. JCL to convert float decimal into rea... polymathtarun JCL & VSAM 3 Sun May 15, 2016 9:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us