Replace all but multiple times in a single record

In this Mainframe Forum - You can post your queries on FILE-AID tool

Moderators: Anuj Dhawan, Moderator Group

Post Reply
maincobol225
Member
Posts: 3
Joined: Thu Dec 20, 2012 11:03 pm

Replace all but multiple times in a single record

Post by maincobol225 » Thu Dec 20, 2012 11:16 pm

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 :)

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Fri Dec 21, 2012 2:29 am

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.
Have a good one

maincobol225
Member
Posts: 3
Joined: Thu Dec 20, 2012 11:03 pm

Post by maincobol225 » Fri Dec 21, 2012 7:13 am

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....

maincobol225
Member
Posts: 3
Joined: Thu Dec 20, 2012 11:03 pm

Post by maincobol225 » Fri Dec 21, 2012 9:42 am

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

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Fri Dec 21, 2012 10:11 pm

Instead of multiple COPYALL statements, you might try one COPYALL and multiple IF statements.
Have a good one

chaat
Member
Posts: 20
Joined: Sun Apr 18, 2010 11:51 pm
Location: St. Cloud, Minnesota, USA

Post by chaat » Sun Dec 30, 2012 8:42 am

$$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.
Chuck Haatvedt

email --> clastnameatcharterdotnet

(replace lastname, at, dot with appropriate
characters)

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others