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

String (") search and replace(') using SAS or JCL steps


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

New User


Joined: 24 May 2007
Posts: 10
Location: Los angeles, CA

PostPosted: Tue Jun 24, 2008 1:50 am
Reply with quote

Can any one tell me ,
how to replace dblqts(") to singleqoute(') in a file using JCL steps or SAS.
I have many " s want to replace all of them to ' single quote.

for ex: NM1*77*1*lastname* first "Name"***24*123456789
to NM1*77*1*lastname* first 'Name'***24*123456789


*** my company not allow us to Use REXX in prod batch.

thanks !!
Bala
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Jun 24, 2008 4:10 am
Reply with quote

SAS code:

X = TRANSLATE(DATALINE, '"' '''') ;

NOT tested but should work -- if not, using the hex values '7F'X and '7D'X in the function should do it.
Back to top
View user's profile Send private message
Geetha B

New User


Joined: 24 Nov 2007
Posts: 12
Location: chennai

PostPosted: Wed Jun 25, 2008 3:22 pm
Reply with quote

Assuming your record length is 80 and the position of double quotes is random,you can use altsq feature of sort

Check if the below code satisfies your req

Code:
//S1    EXEC  PGM=ICEMAN,COND=(4,LT,SETCOND)             
//SYSOUT    DD  SYSOUT=*                                 
//SORTIN    DD *                                         
NM1*77*1*lastname* first "Name1"***24*123456789         
NM2*78*1*lastname* first "Name2"***24*123456789         
NM3*78*1*lastname* "Name3"***24*1234567"name4"           
//SORTOUT   DD SYSOUT=*                                 
//SYSIN     DD  *                                       
  OPTION COPY                                           
* SET UP ALTSEQ TABLE FOR TRAN=ALTSEQ.                   
* X'7F' = ".  X'7D' = '                                 
  ALTSEQ CODE=(7F7D)                                     
* USE TRAN=ALTSEQ TO CHANGE '$' (X'5B') TO ' ' (X'40'). 
  OUTREC FIELDS=(1,80,TRAN=ALTSEQ)                       
/*                                                       


output
NM1*77*1*lastname* first 'Name1'***24*123456789     
NM2*78*1*lastname* first 'Name2'***24*123456789     
NM3*78*1*lastname* 'Name3'***24*1234567'name4'     
Back to top
View user's profile Send private message
gbalaa_007

New User


Joined: 24 May 2007
Posts: 10
Location: Los angeles, CA

PostPosted: Thu Jun 26, 2008 9:49 pm
Reply with quote

ALTSEQ works fine..

Thanks a lot Geetha ....
Back to top
View user's profile Send private message
Benoy

New User


Joined: 25 Jul 2008
Posts: 10
Location: Chennai

PostPosted: Fri Jul 25, 2008 4:34 pm
Reply with quote

Can we use Altseq to replace "" by ".
Thanks
Benoy
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Jul 25, 2008 4:41 pm
Reply with quote

Benoy wrote:
Can we use Altseq to replace "" by ".
Thanks
Benoy

Altseq replaces a single character with a different character, it will not replace 2 characters with 1 character.
Back to top
View user's profile Send private message
Benoy

New User


Joined: 25 Jul 2008
Posts: 10
Location: Chennai

PostPosted: Fri Jul 25, 2008 4:46 pm
Reply with quote

My requirement is not replace ("") with (").

Can we use ICEMAN for it???
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Fri Jul 25, 2008 5:25 pm
Reply with quote

Hi !

You could use old IPOUPDATE-Ulitity, installed in every IBM environment.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Jul 27, 2008 9:09 am
Reply with quote

Hello Benoy,

Quote:
My requirement is not replace ("") with (").
Then why did you post that as the requirement?

It appears you have asked how do to exactly that both here and in your "other" duplicate topic. That topic also mentions the same replacement.

If replacing 2 double-quote characters with 1 double-quote character is not what you want, you need to clearly explain what you really do want to do. If you use the "Code" tag, the info you present will be much more readable.
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 08, 2008 2:56 am
Reply with quote

With z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can now use FINDREP to replace " with ' like this:

Code:

  OPTION COPY
  INREC FINDREP=(IN=C'"',OUT=C'''')

or

  OPTION COPY
  INREC FINDREP=(IN=X'7F',OUT=X'7D')


or "" with " like this:

Code:

    OPTION COPY
    INREC FINDREP=(IN=C'""',OUT=C'"')


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
Benoy

New User


Joined: 25 Jul 2008
Posts: 10
Location: Chennai

PostPosted: Fri Aug 08, 2008 9:23 am
Reply with quote

Thank U ,It worked!!!
Back to top
View user's profile Send private message
gbalaa_007

New User


Joined: 24 May 2007
Posts: 10
Location: Los angeles, CA

PostPosted: Mon Aug 11, 2008 6:48 pm
Reply with quote

Hi,
I am getting error when in use FINDREP, Could you please share me the sample JCL, so that i can correct the DD cards.

i need to replace all "&" to "AND" .

Thansk!!
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Aug 11, 2008 7:11 pm
Reply with quote

gbalaa_007 wrote:
Hi,
I am getting error when in use FINDREP, Could you please share me the sample JCL, so that i can correct the DD cards.
i need to replace all "&" to "AND" .
Thansk!!

I think that you would need to post your error messages.
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: Mon Aug 11, 2008 10:00 pm
Reply with quote

Quote:
I am getting error when in use FINDREP


You need z/OS DFSORT V1R5 PTF UK90013 (July, 2008) to use FINDREP. If you are using DFSORT (ICExxxs messages) and don't have this PTF, ask your System Programmer to install it (it's free). If you are using Syncsort (WERxxxs messages), you can't use FINDREP since only DFSORT supports it.

Quote:
Could you please share me the sample JCL, so that i can correct the DD cards. i need to replace all "&" to "AND" .


The DFSORT job would be:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INREC FINDREP=(IN=C'&',OUT=C'AND')
/*
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top