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
 

 

Sum a number with a decimal point using syncsort

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

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Mar 28, 2007 1:28 pm    Post subject: Sum a number with a decimal point using syncsort
Reply with quote

Hi,

How can I sum a numeric field that has a sign and a decimal point using syncsort . For example, if my input file has:
251.91
241.23
289.72
231.78
-651.52
I want my output file to have:
Code:
363.12
Back to top
View user's profile Send private message

Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Wed Mar 28, 2007 10:44 pm    Post subject:
Reply with quote

I think you'll ned to reformat (using OUTREC?) to exclude the decpt, then sum that file, then reformat again to reinsert it.

Your example does not show decpt alignment, though, as your negative number's decpt is not aligned. In that case - much more complicated.

Is your example good?
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Thu Mar 29, 2007 9:54 am    Post subject:
Reply with quote

Hi Phrzby,

Its aligned only negetive sign in first byte for last record & others record are starting from second byte .

Would u please provide sort card for this?
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Thu Mar 29, 2007 10:01 am    Post subject:
Reply with quote

Ekta,

Why dont you try Sum a number with a decimal point from SORTTRCK pdf. Your requirement and the example provided by Frank in PDF are similar.

Let us know, if you need the PDF file.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Thu Mar 29, 2007 11:20 am    Post subject:
Reply with quote

Murali ,

I think u have not read my post i need the solution for syncsort not for dfsort

Hope i am clear
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Mar 30, 2007 2:47 am    Post subject:
Reply with quote

Hi Ekta,

If i understand correctly, the decimal point will always be in the same place?

If so, i believe you can do it in 2 passes - one pass with an inrec that copies the file skipping that data position and a second pass to sum the numbers without the decimal.

Given the same requirement, i would write a little COBOL program to do what i need - FWIW. Seems like so many of these "little" things, undergo "scope creep" and the new requirement definition needs real code.

Good Luck icon_smile.gif
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Fri Mar 30, 2007 7:10 pm    Post subject:
Reply with quote

I agree with Dick.

Use the right software tool so as your needs expand, you can change naturally, and those who inherit the system from you have a chance at knowing what's going on.

If you must use SORT, at least comment it (col1 = '*') with why and what you are doing.
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 SEQNUM and FI fields. nartcr SYNCSORT 5 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am


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