Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
girish_firke

New User

Joined: 29 Aug 2006
Posts: 3

 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. thanks!!!

William Thompson

Global Moderator

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

DFSORT Moderator

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

Posted: Tue Jan 16, 2007 10:03 pm    Post subject:

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.

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
Warnings : 2

New User

Joined: 19 Jan 2007
Posts: 3
Location: Bangalore

 Posted: Mon Jan 22, 2007 2:14 pm    Post subject: SORT with SUMMING step 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?
Frank Yaeger

DFSORT Moderator

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

Posted: Mon Jan 22, 2007 9:41 pm    Post subject:

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

What do you mean by "any SORT"? Do you mean DFSORT?
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am How to Generate JCL using Sort naveen katkuri DFSORT/ICETOOL 7 Tue Mar 13, 2018 3:50 pm Need better approach to create a sort... Vamshi Veludandi DFSORT/ICETOOL 8 Thu Mar 08, 2018 5:59 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us