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
 

 

how to put quotes in a string in a variable?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
ankur.sanghi

New User


Joined: 05 Apr 2006
Posts: 3

PostPosted: Wed Apr 05, 2006 8:57 pm    Post subject: how to put quotes in a string in a variable?
Reply with quote

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
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Apr 05, 2006 10:27 pm    Post subject: Re: how to put quotes in a string in a variable?
Reply with quote

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
View user's profile Send private message
ankur.sanghi

New User


Joined: 05 Apr 2006
Posts: 3

PostPosted: Thu Apr 06, 2006 8:21 am    Post subject:
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1228
Location: Israel

PostPosted: Thu Apr 06, 2006 5:19 pm    Post subject:
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Apr 07, 2006 7:28 am    Post subject:
Reply with quote

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. icon_evil.gif icon_lol.gif
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Translating Quotes Khadhar Basha CLIST & REXX 6 Tue May 09, 2017 11:52 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am


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