Relink-editing a pre-Language Environment executable program
The action to take to relink-edit a pre-Language Environment executable program depends on whether it contains a reference to one or more of the conflicting names shown in Table 1:
- If the executable program contains no reference to any of the conflicting names, but contains parts that reference Fortran routines not in the list of conflicting names, replace the Fortran routines with the equivalent Language Environment routines by using the module as input to the Fortran library module replacement tool, SCEESAMP(AFHWRLK), which is discussed in Replacing Fortran runtime library modules in a Fortran executable program.
- If the executable program does contain parts that reference one
or more of the conflicting names, and the names are to be resolved
to Fortran routines,
the action you take depends on whether C parts are present in the
executable program:
- If the executable program does not contain any C part that
references a conflicting name, replace the Fortran routines
with the equivalent Language Environment routines
by using the executable program as input to the Fortran library
module replacement tool, SCEESAMP(AFHWRLK), and link-edit:
- Under MVS™, by using the AFHWL
cataloged procedure (see AFHWL — Link a program written in Fortran), as
shown in Figure 1. Figure 1. Replacing Fortran routines with Language Environment routines under MVS
//REPFORT EXEC PROC=AFHWL,PGMLIB=USER.FORT.LOAD //USERINP DD DSN=USER.FORT.LOAD,DISP=SHR //LKED.SYSIN DD * INCLUDE SCEESAMP(AFHWRLK) INCLUDE USERINP(MEM1) NAME MEM1(R) /*
Fortran routines are replaced with the equivalent Language Environment routines using the Fortran library module replacement tool, AFHWRLK. The existing and resulting executable program is USER.FORT.LOAD(MEM1). No DD statement is needed for the SCEESAMP library because it is already included in the AFHWL cataloged procedure.
- Under TSO/E, by using a CLIST as shown in Figure 2, Fortran routines
are replaced with the equivalent Language Environment routines
using the Fortran library
module replacement tool, AFHWRLK. The existing and resulting executable
program is USER.FORT.LOAD(MEM1). Figure 2. Replacing Fortran routines with Language Environment routines under TSO/E
PROC 0 CONTROL MSG NOFLUSH NOPROMPT SYMLIST CONLIST LINK ('CEE.SCEESAMP(AFHWRLK)', + 'USER.FORT.LOAD(MEM1)') + LOAD ('USER.FORT.LOAD(MEM1)') + LIB ('CEE.SAFHFORT', + 'CEE.SCEELKED') NOTERM
- Under MVS™, by using the AFHWL
cataloged procedure (see AFHWL — Link a program written in Fortran), as
shown in Figure 1.
- If the executable program contains at least one C part that references
a conflicting name, you can take one of two possible courses of action
depending on whether the individual object modules of the executable
program are available to you:
- If the individual object modules are available, relink-edit the whole application following the name conflict procedure from the beginning to check for possible conflicts, or
- If the individual object modules are not available, link-edit
the executable program:
- In MVS, using the CEEWL cataloged procedure, as shown in Figure 3
- In TSO/E, using a CLIST, as shown in Figure 4
- Include the SAFHFORT library Fortran routines to which the conflicting names should resolve.
- Include the Fortran library module replacement tool, SCEESAMP(AFHWRLK).
- Do the CSECT replacement necessary to make the C parts of the executable program compatible. There could be CSECTs that you need to replace in addition to those shown in Figure 3 or Figure 4; see z/OS XL C/C++ Compiler and Runtime Migration Guide for the Application Programmer for details.
- If the executable program does not contain any C part that
references a conflicting name, replace the Fortran routines
with the equivalent Language Environment routines
by using the executable program as input to the Fortran library
module replacement tool, SCEESAMP(AFHWRLK), and link-edit:
The following example relink-edits an executable program containing both C and Fortran (or assembler) routines, where C references SQRT, and Fortran references SIN, LOG, and CLOCK. (The language of the main program here is C. If it were Fortran, the ENTRY CEESTART statement would be rewritten to instead name the Fortran main program.) The existing and resulting executable program is USER.FORTC.LOAD(MEM1).
//FORTC EXEC PROC=CEEWL,PGMLIB=USER.FORTC.LOAD
//USERINP DD DSNAME=USER.FORTC.LOAD,DISP=OLD
//SAFHFORT DD DSNAME=CEE.SAFHFORT,DISP=SHR
//SCEESAMP DD DSNAME=CEE.SCEESAMP,DISP=SHR
//LKED.SYSIN DD *
INCLUDE SAFHFORT(SIN)
INCLUDE SAFHFORT(LOG)
INCLUDE SAFHFORT(CLOCK)
INCLUDE SCEESAMP(AFHWRLK)
INCLUDE USERINP(MEM1)
NAME MEM1(R)
INCLUDE SYSLIB(EDCSTART)
INCLUDE SYSLIB(CEEROOTB)
INCLUDE SYSLIB(@@FTOC)
INCLUDE SYSLIB(@@CTOF)
INCLUDE USERINP(MEM1)
ENTRY CEESTART
NAME MEM1(R)
/*
The following example relink-edits an executable program containing both C and Fortran (or assembler) routines, where C references SQRT, and Fortran references SIN, LOG, and CLOCK. The existing and resulting executable program is USER.FORTC.LOAD(MEM1).
PROC 0
CONTROL MSG NOFLUSH NOPROMPT SYMLIST CONLIST
LINK ('CEE.SAFHFORT(SIN)', +
'CEE.SAFHFORT(LOG)', +
'CEE.SAFHFORT(CLOCK)', +
'CEE.SCEESAMP(AFHWRLK)', +
'USER.FORTC.LOAD(MEM1)') +
LOAD ('USER.FORTC.LOAD(MEM1)') +
LIB ('CEE.SCEELKED') NOTERM
LINK ('CEE.SCEELKED(EDCSTART)', +
'CEE.SCEELKED(CEEROOTB)', +
'CEE.SCEELKED(@@FTOC)', +
'CEE.SCEELKED(@@CTOF)', +
'USER.FORTC.LOAD(MEM1)') +
LOAD ('USER.FORTC.LOAD(MEM1)') +
LIB ('CEE.SCEELKED') NOTERM