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 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: 2284
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: 2284
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 Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 4 Tue Jul 25, 2017 12:12 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts JES2 doesn't honor the priority of th... Aron Lendvai JCL & VSAM 8 Thu Jun 29, 2017 1:41 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm


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