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
 
summing using sort card

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

New User


Joined: 24 Mar 2008
Posts: 29
Location: mumbai

PostPosted: Thu May 28, 2009 12:46 pm    Post subject: summing using sort card
Reply with quote

Hi everybody,

I need to calculate the sum of some specific field. the field position is 587 and length is 5. it is in packed decimal format. and the file is fixed block.

I tried with this below sort card

//step01 exec pgm=sort
//sortin dd dsn=xxx
//sortout dd dsn=yyyy
//sysin dd *
SORT FIELDS=COPY
SUM FIELDS=(587,5,PD)
//

But the output file is not giving any sum value.
please help me how to achieve it.
and i want to see the sum value in zd format.
Back to top
View user's profile Send private message

bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Thu May 28, 2009 12:48 pm    Post subject:
Reply with quote

For SORT FIELDS=COPY, SUM FIELDS will not work.Give some postion in the sort field and try it..
Back to top
View user's profile Send private message
rajeshwarch

New User


Joined: 24 Mar 2008
Posts: 29
Location: mumbai

PostPosted: Thu May 28, 2009 12:56 pm    Post subject:
Reply with quote

Thanks Bepen

I need to calculate sum for all records...!!

then what should be my sort card
Back to top
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Thu May 28, 2009 1:42 pm    Post subject:
Reply with quote

I dont know the exact reason.But what i seen that if you give sort fields=copy the SUM FIELDS will not work.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu May 28, 2009 2:08 pm    Post subject:
Reply with quote

rajeshwarch wrote:
Thanks Bepen

I need to calculate sum for all records...!!

then what should be my sort card
Search the forum, you will find many working examples for summation. If you are stuck up somewhere post the output from your job and the expected output. Somebody here might be able to help
Back to top
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Thu May 28, 2009 5:26 pm    Post subject:
Reply with quote

Hi rajeshwarch,

Code:
//step01 exec pgm=sort
//sortin dd dsn=xxx
//sortout dd dsn=yyyy
//sysin dd *
SORT FIELDS=(1,1,CH,A)
SUM FIELDS=(587,5,PD)
//
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Thu May 28, 2009 6:39 pm    Post subject:
Reply with quote

Bipin Peter,

you are assuming that the file is already sorted and has no dups in col 1.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu May 28, 2009 9:01 pm    Post subject:
Reply with quote

Rajesh,

If you just want to display the total of the PD field as a ZD field, you can use DFSORT control statements like this:

Code:

  OPTION COPY                         
  OUTFIL REMOVECC,NODETAIL,           
    TRAILER1=(TOT=(587,5,PD,TO=ZD))


If you want something else, be more specific about what you want.
Back to top
View user's profile Send private message
rajeshwarch

New User


Joined: 24 Mar 2008
Posts: 29
Location: mumbai

PostPosted: Fri May 29, 2009 7:00 pm    Post subject:
Reply with quote

Hi frank,

Thanks for ur reply. Its working fine. and I have a small doubt here. After converting PD to ZD, can we edit that ZD value using edit masks....!!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri May 29, 2009 9:11 pm    Post subject:
Reply with quote

You said
Quote:
i want to see the sum value in zd format

so I converted it to ZD. If you want an edited value, you can use an edit mask instead of TO=ZD. For example:

Code:

   TRAILER1=(TOT=(587,5,PD,M10))
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 Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am
This topic is locked: you cannot edit posts or make replies. Need help how to pass the ESP variabl... Venkichaitu JCL & VSAM 12 Thu Nov 02, 2017 3:53 am
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am

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