|Pro*FORTRAN Supplement to the Oracle Precompilers Guide
Part Number A42523-1
Some details of Pro*FORTRAN programming vary from one system to another. This appendix is a collection all system-specific issues regarding Pro*FORTRAN. References are provided, where applicable, to other sources in your document set.
Though the standard FORTRAN character set excludes lowercase alpha characters, many compilers allow them in identifiers, comments, and quoted literals.
The Pro*FORTRAN Precompiler is not case-sensitive; however, some compilers are. If your compiler is case-sensitive, you must declare and reference variables in the same uppercase/lowercase format. Check your FORTRAN compiler user's guide.
You must code EXEC SQL and EXEC ORACLE statements in columns 7 through 72 (columns 73 through 80 are ignored). The other columns are used for the following purposes: column 1 indicates comment lines, columns 1 through 5 contain an optional statement label, and column 6 indicates continuation lines.
No more than one statement can appear on a single line.
You can continue SQL statements from one line to the next according to the rules of FORTRAN. To code a continuation line, place a non-zero, non-blank character in column 6. In this manual, digits are used as continuation characters, as the following example shows:
* Retrieve employee data. EXEC SQL SELECT EMPNO, ENAME, JOB, SAL 1 INTO :MYEMPNO, :MYENAME, :MYJOB, :MYSAL 2 FROM EMP 3 WHERE DEPTNO = :MYDEPTNO
You can also continue string literals from one line to the next. Code the literal through column 72, then, on the next line, code a continuation character and the rest of the literal. An example follows:
* Execute dynamic SQL statement. EXEC SQL EXECUTE IMMEDIATE 'UPDATE EMP SET COMM = 500 WHERE 1 DEPTNO=20'
Most FORTRAN implementations allow up to 19 continuation lines. Check your FORTRAN language user's guide.
The Pro*FORTRAN Precompiler supports the standard implementation of FORTRAN for your operating system (usually FORTRAN 77). Check your Oracle system-specific documentation.
How you declare and name host variables depends on which FORTRAN compiler you use. Check your FORTRAN user's guide for details about declaring and naming host variables.
Declare host variables in the Declare Section according to FORTRAN rules, specifying a FORTRAN datatype supported by Oracle. Table 1 - 3 shows the FORTRAN datatypes and pseudotypes you can specify in the Declare Section. However, your FORTRAN implementation might not include all of them.
The host datatypes and pseudotypes you can specify in the Declare Section are shown in the table on page 1-10. However, your implementation might not include all of them. Check your FORTRAN language user's guide.
The size of FORTRAN numeric types is implementation-dependent. The sizes given in the table are typical but not universal. Check your FORTRAN language user's guide.
Host variable names must consist only of letters and digits, and must begin with a letter. They can be any length, but only the first 31 characters are significant. Some compilers prohibit variable names longer than six characters, or ignore characters after the sixth. Check your FORTRAN compiler user's guide.
You can INCLUDE any file. When you precompile your Pro*FORTRAN program, each EXEC SQL INCLUDE statement is replaced by a copy of the file named in the statement.
If your system uses file extensions but you do not specify one, the Pro*FORTRAN Precompiler assumes the default extension for source files (usually FOR or F). The default extension is system-dependent. Check your Oracle system-specific documentation.
If your system uses directories, you can set a directory path for INCLUDEd files by specifying the precompiler option INCLUDE=path. You must use INCLUDE to specify a directory path for nonstandard files unless they are stored in the current directory. The syntax for specifying a directory path is system-specific. Check your Oracle system-specific documentation.
With the MAXLITERAL precompiler option you can specify the maximum length of string literals generated by the precompiler, so that compiler limits are not exceeded. The MAXLITERAL default value is 1000, but you might have to specify a lower value.
For example, if your FORTRAN compiler cannot handle string literals longer than 512 characters, specify "MAXLITERAL=512." Check your FORTRAN compiler user's guide. For more information about the MAXLITERAL option, see the Programmer's Guide to the Oracle Precompilers.
All the sample programs in this chapter are available online. The names of the online files are shown. However, the exact filenames are system-dependent. For more information, check your Oracle system-specific documentation.
You cannot use CHARACTER variables with SQLADR if your FORTRAN compiler generates descriptors of CHARACTER variables and passes the descriptor address (rather than the data address) to SQLADR. Check your FORTRAN compiler user's guide. In such cases, SQLADR gets the wrong address. Instead, use LOGICAL*1 variables, because they always have simple addresses.
You can, however, use (cautiously) SQLADR with CHARACTER variables if your compiler provides a built-in function to access the data address. For example, if the compiler provides a function named %REF, and X is a CHARACTER variable, you call SQLADR as follows:
* Use %REF built-in function. CALL SQLADR (%REF(X), ...)