Page 1 of 1

Replace all but multiple times in a single record

Posted: Thu Dec 20, 2012 11:16 pm
by maincobol225
Hi All,

I have gone thru the examples sited in this forum but I am encountering an issue while trying to replace multiple strings in a single record. I mean..

AAAAAAAAAAABBBBBBBBBBBBCCCCCCCCCC

Can anyone help me out in replacing A's with X and C's with Z thru fileaid batch procesing?

Any other approach is also fine....my motive is to replace multiple values in a PS file ... Please Dont suggest C ALL :)

Posted: Fri Dec 21, 2012 2:29 am
by DikDude
Try something like:
$$DD01 COPYALL IF=(1,EQ,C'AAAAAAAAAAA'),REPL=(148,C'XXXXXXXXXX')
$$DD01 COPYALL IF=(1,EQ,C'CCCCCCCCCCC'),REPL=(148,C'ZZZZZZZZZZ')

Not tested as i don't have FileAid available today.

You could also do this using FINDREP with your sort product.

Posted: Fri Dec 21, 2012 7:13 am
by maincobol225
Thanks for the quick response.

Yesterday before posting the question here I tried the same thing it said end of file reached...it executed only the first $$DD01statement :(

Anyway, I will give a try again....

Posted: Fri Dec 21, 2012 9:42 am
by maincobol225
I tried it again...
Dd01 COPY EDITALL=(282,3,C'CA',C'PA')
DD01 COPY EDITALL={536,7,C'447911',C'421130')

In spool I see only firat statement got executed and returned input file already at EOD ...skipping DD01......any one help me out in dealing multiple replace in a single PS file on a single record

Posted: Fri Dec 21, 2012 10:11 pm
by DikDude
Instead of multiple COPYALL statements, you might try one COPYALL and multiple IF statements.

Posted: Sun Dec 30, 2012 8:42 am
by chaat
$$dd01 COPYALL IN=0,
***
*** this will replace starting in column 1 for the length
*** of the entire input record
***
EDITALL=(1,0,C'A',C'X'), CHANGE ALL 'A' TO 'X'
EDITALL=(1,0,C'C',C'Z'), CHANGE ALL 'C' TO 'Z'
DUMP=10,OUT=0


note that you can include comments much like jcl any line starting with an asterisk is a comment line.

also note that the commands after the $$DD01 can not start in column 1 ( the editor for the bbs is truncating leading spaces in my reply ).

Chuck H.