MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Quotation mark within an Alphanumeric Constant?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Thu Nov 16, 2006 7:20 pm    Post subject: Quotation mark within an Alphanumeric Constant? Reply with quote

WORKING STORAGE

10 WSH-DATASET-NAME.
20 WSH-HLL PIC X(04) VALUE ''XXXX'.
20 FILLER PIC X(01) VALUE '.'.
......

WSH-HLL is giving compile error owing to the quotation mark inside the string constant .

Does anyone know of an acceptable way in COBOL to define a quote inside a constant ?
Back to top
View user's profile Send private message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Thu Nov 16, 2006 7:24 pm    Post subject: Reply with quote

WSH-HLL has been defined of length 5 and not 4..despite that the compile error message is 'UNTERMINATED STRING CONSTANT '. I understand this is not acceptable to the compiler for valid reasons but was wondering if there is an alternate way out..when there is a need to use these special characters.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Nov 16, 2006 8:21 pm    Post subject: Reply with quote

vini,

try enclosing in double quotes.
Code:

WSH-HLL PIC X(05) VALUE "'XXXX".


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Nov 16, 2006 8:26 pm    Post subject: Reply with quote

since your constant is x type; define your constant as a group item. Use elementary items to define your constant. Those parts of the constant that are alpha (or num) char put in one (or more elementary items) and those parts that are special char ('",;.) define as hex.


e.g. constant is: A;BCD.'"8
Code:

05  my-constant.
     10  filler     pic x(01) value 'A'.
     10  filler     pic x(01) value x'5E'.
     10  filler     pic x(03) value 'BCD'.
     10  filler     pic x(04) value x'4B7D7FF8'

_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Fri Nov 17, 2006 1:13 am    Post subject: Reply with quote

kolusu,
I will try that solution , not sure if that will work though.

Dick,
Where can I find the hex equivalents for the special characters ? Specifically I need for . and '. Your example is bit confusing in this regard.

Thanks
Vini
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Fri Nov 17, 2006 1:20 am    Post subject: Reply with quote

Vini,

Check this link and go down for the two links below and see if it can be helpful for you:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR10/APPENDIX1.3?DT=20020920180651
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Fri Nov 17, 2006 5:57 am    Post subject: Reply with quote

Vini,
You might also be interested in the figurative constant, QUOTE.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Fri Nov 17, 2006 2:33 pm    Post subject: Reply with quote

Cogito, Just what I needed to know .. makes it simple!! Very Happy Thanks
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Sat Nov 18, 2006 11:57 pm    Post subject: Reply with quote

You are welcome !
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group