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
 
how to add or subtract by using the sort jcl

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
girish_firke

New User


Joined: 29 Aug 2006
Posts: 3

PostPosted: Tue Jan 16, 2007 7:55 pm    Post subject: how to add or subtract by using the sort jcl
Reply with quote

Hi icon_biggrin.gif ,
I am sorting a file on the basis of employee id. and i want to perform some arithmatic operation on the salary field. I want to subtract salary from 99999999. I know we can do this by using OUTREC. but i dont know exact syntax of that. Can anybody help me on this.

thanks!!! icon_lol.gif
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 Jan 16, 2007 8:24 pm    Post subject:
Reply with quote

Quoth the Fine DFSORT manual:
Quote:
arexp,edit or (arexp),edit
Specifies that the edited result of an arithmetic expression is to appear in the reformatted OUTFIL output record. An arithmetic expression takes the form:
term,operator,term<,operator,...> where:
. term is a field (p,m,f), a parsed field (%nn,f), or a decimal constant (+n or −n). See p,m,f under p,m,f,edit for details on the fields you can use. See deccon under deccon,edit for details on the decimal constants you can use.
. operator is MIN (minimum), MAX (maximum), MUL (multiplication), DIV (division), MOD (modulus), ADD (addition) or SUB (subtraction).

Ex:
OUTREC=(5:C?% REDUCTION FOR ?,21,8,C? IS ?, ((11,6,ZD,SUB,31,6,ZD),MUL,+1000),DIV,11,6,ZD, EDIT=(SIIT.T),SIGNS=(+,-))
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: Tue Jan 16, 2007 10:03 pm    Post subject:
Reply with quote

girish,

The syntax for the DFSORT INREC statement would be something like this:

Code:

  INREC FIELDS=(...,+99999999,SUB,p,m,f,TO=ZD,LENGTH=n,...)


where p,m,f is the starting position, length and format of your salary field and n is the length of the output field. You didn't give enough details for me to be more specific.

For more information, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG20/2.4.10?DT=20060615173822

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
PadmaPriya
Warnings : 2

New User


Joined: 19 Jan 2007
Posts: 3
Location: Bangalore

PostPosted: Mon Jan 22, 2007 2:14 pm    Post subject: SORT with SUMMING step
Reply with quote

Hi

My report has 3 fields and I want the output to be sorted based on the first field and find the total sum of the next field for all the records.

I want them to be done using any SORT or SYNCSORT.


In SYNCSORT, I want to know abt the SUM FIELDS= in detail.


Can anyone help in this regard?
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: Mon Jan 22, 2007 9:41 pm    Post subject:
Reply with quote

Quote:
I want them to be done using any SORT or SYNCSORT.


What do you mean by "any SORT"? Do you mean DFSORT?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
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
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm

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