Page 1 of 1

Assigning values to fields using SORT

Posted: Fri Jul 29, 2011 10:53 am
by rcgmf

I have a requirement to assign certain values to a field in the output file depending on the values in another field in the input file in JCL. Here is an example:
Input fields: InField1, InField2, InField3
Output fields: OutField1, OutField2, OutField3
Condition is: If InField1='0', OutField2='A'. If InField1='1', OutField2='B'

I want to achieve this using a SORT program. Is there any way to do this?
Please help.


Posted: Fri Jul 29, 2011 9:58 pm
by Frank Yaeger
There are several ways to do this with DFSORT.

One way is with DFSORT IFTHEN clauses. For example, if infield1/outfield1 is in position 1 and infield2/outfield2 11 is in position 11, you could use these DFSORT control statements:

Code: Select all

   INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'0'),OVERLAY=(11:C'A')),
If you need more specific help, give more details about what you're trying to do.

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: ... g3T7000080

Posted: Tue Aug 02, 2011 9:24 am
by rcgmf
Thanks Frank. That was exactly what I was looking for.