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

Hi ,
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.

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

Posted: Tue Jan 16, 2007 8:24 pm Post subject:

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=(+,-))

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.

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: