IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to subtract Decimal fields


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Wed Jul 18, 2007 8:13 pm
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
No new posts Select a DB2 value in a specific deci... DB2 4
No new posts String has hex character need to conv... COBOL Programming 3
No new posts How to display the leading zeros of a... DB2 7
Search our Forums:

Back to Top