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

How to get output values with decimal using Syncsort V(1.2)


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Raghuraman_New

New User


Joined: 03 Oct 2008
Posts: 43
Location: Chennai,India.

PostPosted: Thu May 21, 2009 9:18 pm
Reply with quote

Hi,
I am trying to calculate Percentage for an value using sort. Below is my JCL,

Code:
//R010    EXEC PGM=SORT                               
//SORTIN   DD  *                                     
+050.50 +100.50                                       
-335.90 -335.90                                       
+345.70 -335.90                                       
//SORTOUT  DD  SYSOUT=*                               
//SYSIN    DD  *                                     
    SORT FIELDS=COPY                                 
    OUTREC FIELDS=(1:+100,MUL,                       
                   1,7,SFF,DIV,                       
                   9,7,SFF,EDIT=(STTT),SIGNS=(+,-,,))
//SYSOUT   DD  SYSOUT=*                               
//*                                                             


Output :-
+050
+100
-102

This works fine for me. But i need to get the output with two decimal values. So i tried below cntlcard,

Code:
SORT FIELDS=COPY                                   
OUTREC FIELDS=(1:+100,MUL,                         
               1,7,SFF,DIV,                         
               9,7,SFF,EDIT=(STTT.TT),SIGNS=(+,-,,))

Output :-

+000.50
+001.00
-001.02

But the expected output is,
+050.24
+100.00
-102.91

How can i get the above output ?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu May 21, 2009 9:25 pm
Reply with quote

Raghuram,

Try this
Code:
//STEP1 EXEC PGM=SORT                                   
//SORTIN DD *                                           
+050.50 +100.50                                         
-335.90 -335.90                                         
+345.70 -335.90                                         
//SYSOUT  DD SYSOUT=*                                   
//SORTOUT DD SYSOUT=*                                   
//SYSIN   DD *                                           
  SORT FIELDS=COPY                                       
  OUTREC FIELDS=(1:+10000,MUL,                           
                    1,7,SFF,DIV,                         
                    9,7,SFF,EDIT=(STTT.TT),SIGNS=(+,-,,))
Back to top
View user's profile Send private message
Raghuraman_New

New User


Joined: 03 Oct 2008
Posts: 43
Location: Chennai,India.

PostPosted: Fri May 22, 2009 11:17 am
Reply with quote

Thanks a lot. The above solution perfectly matches for my requirement. But i like to know why it has to be multiplied by 10000 instead of 100 . Could you please explain? icon_rolleyes.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri May 22, 2009 12:28 pm
Reply with quote

You're welcome. icon_smile.gif
Quote:
Signed free format. Decimal digits (0-9) are extracted from right to left
to form a number value. A character of – or ) found within the field will
cause the value to be treated as a negative number. All other nondecimal
digit values in the field are ignored. A maximum of 31 digits
can be provided. When more than 31 digits are found in the field, the
leftmost digits will be ignored.

Code:
//SYSIN    DD  *                                     
    SORT FIELDS=COPY                                 
    OUTREC FIELDS=(1:+100,MUL,                       
                   1,7,SFF,DIV,                       
                   9,7,SFF,EDIT=(STTT),SIGNS=(+,-,,))
Quote:
Output
Code:
+050
+100
-102
Here you dont get the decimal values in the output as it does n't take the decimal points in input into account. You'll get the same output no matter the decimal point is there or not. Hence even if you try to format it with an STTT.TT, you'll only be able to reformat the output you got in first step. So if you need more decimal values, you'll have to suffix with more zeroes. Did I confuse you?
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top