Page 1 of 1

Query reg moving values to particular records!

PostPosted: Wed Nov 24, 2010 8:28 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. If the validation fails it must copy the record without replacing anything.So each and every record should be there in output.

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 11:42 pm
by Frank Yaeger
You can use a DFSORT job like the following to do what you asked for:

//S1 EXEC PGM=SORT                                       
//SYSOUT DD SYSOUT=*                                     
//SORTIN DD *                                             
xxx00000xxxxxxxxxxxxx                                     
yyy00001yyyyyyyyyyyyy                                     
zzz00000zzzzzzzzzzzzz                                     
//SORTOUT DD SYSOUT=*                                     
//SYSIN DD *                                             
   OPTION COPY                                           
   INREC IFTHEN=(WHEN=(4,5,CH,EQ,C'00000'),               
     OVERLAY=(1:C'123'))                                 


SORTOUT would have:

12300000xxxxxxxxxxxxx 
yyy00001yyyyyyyyyyyyy 
12300000zzzzzzzzzzzzz 


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

Re: Query reg moving values to particular records!

PostPosted: Fri Nov 26, 2010 1:22 pm
by maandi
Hi Frank,

Thanks for your suggestion. The code you mentioned worked out well.

Regards,
Maandy.