Skip to Content

Remapping a file name hard-coded in a SELECT statement using an external variable.

Estimated Reading Time: 1 Minutes

If your program uses a hard-coded value for the data file name, you can define an alternate name as an alias in your configuration file.  To do this, add the following two properties to your configuration file:

iscobol.file.env_naming=true
iscobol.<assign_to_name>=<new-name>
  • <assign_to_name>: The physical file name specified in the ASSIGN TO clause of the SELECT statement.
  • <new_name>: The physical name of the file you want to access.

Important: The name must be normalized:

  • Replace any hyphens (-) with underscores (_).
  • Use lowercase letters.
    For example, a file called New-Name should be referenced as new_name in the variable.
Suppose your program includes the following SELECT statement:

 

       select FILE1 assign to "file-1"
           organization indexed
           access dynamic
           record key f1-key
           status file-status
           .
To use an alternate file name, such as new-file-1, add these properties to your configuration file:

 

iscobol.file.env_naming=true
iscobol.file_1=new-file-1

If the "assign to" contains a full or a relative path name, the path needs to be specified in your property.

For example:  

       select FILE1 assign to "subdir/file-1"
           organization indexed
           access dynamic
           record key f1-key
           status file-status
           .
iscobol.file.env_naming=true
iscobol.subdir/file_1=subdir/new-file-1
Remapping a file name hard-coded in a SELECT statement using an external variable.