Re: Odd GLOBALS behaviour?

Fernando Ortiz <[email protected]>
Newsgroups gmane.comp.lang.4gl.aubit.general
Message-ID <CAKK5tB3Du3K53KYa7PYSMM7rjfMj7Qr-21eqVUuoLgg=mw25gg@mail.gmail.com>
Hi

I had the same problem, my solution make one big globals.4gl merging all
the variables used in all executables.

To avoid confusion and changes in make files I created symbolic links in
each subdirectory to the 'unique merged one'

[cte@adela /]$ ll /u/*/src/*/globals.4gl
lrwxrwxrwx 1 cte corona   30 Oct  1  2014 /u/cont/src/lib/globals.4gl ->
/u/globals/src/lib/globals.4gl
lrwxrwxrwx 1 cte corona   30 Oct  1  2014 /u/cta/src/lib/globals.4gl ->
/u/globals/src/lib/globals.4gl
lrwxrwxrwx 1 cte corona   30 Oct  1  2014 /u/cte/src/lib/globals.4gl ->
/u/globals/src/lib/globals.4gl
lrwxrwxrwx 1 cte corona   30 Oct  1  2014 /u/flow/src/lib/globals.4gl ->
/u/globals/src/lib/globals.4gl
-rw-rw-rw- 1 cte corona 1584 Apr  7 15:05 /u/globals/src/lib/globals.4gl
lrwxrwxrwx 1 cte corona   30 Oct  1  2014 /u/mrp/src/lib/globals.4gl ->
/u/globals/src/lib/globals.4gl
lrwxrwxrwx 1 cte corona   30 Oct  1  2014 /u/nomi/src/lib/globals.4gl ->
/u/globals/src/lib/globals.4gl

I need all the global variables to be pre initialized ....

Regards,

On Wed, Apr 15, 2015 at 9:02 AM, Malcolm Perrior <
[email protected]> wrote:

>  Mike, sorry for the long delay – there’s been other things going on here
> and so on – but yes, this works fine. Our system is a pain because we have
> several hundred executables all in their own subdirectory and all with
> their own globals file; and all of these reference all our 15 or so shared
> libraries which all have their own globals file as well…whoever wrote this
> (and I could name names – they were pretty big in the bespoke insurance
> tools world), burning in hell’s too good for them!
>
>
>
> *From:* [email protected] [mailto:[email protected]] *On Behalf
> Of *Mike Aubury
> *Sent:* 25 March 2015 18:03
> *To:* Malcolm Perrior
> *Cc:* [email protected]
> *Subject:* Re: [Aubit4gl-discuss] Odd GLOBALS behaviour?
>
>
>
> The chances are that its referring to a different globals somewhere
> somehow.
>
> I think i've mentioned before that we try to auto initialize global
> variables to NULL but - this isn't 100% accurate when you define the same
> variable in multiple places.
>
>
>
> Try setting :
>
>
>
>    export NOGLOBALINIT=Y
>
>
>
> and then **recompile** all your programs/libraries
>
>
>
>
>
> The comment for that variable is  :
>
> "if GLOBALS are specified in more than one file - they can overwrite each
> other when being initialized. This shouldn't happen if you specify the
> second (or subsequent) globals via the GLOBALS "filename" - just if they
> are repeated in "GLOBALS .. END GLOBALS" in two separate files"
>
>
>
>
>
> Note - this is a compile time setting - it changes whats actually put in
> the generated .c files
>
>
>
>
>
> On 25 March 2015 at 16:59, Malcolm Perrior <
> [email protected]> wrote:
>
> Or have I not set some variable? I recall something about global
> persistence across links but can’t remember the context.
>
> NB this is under Ubuntu using an informix db and standard 4GL
>
>
>
> What we have is:
>
> A “.a” library built from several 4GLs in path
> “<path1>/<path2>/<path3>/base_lib/”. All the 4GLs in here refer to
> ../../globals.4gl. The makefile also refers to that globals.4gl
>
> A program built from a single 4GL in
> “<path1>/<path4>/<path5>/program.4gl”. The 4GL points to the same globals
> as the library, using “../../<path2>/globals.4gl” (as does its makefile).
>
>
>
> The globals file defines a global variable “prog_name”. When the program
> runs, it calls a get_general_variables() function in one of the library
> 4GLs which uses arg_val(0) to get the program name and populate the global.
>
> (Set font to COURIER to see the below diagram properly)
>
>
>
> <path1>
>
> |
>
> |------/<path2>/
>
> |      |       |--globals.4gl
>
> |      |
>
> |      |-------/<path3>/
>
> |                      |
>
> |                      /<base_lib>/
>
> |                                 |--lib_file_1.4gl
>
> |                                 |--lib_file_2.4gl
>
> |
>
> |------<path4>
>
> |       |
>
> |       |------/<path5>/
>
> |                      |--program_source.4gl
>
>
>
> The program 4GL also contains a “WHENEVER ERROR CALL get_error_action”;
> this refers to a function in a second library 4gl (in the same library
> path), which is called if anything untoward happens (NB it refers to the
> same ../../globals.4gl)
>
>
>
> This works on our current HP-UX host running informix 4gl.
>
>
>
> Under the linux proof-of-concept I’m running, the prog_name variable
> appears to be unset in the case of an error.
>
>
>
> I’ve proved this by inserting “DISPLAY prog_name” statements in each of
> the modules at appropriate times; it’s there in the library 4GL that sets
> it when the get_general_variable() function is called, it’s there in the
> program 4GL after that call, but if I force an error it is NULL in the
> error handler code.
>
>
>
> Do I dimly recall that there’s something I have to do to make global
> variables persistent in a4gl?
>
>
>
> *Malcolm Perrior*
>
> Database Administrator
>
> *T *020 8628 3618
>
>
>
> *Foresters*
>
> Foresters House,
>
> 2 Cromwell Avenue
>
> Bromley BR2 9BF
>
> foresters.com
>
>
>
>
>

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF

_______________________________________________
Aubit4gl-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.