IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to define a string with quotes


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Harshavardhana

New User


Joined: 09 Mar 2007
Posts: 7
Location: India

PostPosted: Fri Apr 13, 2007 8:44 pm
Reply with quote

Hi Friends,

I want to store the ' "WELCOME" ' into a WORKING-STORAGE variable.
Suppose, the variable is

01 VAR-1 PIC X(10).

How can I store with the quotes included?
Back to top
View user's profile Send private message
Harshavardhana

New User


Joined: 09 Mar 2007
Posts: 7
Location: India

PostPosted: Fri Apr 13, 2007 8:49 pm
Reply with quote

Another Example :

I want to store the following string:

BMEDPAC= 'HQDEVA.BASE.' into the following variable.

01 VAR-1 PIC X(32).

How to do this. Please help.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Apr 13, 2007 8:56 pm
Reply with quote

Quote:
MOVE QUOTES TO VAR-1(1:1) VAR-1(10:1)
MOVE 'WELCOME' TO VAR-1(2:9)


But there should be a more elegant way!
I will search a bit now icon_smile.gif
Back to top
View user's profile Send private message
sudhaaa

New User


Joined: 24 Mar 2005
Posts: 51

PostPosted: Fri Apr 13, 2007 9:10 pm
Reply with quote

Can you try with below move statements (Worked for me)

77 A PIC X(20).
77 B PIC X(20).

MOVE '"WELCOME"' TO A

MOVE '''HQDEVA.BASE.''' TO B
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Apr 13, 2007 9:14 pm
Reply with quote

Hello,

You could also to this with the STRING statement.
Back to top
View user's profile Send private message
sudhaaa

New User


Joined: 24 Mar 2005
Posts: 51

PostPosted: Fri Apr 13, 2007 9:34 pm
Reply with quote

Can I request you to post a bit of code for this.. it will be helpful for me
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sat Apr 14, 2007 12:14 am
Reply with quote

Hello,

I believe this will do what you want:

Code:

MOVE SPACES TO VAR-1.
STRING QUOTE
      'HQDEVA.BASE.'
       QUOTE DELIMITED BY '\'
  INTO VAR-1.


Good luck and let us know if this does not do what you need icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts Help in extracting data between doubl... DFSORT/ICETOOL 5
Search our Forums:

Back to Top