IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Finding and replacing a string in a VB file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Fri Mar 28, 2008 3:11 pm
Reply with quote

Can anyone help me in finding and replacing a string in a VB file.

Recfm =71 and the string is of four chars. It may occur in any position of the file, which I should replace with another 4 char value.


Sam.
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Fri Mar 28, 2008 4:25 pm
Reply with quote

i tried the below code, but it was able to change only 1 occurance. I changed the command to "f all" and "c all " .. but that doesnt help.. can sum one help pls...

Code:
                                                                                         
//STEP0005 EXEC PGM=IKJEFT01                               
//SYSTSPRT DD   SYSOUT=*                                   
//SYSTSIN  DD   *                                         
EDIT 'XXX.YYY.ZZZ' TEXT NONUM               
TOP                                                       
F  'AAA'                                               
C  'AAA' 'BBB'                                       
END SAVE                                                   
/*                                                         


icon_sad.gif
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Mar 28, 2008 4:34 pm
Reply with quote

Please try this,
Code:
C ALL 'AAA' 'BBB'

Instead of,
Code:
F  'AAA'                                               
C  'AAA' 'BBB'
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Fri Mar 28, 2008 4:36 pm
Reply with quote

Tried that too ... dint help...
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Fri Mar 28, 2008 4:46 pm
Reply with quote

IF I dont use "F" before "C" ... even the 1 replacement is also not done...but if i use "F" and them "C" it replaces 1 occurance... tried "F all" and "C all" ..not use... icon_sad.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Mar 28, 2008 4:55 pm
Reply with quote

Search the forum for examples of how it should be done, as I have recently posted an ISPF edit macro in either the ISPF or REXX forums.
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Fri Mar 28, 2008 4:59 pm
Reply with quote

Tested code. Very easy with fileaid

Code:
//STEP0100 EXEC PGM=FILEAID                 
//SYSPRINT DD SYSOUT=*                     
//SYSOUT   DD SYSOUT=*                     
//DD01     DD DSN=your Input File,DISP=SHR
//DD01O    DD DSN=Same Input File,DISP=SHR
//SYSIN    DD *                             
$$DD01 UPDATE EDIT=(1,0,C'ABCD',C'XYZA')     
/*                                         



Note: This is case sensitive.
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Fri Mar 28, 2008 5:49 pm
Reply with quote

Thanks a lot shrivatsa . icon_smile.gif
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Fri Mar 28, 2008 5:54 pm
Reply with quote

jus one more change i need to implement... can i hv a or within this file aid edit option...
I need to find a or b or c or d and replace it with e.

Even if any one if them is found i need to replace it with 'e'.

pls suggest..
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Mar 28, 2008 6:19 pm
Reply with quote

Somewhere along the way, I would've thought someone might take a minute and enter the HELP CHANGE command from within EDIT to find the proper syntax. This would've worked just fine:

Code:

//STEP0005 EXEC PGM=IKJEFT01                               
//SYSTSPRT DD   SYSOUT=*                                   
//SYSTSIN  DD   *                                         
EDIT 'XXX.YYY.ZZZ' TEXT NONUM               
TOP
C * 99999999 =AAA=BBB= ALL
END SAVE                                                   
/*
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Mon Mar 31, 2008 3:05 pm
Reply with quote

thx for the reply. It did work...
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Mon Mar 31, 2008 4:04 pm
Reply with quote

I have another query,

can I have a AND statement in the below mentioned steps,

my requirement was changed,

I need replace all the occurance of the values say a b c and d with e.

if any one of them is present in the file it should be replaced...
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Mon Mar 31, 2008 4:59 pm
Reply with quote

i used the below JCL and it worked....

//SYSIN DD *
$$DD01 UPDATE EDIT=(1,0,C'YYYY',C'////'),
EDIT=(1,0,C'XXXX',C'****')


icon_smile.gif
Back to top
View user's profile Send private message
shobvid

New User


Joined: 03 Apr 2008
Posts: 11
Location: India

PostPosted: Thu Apr 03, 2008 1:51 pm
Reply with quote

Iam also interested in modifying multiple members in a PDS in one shot but Iam unable to locate the fileaid load module, we have only file manager, FMNMAIN. Please suggest.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Aug 15, 2008 12:35 am
Reply with quote

Note that DFSORT now has a find and replace function called FINDREP, available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008). For complete details on the new FINDREP function and the other new functions available with PTF UK90013, see:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top