View previous topic :: View next topic |
Author |
Message |
vini Intermediate
Joined: 12 Jan 2004 Posts: 240 Topics: 48 Location: Maryland
|
Posted: Thu Nov 16, 2006 7:20 pm Post subject: Quotation mark within an Alphanumeric Constant? |
|
|
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 |
|
|
vini Intermediate
Joined: 12 Jan 2004 Posts: 240 Topics: 48 Location: Maryland
|
Posted: Thu Nov 16, 2006 7:24 pm Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Nov 16, 2006 8:21 pm Post subject: |
|
|
vini,
try enclosing in double quotes.
Code: |
WSH-HLL PIC X(05) VALUE "'XXXX".
|
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Nov 16, 2006 8:26 pm Post subject: |
|
|
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 |
|
|
vini Intermediate
Joined: 12 Jan 2004 Posts: 240 Topics: 48 Location: Maryland
|
Posted: Fri Nov 17, 2006 1:13 am Post subject: |
|
|
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 |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Fri Nov 17, 2006 5:57 am Post subject: |
|
|
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 |
|
|
vini Intermediate
Joined: 12 Jan 2004 Posts: 240 Topics: 48 Location: Maryland
|
Posted: Fri Nov 17, 2006 2:33 pm Post subject: |
|
|
Cogito, Just what I needed to know .. makes it simple!! Thanks |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Sat Nov 18, 2006 11:57 pm Post subject: |
|
|
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 |
|
|
|
|