Page 1 of 1

Update selective records

PostPosted: Fri Jan 23, 2009 3:30 am
by akanchu
Hi,
Hope I posting in the right section of the forum.
I have multiple type of records in a input file. Each of them is identified by a id in position 5.

I have to add 30 spaces to only a particular type of record , while keeping the rest of the records as they are.
e.g.
Input
----+----1----+----2----+----3----+----4----+----5----+-
aaaa10aaaaaaaaaaaaaaaaaaaaa NJaaaaaaaaaaaaaaaaaaa
aaaa20aaaaaaaaaaaaaaaaaaaaa residenceaaaaaaaaaaaa
bbbb10bbbbbbbbbbbbbbbbbbbbb PAbbbbbbbbbbbbbbbbbbb
bbbb15bbbbbbbbbbbbbbbbbbbbb scranton   bbbbbbbbb
bbbd20bbbbbbbbbbbbbbbbbbbbb residencebbbbbbbbbbbb
cccc10ccccccccccccccccccccc PHccccccccccccccccccc
cccc20ccccccccccccccccccccc columbus   ccccccccc
cccc20ccccccccccccccccccccc residencecccccccccccc
dddd10ddddddddddddddddddddd WVddddddddddddddddddd
dddd20ddddddddddddddddddddd residenced1f1d1dddddd


O/P
----+----1----+----2----+----3----+----4----+----5----+-
aaaa10aaaaaaaaaaaaaaaaaaaaa NJaaaaaaaaaaaaaaaaaaa
aaaa20aaaaaaaaaaaaaaaaaaaaa residenceaaaaaaaaaaaa
bbbb10bbbbbbbbbbbbbbbbbbbbb PAbbbbbbbbbbbbbbbbbbb
bbbb15bbbbbbbbbbbbbbbbbbbbb scranton         bbbbbbbbb
bbbd20bbbbbbbbbbbbbbbbbbbbb residencebbbbbbbbbbbb
cccc10ccccccccccccccccccccc PHccccccccccccccccccc
cccc20ccccccccccccccccccccc columbus         ccccccccc
cccc20ccccccccccccccccccccc residencecccccccccccc
dddd10ddddddddddddddddddddd WVddddddddddddddddddd
dddd20ddddddddddddddddddddd residenced1f1d1dddddd
"Code"d for readability.

As seen above when record 15 is found I need to put spaces after that city. the position of that space is fixed say position 40.
Can this be achieved by any tool not via any COBOL/EZTRV code.

Thanks in advance.

Re: Update selective records

PostPosted: Fri Jan 23, 2009 3:56 am
by Frank Yaeger
Yes, you're posting in the right section, but your description vs example is difficult to follow.

You say you have an id in position 5, but then you seem to be looking for '15'. So is the id in positions 5-6?

You seem to show spaces added for the '15' record and one of the '20' records (columbus), but not the other '20' records. Is that just a mistake? Or do you want something done for the '20' records?

You say you want to add 30 spaces, but it doesn't look like you've added 30 spaces in your output example. You say "the position of that space is fixed say position 40" - does that mean you want to insert the spaces starting at position 40, or does it mean something else?

If you want to "insert" spaces for the '15' records starting at position 40, you can use DFSORT control statements like this:

    OPTION COPY
    INREC IFTHEN=(WHEN=(5,2,CH,EQ,C'15'),
       BUILD=(1,39,30X,40,n)


where n is the number of original characters you want to move over. Be sure that your resulting record length is the same as the LRECL.

If you need more help with this, you need to do a better job of explaining what you want and show an example that matches your description.

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/sof ... tmpub.html

Re: Update selective records

PostPosted: Fri Jan 23, 2009 7:26 am
by akanchu
Thanks Frank.

I agree there was mistake in the position, I accept, got a little lost in the positioning and the column part with the font used. Will be better next time.
yes the id check was to be done for position 5-6.
it was a mistake, 15 record is the one that needed the spaces.. not 20.
space was to be inserted in pos 40 onwards.


The example in the reply that you gave was very helpful.

Thank you very much for understanding my crappy explanation and replying with just what I wanted.

Thanks.

Re: Update selective records

PostPosted: Fri Jan 23, 2009 7:50 am
by dick scherrer
Hello,

Good to hear it is working - thank you for letting us know :)

got a little lost in the positioning and the column part with the font used. Will be better next time.
At the top of the Reply Editor panel is a series of "Tags" - one of them is the "Code" tag. Using the Code tag will greatly improve readability and preserves alignment (Code is fixed font whereas the editor is not). If you copy/paste code, jcl, utllity control statements or data, Code will be quite useful.

There is also Preview (below the editor panel) which will let you see your post as it will appear on the forum rather than how it appears in the editor. When you are satisfied with how your post appears, Submit (make sure you Submit or the work will be lost - i've done that a few times :? ).