Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

<<------------------ quotation marks in literals ---------------------->>

0 views
Skip to first unread message

Luc Mertès

unread,
Nov 27, 1999, 3:00:00 AM11/27/99
to
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 ?

Many thanks to all of you !

Luc Mertes (luc.m...@village.uunet.be)

Steven Kalemkiewicz

unread,
Nov 27, 1999, 3:00:00 AM11/27/99
to
There is a figurative constant QUOTES or QUOTE you should be able to use.

Example Usage:

03 HTML-MSG PIC X(18)
VALUE "<p ALIGN=" & QUOTE & "center" & QUOTE & ">".

-Steve Kalemkiewicz

Judson McClendon

unread,
Nov 27, 1999, 3:00:00 AM11/27/99
to
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 everlasting life."


Judson McClendon

unread,
Nov 27, 1999, 3:00:00 AM11/27/99
to
Steven Kalemkiewicz wrote:
>There is a figurative constant QUOTES or QUOTE you should be able to use.
>
>Example Usage:
>
>03 HTML-MSG PIC X(18)

> VALUE "<p ALIGN=" & QUOTE & "center" & QUOTE & ">".

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.

William Lynch

unread,
Nov 27, 1999, 3:00:00 AM11/27/99
to
"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.

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

donald tees

unread,
Nov 27, 1999, 3:00:00 AM11/27/99
to
You can quote can quote single quotes with doubles, and vice-versa.
For example: Picture x(10) value 'quote "this" unquote'.
There is also the word "quote" that can be used to quote both.
Display QUOTE this: "'" is an example of a double quotation mark containing
a single quotation mark QUOTE.

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 ?
>

Judson McClendon

unread,
Nov 28, 1999, 3:00:00 AM11/28/99
to
donald tees wrote:
>You can quote can quote single quotes with doubles, and vice-versa.
>For example: Picture x(10) value 'quote "this" unquote'.
>There is also the word "quote" that can be used to quote both.
>Display QUOTE this: "'" is an example of a double quotation mark
>containing a single quotation mark QUOTE.

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. :-)

wmk...@my-deja.com

unread,
Nov 29, 1999, 3:00:00 AM11/29/99
to
Judson,
Although your example is "valid" - your terminology is NOT. An "empty
nonumeric literal" is explicitly DISallowed in Standard COBOL - and
still will be in the next Standard. It is imprtant to consider the
ENTIRE nonnumeric literal (both continued line and continuation line) as
a SINGLE nonumeric literal. Therefore, although one line does have
nothing between the 1st and last quotation mark - this does not make the
entire literal "empty".

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.

0 new messages