View previous topic :: View next topic
|
Author |
Message |
ankur.sanghi
New User
Joined: 05 Apr 2006 Posts: 3
|
|
|
|
Hi,
I need to put
Code: |
PUT 'DAZDQ.RL3P.SUBCON.WIPAUDT(0)' |
including single-quotes in a variable. If i enclose this string with double quotes, it gives me a compile error.
pl help asap |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Code the variable as:
Code: |
01 PUTVAR pic x(80) value
'PUT ''DAZDQ.RL3P.SUBCON.WIPAUDT(0)'''.
|
(double the apostrophe inside the variable)
Dave |
|
Back to top |
|
|
ankur.sanghi
New User
Joined: 05 Apr 2006 Posts: 3
|
|
|
|
I tried doubling the quotes Davidatk, That one doesn't work.
Yesterday, someone suggested that I should use Figurative Constant QUOTE in place of '
Haven't tried that yet. More expert responses plz... |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
If you were using COBOL 390, you could just use the double quotes.
But as it does not work with your version of COBOL, you have to code:
Code: |
01 PUTVAR.
03 FILLER PIC X(4) VALUE 'PUT '.
03 FILLER PIC X VALUE QUOTE.
03 FILLER PIC X(28) VALUE 'DAZDQ.RL3P.SUBCON.WIPAUDT(0)'.
03 FILLER PIC X VALUE QUOTE.
|
In case you have a lot of constants like this, there is an easier way: use CBL QUOTE (instead of the default which is CBL APOST)
This option switches the use of quotes and double-quotes. Then you will be able to write:
Code: |
01 PUTVAR PIC X(80) VALUE "PUT 'DAZDQ.RL3P.SUBCON.WIPAUDT(0)'".
|
Note that in this case you will also have to change all constants:
Code: |
MOVE "ankur.sanghi" TO USER-NAME.
DISPLAY "HELLO, " USER-NAME.
|
|
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
David's suggestion is correct. You didn't show us what you did. You told us what you THINK you did.
Try it, you'll like it.
PS. If the rest of your shop uses single quotes to encase variables, I'd advise you not to use doubles. Unless you want to become famous. |
|
Back to top |
|
|
|