gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] tree data, embedding a language or string interpol


From: Michael Anderson
Subject: Re: [open-cobol-list] tree data, embedding a language or string interpolation?
Date: Fri, 15 Mar 2013 17:24:14 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130221 Thunderbird/17.0.3

On 03/15/2013 04:41 PM, Patrick wrote:
So for instance with "<title> $title </title>" the variable $title is
inserted into the string, no need for concatenation.

If Cobol does not support this, I was thinking of embedding another
language that supports it.

With openCOBOL there is a function called "substitute"

Move "This is my Title" To MyTitle.
Move Substitute(<title> $title </title> ,"$title",mytitle) To MyHtml.

So MyHtml should contain "<title> This is my Title </title>

Other functions exclusive to openCOBOL that may also help with parsing in general are:
Concatenate and Trim.

So if MyTitle is defined as Pic X(64), then you may want to:

Move "This is my Title" To MyTitle.
Move Substitute(<title> $title </title> ,"$title",Trim(mytitle)) To MyHtml.

Code examples require cobc -ffunctions-all

Use Concatenate to append MyHtml to your html output buffer.

Then
display Trim(htmlbuffer) *> nulls are not trimmed.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]