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 define a string with quotes

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to define a string with quotes
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    Post subject:
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: 685
Location: Earth

PostPosted: Fri Apr 13, 2007 8:56 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Apr 13, 2007 9:14 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Sat Apr 14, 2007 12:14 am    Post subject:
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    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
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts VSAM define for large file jerryte JCL & VSAM 9 Wed Oct 05, 2016 1:51 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm
No new posts Which function does the Ampersand (&a... Andi1982 PL/I & Assembler 3 Wed Aug 24, 2016 2:05 pm


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