Re: SDL-News: Using the content of a string as a literal

Subject: Re: SDL-News: Using the content of a string as a literal
From: Rick Reed TSE (
Date: Thu Aug 14 2003 - 09:44:03 GMT

Become an SDL Forum Society member <>
The originator of this message is responsible for its content.
-----From Rick Reed TSE <> to sdlnews -----

Margarita de Cabo Pérez at wrote on 14/08/2003

> dcl cadena charstring:='fieldOne';
> synonym fieldOne charstring:='XYZ';
> I need to obtain "XYZ" using variable cadena.

Dear Margarita,

Why don't you just write:

DCL cadena Charstring:=fieldOne;
SYNONYM fieldOne Charstring:='XYZ';

The definition order should not matter,
but it may read better if the SYNONYM comes first.

On the other hand reading:

> I have a charstring containing the name of a literal,
> and I want the value of that literal.

it seems you want a conversion function from a Charstring to the values of a
type defined as a literal set.

The array suggested by Anthony Weber <> may be the
most elegant way of doing this in SDL, but an SDL "array" of this type (a
sparse mapping from the unbounded type Charstring to another type) is likely
to be quite inefficient. If there are only a few possible literal values, it
may be more efficient just to write your own OPERATOR or PROCEDURE to do the
conversion. An OPERATOR of the literal set data type seem most appropriate.

Rick Reed -
Tel:+44 15394 88462 Mob.:+44 7970 50 96 50

BTW: Charstring should start with a capital letter. The latest versions of SDL are case sensitive. The predefined data types all start with capital letters. As a guideline - start user defined data types with capital letters for ASN.1 compatibility.

--End text from Rick Reed TSE <> to sdlnews --- For extra SDL Forum Society benefits join at <>

This archive was generated by hypermail 2a23 : Thu May 09 2013 - 16:05:49 GMT