Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to get output values with decimal using Syncsort V(1.2)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to get output values with decimal using Syncsort V(1.2)
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: 2285
Location: @my desk

PostPosted: Thu May 21, 2009 9:25 pm    Post subject:
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    Post subject: Reply to: How to get output values with decimal using Syncso
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: 2285
Location: @my desk

PostPosted: Fri May 22, 2009 12:28 pm    Post subject:
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    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 Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Where is output from PARM ABEXIT (SNA... packerm CA Products 3 Thu Sep 28, 2017 4:06 pm
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts it is possible output a SET value fro... Martylin JCL & VSAM 5 Fri Sep 22, 2017 7:08 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us