Page 1 of 1

Change specific fields in flat file

PostPosted: Fri Aug 02, 2013 7:05 pm
by vinu78
Hi,

My requirement is to change some of the field values in a fixed length flat file if specific condition is met.

In a Fixed length flat file of 300 bytes, if the first 4 bytes is 'TRK ' and 4 bytes from 9th col pos is 'M ' and 4 bytes from 13th col pos is '0200' and 4 bytes from 17th col pos is '0001', then change the first 4 bytes to SPACES, then have spaces in 4 bytes from 9th col pos, zeroes in 4 bytes from 13th col pos and zeroes in 4 bytes from 17th col pos.

All these mentioned fields are declared as characters.

Is it possible using SORT ? Please help.

Thanks
Vinu

Re: Change specific fields in flat file

PostPosted: Fri Aug 02, 2013 11:10 pm
by skolusu
vinu78 wrote:Is it possible using SORT ? Please help.Thanks
Vinu



Vinu78,

It is a simple task with a single IFTHEN statement.
//SYSIN   DD *                                 
  OPTION COPY                                   
  INREC IFTHEN=(WHEN=(01,4,CH,EQ,C'TRK ',AND,   
                      09,1,CH,EQ,C'M   ',AND,   
                      13,8,CH,EQ,C'02000001'), 
        OVERLAY=(1:4X,9:4X,13:8C'0'))           
//*   


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: Change specific fields in flat file

PostPosted: Wed Aug 07, 2013 3:51 am
by vinu78
Thanks Kolusu. It worked...:-)