VX/FPT - Translation of File Names
File Names in Migrated Code
Code to be migrated from one host to another usually contains file names written in the operating system format for the original host. These are written in INCLUDE statements , which are translated by VX/FPT when the code is migrated, and in OPEN and INQUIRE statements. The file names in OPEN and INQUIRE statements may be written as strings or may be character variables which are read or constructed by the code.
There are two options:
- To change the file name handling in the migrated code. At present, this must be carried out manually - it is not supported by VX/FPT.
- To keep the original file name handling, and to translate the names in the OPEN and INQUIRE statements. This is particularly appropriate if Sector7's VX/Tools are used to support a VMS to Linux/UNIX or NT migration, where the programs may use VMS logical names.
Translation by VX/FPT
Translation of file names is controlled by the VX/FPT commands:
% insert function to translate file names % insert subroutine to translate file names % file name translation function : name % file name translation subroutine : name |
If the name of the translation function is not specified, Sector7's VX/Tools function VXRMS_TRANSLATE_FILE_NAME is used. For example, if the translation is made by a subroutine, the input code:
OPEN(1,FILE='DUA1:[APPS.REPLACE]REPLACE.LOG',STATUS='OLD')
OPEN(7,FILE=INPFIL,STATUS='OLD')
|
is translated to read:
CALL VXRMS_TRANSLATE_FILE_NAME('DUA1:[APPS.REPLACE]REPLACE.LOG',
1 TRANSLATED_FILE_NAME,TFN_STATUS)
OPEN (1,FILE=TRANSLATED_FILE_NAME,STATUS='OLD')
CALL VXRMS_TRANSLATE_FILE_NAME(INPFIL,TRANSLATED_FILE_NAME,
1 TFN_STATUS)
OPEN (7,FILE=TRANSLATED_FILE_NAME,STATUS='OLD')
|
and the declaration:
INTEGER*4 TFN_STATUS
CHARACTER*256 TRANSLATED_FILE_NAME
|
is inserted in the sub-program which contains the code.
File Names Passed as Arguments
File names are sometimes passed as arguments to external library routines. These may also be translated.
VX/FPT needs to know which arguments are file names. Often, the sub-program code is not available, and a template is then set-up for the sub-program in a file which is read by VX/FPT, but is not used in building the program. The file name arguments are marked by annotations, for example:
C Template for FINDREC
INTEGER FUNCTION FINDREC(FNAM,TARG)
CHARACTER*(*) FNAM,TARG
C% INTENT (IN) :: FNAM
C% FILE NAME :: FNAM
C% INTENT (IN) TARG
END ! Template for FINDREC
|
(The code lines beginning C% are interpreted as commands to VX/FPT)
VX/FPT then translates the call, for example:
IREC=FINDREC('Town_Database:towns.dat',SEARCHSTRING)
|
to read:
CALL VXRMS_TRANSLATE_FILE_NAME('Town_Database:towns.dat',
1 TRANSLATED_FILE_NAME,TFN_STATUS)
IREC=FINDREC(TRANSLATED_FILE_NAME,SEARCHSTRING)
|

