View previous topic :: View next topic
|
Author |
Message |
gbalaa_007
New User
Joined: 24 May 2007 Posts: 10 Location: Los angeles, CA
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Geetha B
New User
Joined: 24 Nov 2007 Posts: 12 Location: chennai
|
|
|
|
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 |
|
|
gbalaa_007
New User
Joined: 24 May 2007 Posts: 10 Location: Los angeles, CA
|
|
|
|
ALTSEQ works fine..
Thanks a lot Geetha .... |
|
Back to top |
|
|
Benoy
New User
Joined: 25 Jul 2008 Posts: 10 Location: Chennai
|
|
|
|
Can we use Altseq to replace "" by ".
Thanks
Benoy |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
Benoy
New User
Joined: 25 Jul 2008 Posts: 10 Location: Chennai
|
|
|
|
My requirement is not replace ("") with (").
Can we use ICEMAN for it??? |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi !
You could use old IPOUPDATE-Ulitity, installed in every IBM environment. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Benoy
New User
Joined: 25 Jul 2008 Posts: 10 Location: Chennai
|
|
|
|
Thank U ,It worked!!! |
|
Back to top |
|
|
gbalaa_007
New User
Joined: 24 May 2007 Posts: 10 Location: Los angeles, CA
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|