bug-gnucobol
[Top][All Lists]
Advanced

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

Re: [Bug-GnuCOBOL] WHEN-COMPILED is a reserved word, but isn't supported


From: Simon Sobisch
Subject: Re: [Bug-GnuCOBOL] WHEN-COMPILED is a reserved word, but isn't supported
Date: Thu, 14 Dec 2017 21:20:13 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

Hi Martin,

as Edward wrote you can apply the minimal fix outlined in the mentioned
link to your 2.2 version.

For convenience - libcob/common.c, around line 2883

     cb_time.day_of_week = one_indexed_day_of_week_from_monday
(tmptr->tm_wday);
-    cb_time.day_of_year = tmptr->tm_yday;
+    cb_time.day_of_year = tmptr->tm_yday + 1;
     cb_time.hour = tmptr->tm_hour;

as Edward (and the NEWS file and the announcement) mentioned there was a
change in GnuCOBOL 2.2 how reserved words, registers and intrinics where
handled. For the "common" used dialects *all* are enabled.

For convenience and explanation quoting the NEWS file

>   The GnuCOBOL compiler tries to limit both the feature-set and reserved words
>   to the specified compiler when the "strict" dialects are used.
>   COBOL sources compiled with these dialects are therefore likely to compile
>   with the specified compiler and vice versa: sources that were compiled on
>   the specified compiler should compile without any issues with GnuCOBOL.
> 
>   With the "non-strict" dialects GnuCOBOL will activate the complete
>   feature-set where it doesn't directly conflict with the specified dialect,
>   including reserved words and GnuCOBOL specific extensions.
>   COBOL sources compiled with these dialects therefore may work only
>   with GnuCOBOL. COBOL sources may need a change because of rich feature-set
>   and reserved words in GnuCOBOL, otherwise offending words may be removed
>   by `-fno-reserved=word`.
>   COBOL-85, X/Open COBOL, COBOL 2002 and COBOL 2014 are always "strict".


The register is available in most dialects, WHEN-COMPILED is only
disabled in some strict dialects (including cobol85-2014) - I assume you
use one of these and specify it on all command lines?

If yes I suggest to reconsider if you really want to use this subset (+
WHEN-COMPILED), if yes either add -fregister=WHEN-COMPILED flag to your
cobc command line or add it to the corresponding ".words" file found in
config directory (and do so for every update).
In most cases it is more reasonable in general to do not specify -std at
all.

Simon

Am 14.12.2017 um 20:24 schrieb Edward Hart:
> Hi Martin,
> 
> The WHEN-COMPILED issue is due to changes in how GnuCOBOL handles
> dialects. You can re-enable the WHEN-COMPILED register with the
> -fregister=WHEN-COMPILED flag.
> 
> The ACCEPT FROM DAY issue
> <https://sourceforge.net/p/open-cobol/bugs/469/> has now been fixed and
> will be available in the soon-to-be-released GnuCOBOL 3.0 release candidate.
> 
> Edward
> 
> On 14 December 2017 at 18:38, Martin Ward <address@hidden
> <mailto:address@hidden>> wrote:
> 
> 
>     "WHEN-COMPILED" used to work with the last version of open-cobol that
>     I used (open-cobol-code-862-branches-gnu-cobol-2.0.zip)
>     but version gnucobol-2.2 gives the error:
> 
>     error 'WHEN-COMPILED' is a reserved word, but isn't supported
> 
>     Is there a later test version which has this implemented?
> 
> 
>     Also, ACCEPT xxx FROM DAY YYYYDDD is giving different results:
>     the day is off by one.
> 
>     The result for today (14th December 2017) should be:
> 
>     2017348
> 
>     but instead is:
> 
>     2017347
> 
>     -- 
>                             Martin
> 
>     Dr Martin Ward | Email: address@hidden <mailto:address@hidden>
>     | http://www.gkc.org.uk
>     G.K.Chesterton site: http://www.gkc.org.uk/gkc | Erdos number: 4
> 
> 



reply via email to

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