EXAMINE with Replace

Hi,

I am facing a strange situation where the EXAMINE replace is not working for me.

Situation:

I have a work file. I want to read the records and in each record I want to replace the ‘"’ (Double quote) with SPACE and then write the record to an output file.

I coded as

EXAMINE #STRING FOR ‘"’ REPLACE WITH ’ ’

When I see the output file, I do not find the ‘"’ s replaced with SPACE. The double quotes are as it was in the input file.

Is there any specific reason for this.

The same statement is working for single quote, or any other symbol.

Little urgent please.

Thanks,
Mishra

Natural translates double quotes into single quotes during compilation. So you are replacing single quotes with your statement.

You got 2 possibilities:

  1. turn the Natural-Parameter TQ off (not recommended, because it has an effect to all other programs)

  2. use the hex-value for the double quote
    Example for ASCII-code:

define data local
01 #string (A20)
end-define
compress "test" 
  H'22' /* double quote on Windows
  "test" into #string leaving no
display #string
EXAMINE #STRING FOR H'22' REPLACE WITH ' ' 
display #string
end

… for Mainframe you have to use other hex-values of course.

Hi Matthias,

Nice to see your reply. In fact one of my friend is facing this problem in his installation. I have tried the same code (what I have posted first here)in my shop and it is working absolutely fine.

I guess this double quote is reserved for some purpose in his installation.

Thanks,
Mishra :slight_smile: