top_left_banner  SimCon logo


Translating File Names in Migration

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 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 at run-time.

There are two options:

Translation of file names is controlled by the fpt commands:

For example, the fragment:

OPEN(1,FILE='DUA1:[APPS.REPLACE]REPLACE.LOG',STATUS='OLD') OPEN(7,FILE=INPFIL,STATUS='OLD')

is translated:

CALL translate_file_name('DUA1:[APPS.REPLACE]REPLACE.LOG', & translated_file_name,tfn_status) OPEN (1,FILE=translated_file_name,STATUS='OLD') CALL translate_file_name(inpfil,translated_file_name, & tfn_status) OPEN (7,FILE=translated_file_name,STATUS='OLD')

File Names Passed as Arguments

File names are sometimes passed as arguments to external library routines. These may also be translated.

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 fpt, but is not used in building the program. The file name arguments are marked by annotations. Template files have the file name extension .ftm.

For example, the template file findrec.ftm tells fpt that the argument fnam is a file name:

! Template for findrec INTEGER FUNCTION findrec(fnam,targ) CHARACTER*(*),INTENT(IN) :: fnam,targ !% FILE NAME :: fnam END FUNCTION findrec

fpt will then rewrite the call:

irec=findrec('Town_Database:towns.dat',searchstring)

to translate the file name:

CALL translate_file_name('Town_Database:towns.dat', & translated_file_name,tfn_status) irec=findrec(translated_file_name,searchstring)

Copyright ©1995 to 2025 Software Validation Ltd. All rights reserved.