========================================================================= G C O S - 8 C O B O L W O R K B E N C H v1.4.48 32bit RELEASE ========================================================================= FORTRAN-77 Support ================== TABLE OF CONTENTS ================= Introduction Adapting Fortran-77 Compiling Fortan-77 subroutines COBOL-74 to Fortran-77 Test Fortran-77 TPRs Limitations Introduction ============ G8WB provides support of Fortran-77 subroutines with some limitations. The Lahey/Fujitsu Fortran 95 Windows compiler (Express, Standard or PRO) is required. Since G8WB is using dynamic linking, Fortran-77 subroutines cannot be linked with the COBOL application. By placing the subroutines into a Dynamic-Link-Library (DLL), these may be linked dynamically. For COBOL-85, the service call ENTERES is used to provide indirect linking to Fortran-77, and G8WB provides an ENTERES emulation, which includes linkage into the application DLL. COBOL-85 Fortran-77 DLL *------------* *-----------* * CALL using * <-----> ENTERES <-----> * subroutine* *------------* *-----------* For COBOL-74, the call to a Fortran-77 subroutine must be pass through a COBOL-85 interface, which redirect the call through ENTERES. COBOL-74 COBOL-85 Fortran-77 DLL *------------* *------------* *-----------* * CALL using * <-----> * ENTERES * <-----> * subroutine* *------------* *------------* *-----------* Note: The Lahey/Fujitsu Fortran-95 compiler is available either from Lahey (www.lahey.com), from a local distributor or from B & C Solution. Adapting Fortran-77 =================== Fortran-77 source will require some adaption to be accepted by the Lahey compiler. G8WB provides the W8F77PC utility to automate such adaption, ex. W8F77PC [INC] [path]sourcein[.F77] [[path]sourceout[.FOR]] The default extension for GCOS8 source is F77, and FOR for PC source, however other extensions may be used. The use of FOR as extension for PC source, makes the Lahey compiler default to fixed source format. The optional INC argument changes the default extension for PC source, to . Following adaptions take place: 1) GCOS8 source line numbers are removed 2) Source is aligned to fixed source format (col 1-5, 6, 7-80) 3) Long lines are split 4) ENCODE is changed to Read (internal) 5) DECODE is changed to Write (internal) 6) PRINT is adapted 7) DO is adapted 8) .T. and .F. is adapted 9) $ is changed to * Note: The source for this utility is included, and you are welcome to amend this with further adaption rules. Compiling Fortan-77 subroutines =============================== FHello.FOR provides an example of a Fortran-77 subroutine. WfFHello.FOR provides an example of a Fortran stub, which is used to redirect the ENTERES call to the corresponding Fortran-77 subroutine, and it may be used as a template. Each Fortran-77 subroutine called from COBOL must be compiled into a DLL named wf and the stub must be named likewise. The ENTERES emulation will automatically use the 'wf' prefix to locate the appropriate DLL. C C Interface for COBOL-TO-FORTRAN C function wffhello(arg1,arg2) dll_export wffhello character arg2*40 call FHELLO(arg1,arg2) return end It is recommended to compile all Fortran-77 subroutines into a common library, and include library when building DLLs. Fortran-77 to Fortran-77 calls are statically linked into the DLL. COMP.BAT illustrates the compiling/building technique, ex. rem Requires Lahey Fortran rem Delete any existing library del wflib.lib rem Compile module and add to library lf95 fhello.for lm wflib +fhello; rem Compile DLL for G8WB interface lf95 wffhello.for -win -ml msvc -dll -lib wflib $PATH is used to locate the Fortran-77 DLL and you should amend the PATH setting to include the directory where the DLLs are, or place these in a directory already included in the PATH setting. COBOL-74 to Fortran-77 ====================== For COBOL-74, you need to provide a COBOL-85 interface to redirect the call to Fortran-77 via ENTERES. TEST74F.CBL provides an example of a COBOL-74 program calling a Fortran-77 subroutine and passing arguments through block common. FHELLO74.CBL provides an example of a COBOL-85 interface, which redirect the call via ENTERES and change block common to to linkage arguments. Test ==== TFHello.CBL provides an example of a COBOL-85 program calling the simple Fortran-77 subroutine FHello. Fortran-77 TPRs =============== G8WB does NOT support Fortran-77 TPRs, however it may be possible, depending on the complexity of such TPR, to implement a TPR shell in COBOL-85 and call the Fortran-77 logic as a subroutine. Note: VMPS and others GCOS8/TP8 service calls are NOT supported from Fortran-77. Limitations =========== Besides the limitations described above, you may experience compatibility problem between GCOS8 Fortran-77 and the Lahey compiler. Should this occur, you are adviced to change your logic to make it compatible in both environments. ========================================================================= GCOS-8 COBOL Workbench is a trademark of B & C Solution Sarl. All other trademarks and trade names belong to their respective companies. ========================================================================= Copyright (C) 1991-2001 B & C Solution Sarl. All Rights Reserved.