Re: append a string to another

From: Chuck Stevens (charles.stevens_at_unisys.com)
Date: 12/21/04


Date: Tue, 21 Dec 2004 08:34:27 -0800

Something like

    string function trim (thelongstring, right), function trim (in-data,
right) ...

is being proposed as part of the Any-Length Elementary Item proposal for the
2008 standard. The second argument may also be "left", in which case it's
*leading* spaces that don't figure into the result, and in the absence of a
second argument, both leading and trailing spaces are omitted.

In 2002 COBOL, writing one or more user-defined functions to accomplish
these tasks should be straightforward.

    -Chuck Stevens

"JJ" <jj@nospam.com> wrote in message
news:87GdnTmvY7WSGVrcRVn-3Q@comcast.com...
> As others have said, find the last non-space of the strings, then use the
> STRING verb with reference modifiers denoting the content length of each
> variable.
>
> This is a case where it sure would be nice to have a DELIMITED BY TRAILING
> SPACES clause, such as:
>
> string thelongstring, in-data delimited by trailing spaces .....
>
> (don't try this - it doesn't exist - I'm just suggesting that it would be
> nice to have)
>
>
>
> "Tobias Neubert" <t1@s-neubert.net> wrote in message
> news:ea2fae75.0412200727.c44265f@posting.google.com...
> > Hi,
> >
> > I am a Cobol newby, trying to write a first program which reads in a
> > textfile, line by line and concatenates the lines to one big string. I
> > do the following:
> >
> > ------------
> > string thelongstring delimited by size
> > In-Data delimited by size
> > into thelongstring
> > ---------------
> >
> > thelongstring is 32000 bytes long, In-Data is 80 bytes long. It seems
> > that cobol appends In-Data at the very end of thelongstring, that is
> > after the last space at position 32000.
> >
> > Please tell me how it is possible to solve my problem.
> >
> > Thanks and Kind Regards,
> > Tobias Neubert
>
>



Relevant Pages

  • "pack" perldoc error?
    ... and unpacking with a line like: ... So as long as the $text variable doesn't have any trailing spaces ... Win32-ActiveState) that "Z" will always null-terminate a string, ... length of the field to pack it in. ...
    (comp.lang.perl.misc)
  • Re: Trying to use STRING
    ... I've always wanted a "DELIMITED BY TRAILING SPACES" clause for this purpose ... I am using STRING ... STRING QUOTE WS-NAME QUOTE "," ... QUOTE WS-ADD1 QUOTE "," ...
    (comp.lang.cobol)
  • Re: Ada Recursion with strings
    ... will get rid of all leading and trailing spaces from S. ... Can I suggest a stronger emphasis on the Ada packages providing ... procedure PUT(TO: out STRING; ...
    (comp.lang.ada)
  • RE: [PHP] Query question
    ... Dollars to donuts says your 'date' (which is really a string) has some ... Or, you use RIGHTas I believe MySQL always automatically removes ... trailing spaces in VARCHAR columns. ...
    (php.general)
  • Re: append a string to another
    ... > I am a Cobol newby, trying to write a first program which reads in a ... line by line and concatenates the lines to one big string. ... > string thelongstring delimited by size ... > that cobol appends In-Data at the very end of thelongstring, ...
    (comp.lang.cobol)