03 HTML-MSG PIC X(18) VALUE "<p ALIGN="center">".
As you see, there is a conflict with the quotations marks used as value
delimiters and the quotations marks used as text characters.
Is there a solution to this problem ?
Many thanks to all of you !
Luc Mertes (luc.m...@village.uunet.be)
Example Usage:
03 HTML-MSG PIC X(18)
VALUE "<p ALIGN=" & QUOTE & "center" & QUOTE & ">".
-Steve Kalemkiewicz
Sure, use double quotes for an embedded quotation mark. For example,
if you want a literal with the value: >He said "Boo!"<, you can use:
"He said ""Boo!"""
Remember to count only one character for the "". An empty nonnumeric
literal is "" and a single quotation mark is """". Why would you use
an empty nonnumeric literal? For the continuation of a nonnumeric
literal that ends in column 72, leaving no room for the terminating
quotation mark. For example:
column 72 v
01 PIC X(??) VALUE "ABCDEFGHIJKLMNOPQRSTUVWXYZ
- "".
:-)
--
Judson McClendon ju...@bellsouth.net
Sun Valley Systems http://www.sunvaley.com
"For God so loved the world that He gave His only begotten Son, that
whoever believes in Him should not perish but have everlasting life."
Using the '&' symbol as a concatenation operator is not part of the
COBOL 85 standard. However, Merant/Micro Focus, Fujitsu and probably
other compilers support it as an extension, as does X/Open.
The rule for any mainframe software I've ever used (as best as I can
remember, anyway) is that you code two quotes to represent one in the
defined text string, e.g.,:
5 field pic x(12) value 'bill''s quote'.
There are 13 characters between the outer quotes, but the two quotes
between "bill" and "s" count as one.
HTH,
Bill Lynch
Student exorcise: Display both types and the word "quote" on the same line.
Luc Mertčs wrote in message <81phgl$d7s$1...@nickel.uunet.be>...
>I presently work with Fujistsu Cobol 85 and I would like to put quotation
>marks in the VALUE of some literals, such as :
>
>03 HTML-MSG PIC X(18) VALUE "<p ALIGN="center">".
>
>As you see, there is a conflict with the quotations marks used as value
>delimiters and the quotations marks used as text characters.
>
>Is there a solution to this problem ?
>
It is true that some compilers permit those forms. But using ' instead
of " for a string separator is not in the COBOL 85 standard, and using
QUOTE as a string delimiter is specifically prohibited (see 4.2.2.2.3
paragraph 5). QUOTE may only be used as a figurative constant. :-)
This is important to understand because "concatenation expressions" (as
shown in the original post) are considered (in the next Standard - where
they are well defined) as TWO separate literals. Therefore, a
COPY/REPLACING =="ABC"== by something will match "AB" on one line with a
continuation of "C" on the next line - but will NOT match "AB" & "C".
(which is 3 separate text words).
Also speaking of the next Standard (and a feature that SOME but not all
vendors already support)...
The next Standard (and some vendors as a current extension) allow you to
use either the single or double quote as the nonumeric literal delimeter
- in fact you can use them BOTH in the same program. (Older IBM
compilers didn't allow this - but new ones do. Micro Focus has allowed
this for years). Therefore, if you want to move "' (double quote
followed by single quote) to a field in the next Standard, you will be
able to code:
Move '"' & "'" to aField
Of course you could also code this as
Move """" & '''' to afield
In article <E8Y%3.13272$5q.1...@news3.mia>,
"Judson McClendon" <ju...@bellsouth.net> wrote:
> Luc Mertčs wrote:
> >I presently work with Fujistsu Cobol 85 and I would like to put
quotation
> >marks in the VALUE of some literals, such as :
> >
> >03 HTML-MSG PIC X(18) VALUE "<p ALIGN="center">".
> >
> >As you see, there is a conflict with the quotations marks used as
value
> >delimiters and the quotations marks used as text characters.
> >
> >Is there a solution to this problem ?
>
> Sure, use double quotes for an embedded quotation mark. For example,
> if you want a literal with the value: >He said "Boo!"<, you can use:
>
> "He said ""Boo!"""
>
> Remember to count only one character for the "". An empty nonnumeric
> literal is "" and a single quotation mark is """". Why would you use
> an empty nonnumeric literal? For the continuation of a nonnumeric
> literal that ends in column 72, leaving no room for the terminating
> quotation mark. For example:
> column 72 v
> 01 PIC X(??) VALUE "ABCDEFGHIJKLMNOPQRSTUVWXYZ
> - "".
>
> :-)
> --
> Judson McClendon ju...@bellsouth.net
> Sun Valley Systems http://www.sunvaley.com
> "For God so loved the world that He gave His only begotten Son, that
> whoever believes in Him should not perish but have ever
Sent via Deja.com http://www.deja.com/
Before you buy.