ALIAS()

 

 

Purpose

ALIAS changes the file of reference.
 

Syntax

ALIAS (filename,alternate-filename)
 

Operation

filename is the existing file of reference. This must be the name of an internal file enclosed in double quote marks (“), or a variable containing the name of an internal file.

Alternate-filename is the required file of reference.  This must be the name of an external file (including path) enclosed in double quote marks (“), or a variable containing the name of an external file (including path).  The file name will be appended with “.pro" if the extension is not present.
 

Remarks

filename and alternate-filename are validated at runtime NOT at gentime. Every reference of filename in the function will actually access alternate-filename.  Full path names are permitted.

This routine must be used in Function In logic.  It is not possible to re-ALIAS during the execution of a function.

Allows use of a codeset parameter to specify various language codesets.
 

Example

ALIAS (“FILE1",“\DATA\FILE2.PRO")

ALIAS (“FILE1",$NEWREF)

To map the file WRCUST to a table of the same name but in a different logical database:

    ALIAS ("WRCUST","%DB%WRCUST")

Note the following is not valid:

    ALIAS("WRCUST","%BETTY%")

To map a file from a logical database to the default database, changing the table name accessed:

   ALIAS("WRCUST","%SQLDEFAUL%CUSTOMER")
 

ALIAS() restriction for SQL Transactions

It is important to note there is an ALIAS() restriction for SQL Transactions. If the three restriction conditions outlined below occur in sequential order and the caller (parent) PROIV Function attempts to re-reference or re-read an aliased SQL file, then the caller PROIV Function retrieves closed or available SQL cursors, which were created or closed by the called Global Function, for reuse. These are retrieved from the PROIV’s internal SQL cursor cache structure.

Restriction Conditions

  1. The SQL file is aliased, referenced or read in the caller PROIV Function.

  2. SQL transaction commit is applied in the caller PROIV Function.

  3. The caller PROIV Function executes or calls a Global Function that does not alias the relevant SQL file.

Outcome

The caller PROIV function processes incorrect or unexpected SQL records. This is because the SQL recordset is a result of referencing an unaliased SQL file.

Solution

To ensure the caller PROIV Function correctly re-references or re-reads the aliased SQL file, the called Global function must be executed or returned at the appropriate Logic Event in the Timing Cycle, before the aliased SQL file is referenced or read in the caller function.

Comment on this topic

Topic ID: 520220

 
 
 

Table of Contents

Index

Glossary

-Search-

Back