Page 1 of 1

Query reg moving values to particular records

PostPosted: Wed Nov 24, 2010 4:43 pm
by maandi
Hi All,

I have to move some values to particular field in my input record based on some condition. Is it possible to do that in SORT JCL?

E.g I have a input record like (xxx00000xxxxxxxxxxxxx)

I have to perform the validation : If (Start position(4),length(5)) = zeros, then copy the entire record with repacing ''123" in first 3 bytes.

So my output will look like (12300000xxxxxxxxxxxxxx).

Is it possible to do this in SORT JCL or any other utilities?


Thanks,
Maandy.

Re: Query reg moving values to particular records!

PostPosted: Wed Nov 24, 2010 5:03 pm
by maandi
maandi wrote:Hi All,

I have to move some values to particular field in my input record based on some condition. Is it possible to do that in SORT JCL?

E.g I have a input record like (xxx00000xxxxxxxxxxxxx)

I have to perform the validation : If (Start position(4),length(5)) = zeros, then copy the entire record with repacing ''123" in first 3 bytes.

So my output will look like (12300000xxxxxxxxxxxxxx).

Is it possible to do this in SORT JCL or any other utilities?


Thanks,
Maandy.
Hi All...

In the above query i forgot to include one more condition....

If this validation : If (Start position(4),length(5)) = zeros, FAILS then it should copy the record without replacing anything.

Re: Query reg moving values to particular records!

PostPosted: Wed Nov 24, 2010 10:29 pm
by skolusu
maandi,

The following DFSORT JCL will give you the desired results

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                       
XXX00000XXXXXXXXXXXXX                                 
XXXAAAAAXXXXXXXXXXXXX                                 
XXXCCCCCXXXXXXXXXXXXX                                 
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                     
  INREC IFTHEN=(WHEN=(4,5,ZD,EQ,0),OVERLAY=(1:C'123'))
//*


The output from this job is
12300000XXXXXXXXXXXXX
XXXAAAAAXXXXXXXXXXXXX
XXXCCCCCXXXXXXXXXXXXX

Re: Query reg moving values to particular records!

PostPosted: Fri Nov 26, 2010 1:02 pm
by maandi
Hi Kolusu,

Thanks a lot.. Your code worked out well.
Since i am new to JCL, it helped me a lot.

Could u please elaborate on ZD(Zonned decimal). What does it mean and how we could use that?

Thanks,
Mandy

Re: Query reg moving values to particular records!

PostPosted: Tue Nov 30, 2010 12:06 am
by Frank Yaeger
For details on DFSORT's various formats (such as CH, ZD, PD, BI, FI, etc), see:

http://publibz.boulder.ibm.com/cgi-bin/ ... 0630155256

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:

http://www.ibm.com/support/docview.wss? ... g3T7000080