Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file

Google
 
Web mainframegurukul.com

SORT SUM

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
SRI123
Member


Joined: 12 Aug 2009
Posts: 15

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Aug 12, 2009 12:37 pm    Post subject: SORT SUM Reply with quote

I want to sum the amounts that are at position 10,12,ZD. I want to sum all the amounts. And out should contain only the total amount. I tried with the below statement, but I'm not getting the sum, it is only displaying all the records in the output. Please help me.

OPTION COPY
SUM FIELDS=(10,12,ZD)
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

arcvns
Member


Joined: 30 May 2009
Posts: 28
Location: Chennai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Aug 12, 2009 1:30 pm    Post subject: Reply with quote

SRI123,

Welcome to the forums. Try this one.
Code:
//STEP1  EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DSN = Input  file                         
//SORTOUT  DD DSN = Output file                         
//SYSIN DD *                                             
  OPTION COPY                                           
  OUTFIL REMOVECC,NODETAIL,                             
         TRAILER1=('TOTAL=',TOT=(10,12,ZD,M11,LENGTH=12))

_________________
Arun
Back to top
View user's profile Send private message Yahoo Messenger
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
SRI123
Member


Joined: 12 Aug 2009
Posts: 15

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Aug 12, 2009 3:44 pm    Post subject: Reply with quote

Thank you arcvns for qucik reply. This is working fine. My field declaration is S9(9)V99. So the out put is displaying without decimal. Can I get with decimal out put with sign like +123.45 or -123.45. And does this sysntax is valid for packed data also? for packed I'm not getting correct output. Field declaration is S9(9).

Last edited by SRI123 on Wed Aug 12, 2009 4:29 pm; edited 1 time in total
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
arcvns
Member


Joined: 30 May 2009
Posts: 28
Location: Chennai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Aug 12, 2009 4:25 pm    Post subject: Reply with quote

Change your OUTFIL statement like this to display the sign as well. AFAIK s9(9)v99 would occupy only 11 bytes.
Code:
 OPTION COPY                                                       
 OUTFIL REMOVECC,NODETAIL,                                         
 TRAILER1=('TOTAL=',TOT=(10,11,ZD,EDIT=(STTTTTTTTT.TT),SIGNS=(+,-)))

_________________
Arun
Back to top
View user's profile Send private message Yahoo Messenger
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
SRI123
Member


Joined: 12 Aug 2009
Posts: 15

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Aug 12, 2009 4:36 pm    Post subject: Reply with quote

Thank you.
And does this sysntax is valid for packed data also? for packed I'm not getting correct output. Field declaration is S9(9).
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
arcvns
Member


Joined: 30 May 2009
Posts: 28
Location: Chennai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Aug 12, 2009 5:12 pm    Post subject: Reply with quote

SRI123,
Quote:
And does this sysntax is valid for packed data also?
No, it's NOT. As per your original problem, your input file has ZD data. The solution can vary based on the field format.
Quote:
for packed I'm not getting correct output
The solution provided was for ZD input. Now what exactly is your field format? Is it ZD? Or PD? What is its length? How does it look like? If possible provide some sample data.
_________________
Arun
Back to top
View user's profile Send private message Yahoo Messenger
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
SRI123
Member


Joined: 12 Aug 2009
Posts: 15

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Aug 12, 2009 5:21 pm    Post subject: Reply with quote

FIELD format is ==> SV99 PD 15 2
data is like this
05
1C

06
5C
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Aug 12, 2009 8:35 pm    Post subject: Reply with quote

I believe that data is equivalent to a 2-byte PD field starting at position 15 interpreted as a sd.dd value.

A total for that value could overflow sd.dd so you would probably want to display it as a larger values, something like sdddd.dd depending on what you want the output value to look like. As an example, you could use these DFSORT statements:

Code:

  OPTION COPY                                                       
  OUTFIL REMOVECC,NODETAIL,                                         
    TRAILER1=('TOTAL=',TOT=(15,2,PD,EDIT=(SIIIT.TT),SIGNS=(+,-)))   

_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
SRI123
Member


Joined: 12 Aug 2009
Posts: 15

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Aug 13, 2009 10:09 am    Post subject: Reply with quote

Thank you Frank
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jan 25, 2016 10:27 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Page 1 of 1



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-4564.html