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
 

 

SYNCSORT to add the records of same file

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

New User


Joined: 09 Jun 2008
Posts: 8
Location: Mumbai

PostPosted: Tue May 12, 2009 6:23 pm    Post subject: SYNCSORT to add the records of same file
Reply with quote

I have a number of records in my Input file as

100
500
400
300

How to add these records and write the total in output file.
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue May 12, 2009 7:33 pm    Post subject:
Reply with quote

Have you looked at the SUM operand?
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Tue May 12, 2009 9:14 pm    Post subject:
Reply with quote

Here is a SyncSort for z/OS job that will produce your requested output:
Code:

//STEP1 EXEC PGM=SORT               
//SYSOUT  DD SYSOUT=*                             
//SORTIN  DD *                                       
100                                                 
500                                                 
400                                                 
300                                                 
//SORTOUT DD SYSOUT=*                               
//SYSIN   DD *                                     
   SORT FIELDS=COPY                                 
   OUTFIL TRAILER1=(TOT=(1,3,ZD)),NODETAIL,REMOVECC 
/*     
Back to top
View user's profile Send private message
Yash19

New User


Joined: 09 Jun 2008
Posts: 8
Location: Mumbai

PostPosted: Wed May 13, 2009 2:14 pm    Post subject:
Reply with quote

Thank you very much for the response.
The sort card that you mentioned works fine, however how to add if the number conatins desimal values.

eg.
100.12
500.45
400
300

how to make sum of these numbers.
Thanks you for your help.
Back to top
View user's profile Send private message
Yash19

New User


Joined: 09 Jun 2008
Posts: 8
Location: Mumbai

PostPosted: Wed May 13, 2009 2:26 pm    Post subject:
Reply with quote

William Thompson wrote:
Have you looked at the SUM operand?



Yes I checked with Sum fields=(Startting Position, Length,ZD)
however its not working, if sum oprand is anything different please guide me on this.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 743
Location: Germany

PostPosted: Wed May 13, 2009 4:50 pm    Post subject:
Reply with quote

Hi !

SUM descrition:

The SUM statement can be used to summarize data, based on the SORT statement. One record will be produced for each unique key present in the input. If numeric fields are specified for summation, those fields will be summed up. The SYNCSORT software does not guarantee unique records if numeric fields are required to be summed up. Whenever there is an overflow of a numeric field, more than one record may be created.
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: Wed May 13, 2009 8:28 pm    Post subject:
Reply with quote

Hello,

Numbers with embedded decimal points are not ZD. . .

That format is SFF.
Back to top
View user's profile Send private message
Yash19

New User


Joined: 09 Jun 2008
Posts: 8
Location: Mumbai

PostPosted: Fri May 15, 2009 5:05 pm    Post subject:
Reply with quote

Thank you ,
with SFF it worked, but one concern is that if I am taking the input as flat file then I am getting the correct total, however if I use 'genaeration data set' as input file its giving me a incorrect value, kindly guide me if we have solution on this.
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 May 15, 2009 7:49 pm    Post subject:
Reply with quote

Hello,

There should be no difference if both the flat file and the gdg have the same attributes and content. . .

Showing some the input and the results from both processes may help us help you. Also, post the jcl sort control statements, and any informational messages generated by the runs (include message ids).
Back to top
View user's profile Send private message
Yash19

New User


Joined: 09 Jun 2008
Posts: 8
Location: Mumbai

PostPosted: Fri May 15, 2009 8:37 pm    Post subject:
Reply with quote

dick scherrer wrote:
Hello,

There should be no difference if both the flat file and the gdg have the same attributes and content. . .

Showing some the input and the results from both processes may help us help you. Also, post the jcl sort control statements, and any informational messages generated by the runs (include message ids).


Hi.

904.00
378.65

Input data in both cases is as above

1) Using flat file as an Input file I am geting corret output as 1282.65
2) Using GDS as an input file I am getting 1.27 in an output file and when I open that output file gets following message.

"Truncation warning. The data you are editing is variable length data with at least one record that ends with a blank. Saving the data will result in
removal of any trailing blanks from all records. You can issue the PRESERVE ON command if you don't want the blanks removed. "

I am using follwing sort card:

//SYSIN DD *
SORT FIELDS=COPY
OUTFIL NODETAIL,
TRAILER1=(TOTAL=(1,6,SFF,EDIT=(TTTT.TT)))
/*

Please guide me and let me know if you want any more details.
Thanks a lot for your support so far .
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri May 15, 2009 11:18 pm    Post subject:
Reply with quote

dick scherrer
wrote:
post the jcl sort control statements, and any informational messages generated by the runs (include message ids).
Yash19 wrote:
let me know if you want any more details
Yash,

You need to post all the requested details before going into "more details".
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: Sat May 16, 2009 1:25 am    Post subject:
Reply with quote

Hello,

I suspect the gdg may be vb and the qsam file is fb. . . icon_confused.gif

To repeat:
Quote:
There should be no difference if both the flat file and the gdg have the same attributes and content. . .


It is surely a shame that people looking to solve their problems will not post requested info. . . icon_neutral.gif
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am


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