gnucobol-users
[Top][All Lists]
Advanced

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

Re: [open-cobol-list] opening files without hardcoding full paths ?


From: Brian Tiffin
Subject: Re: [open-cobol-list] opening files without hardcoding full paths ?
Date: Wed, 7 Aug 2013 14:45:27 -0400

On 8/5/13, Kevin Monceaux <address@hidden> wrote:
> On Mon, Aug 05, 2013 at 01:14:47PM -0400, Patrick wrote:
>
>> Then I can hard code all the file paths into this directory but have the
>> real files elsewhere.
>
> You can also use environment variables instead of hard coding file paths.
> If you have something like:
>
>        SELECT DataFile ASSIGN TO "DataFile" ...
>
> in a program, you can set the environment variable DD_DataFile to the full
> path to the file.  That can make it a little easier to switch between test
> and production files.  I wonder if that variable name syntax was inspired
> by
> MVS JCL DD statements.
>
>
>
> --
>
> Kevin
> http://www.RawFedDogs.net
> http://Lassie.RawFedDogs.net
> http://www.WacoAgilityGroup.org
> Bruceville, TX
>
> What's the definition of a legacy system? One that works!
> Errare humanum est, ignoscere caninum.
>

Filename handling is also controlled in the .conf files found in
/usr/local/share/open-cobol/config/

deault.conf has
# If yes, file names are resolved at run time using environment variables.
# For example, given ASSIGN TO "DATAFILE", the actual file name will be
#  1. the value of environment variable `DD_DATAFILE' or
#  2. the value of environment variable `dd_DATAFILE' or
#  3. the value of environment variable `DATAFILE' or
#  4. the literal "DATAFILE"
# If no, the value of the assign clause is the file name.
#
# Value: `yes', `no'
filename-mapping: yes

The .conf files are a pretty interesting read, with lots of cool hints
on how robust the compiler is.

Cheers,
Brian


reply via email to

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