Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: String (") search and replace(') using SAS or JCL steps
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Tue Jun 24, 2008 4:10 am    Post subject:
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    Post subject: Reply to: String (") search and replace(') using SAS or
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    Post subject: Reply to: String (") search and replace(') using SAS or
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    Post subject: string ("") serach and replace by (")
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    Post subject: Re: string ("") serach and replace by (")
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    Post subject: to replace ("") by (")
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: 755
Location: Germany

PostPosted: Fri Jul 25, 2008 5:25 pm    Post subject:
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

Site Director


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

PostPosted: Sun Jul 27, 2008 9:09 am    Post subject:
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 Moderator


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

PostPosted: Fri Aug 08, 2008 2:56 am    Post subject:
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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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    Post subject: Reply to: String (") search and replace(') using SAS or
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    Post subject: Reply to: String (") search and replace(') using SAS or
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: 8593
Location: Back in jolly old England

PostPosted: Mon Aug 11, 2008 7:11 pm    Post subject: Re: Reply to: String (") search and replace(') using SA
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 Moderator


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

PostPosted: Mon Aug 11, 2008 10:00 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts RC 20 for Address ISPEXEC "ISRED... pkmurali CLIST & REXX 3 Sun Apr 16, 2017 11:30 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us