Pro*COBOL Precompiler Programmer's Guide Release 8.1.5 A68023-01 |
|
This appendix looks at the improvements and new features offered by the Oracle Pro*COBOL Precompiler. Each is briefly described, and a reference to the more complete description in the chapters is provided.
These topics are presented:
The CALL embedded SQL statement invokes a stored procedure. It can be used instead of an embedded PL/SQL block in new applications. See "CALL (Executable Embedded SQL)".
Stored procedures (methods) written in Java can be called from your application. For information on how to call a procedure written in Java, see "Stored PL/SQL and Java Subprograms".
An embedded SQL statement interface allows LOBs (large objects) to be used in precompiler applications. How LOBs are used, the internal and external LOBs, and comparisons with other ways to handle LOBs are presented. A presentation of each new SQL statement is made. Sample code shows how to use the LOB interface. See the chapter Chapter 13, "Large Objects (LOBs)" for complete details.
The complete ANSI implementation of dynamic SQL Method 4 through embedded SQL statements is presented in Chapter 10, "ANSI Dynamic SQL". An overview with simple examples is presented. This is followed by a complete discussion of the new SQL statements. Sample programs from the demo
directory are then shown.
This precompiler option speeds up database access by "prefetching" values, thus cutting down the number of network round-trips. See "The PREFETCH Option".
This clause, which allows you to save round-trips to the database server, is now allowed in INSERT, DELETE, and UPDATE statements. See "Inserting Rows".
The support for universal ROWID datatype is presented. Index-organized tables use this concept. See Universal ROWIDs.
User-specified runtime contexts are explained. COBOL subprograms can now be called by C programs. The context can be passed by your Pro*COBOL program to a C subprogram. See "User-Specified Runtime Contexts"
To set these privileges using the CONNECT statement, see "Connecting to Oracle".
Tables of group items are now allowed as host variables in Pro*COBOL. See "Tables of Group Items as Host Variables".
The WHENEVER directive now has a DO CALL action: a subprogram is called. See "WHENEVER Directive".
The DECIMAL-POINT IS COMMA clause is supported. This permits commas to be used instead of decimal points in numeric literals. See "Decimal-Point is Comma".
The following divisions and their contents are now optional: IDENTIFICATION, ENVIRONMENT, DATA. See "Optional Divisions".
When set to NO, the NESTED precompiler option will prevent generation of the GLOBAL clause for non-nested programs. See "NESTED".
These new features in Pro*COBOL release 8.0 help you migrate applications from DB2 to Oracle, but all users of Pro*COBOL should review them.
Use of the BEGIN DECLARE SECTION and END DECLARE SECTION statements is now optional when DECLARE_SECTION=NO (the default). If used, the DECLARE statements must be properly paired within the same WORKING-STORAGE SECTION or other COBOL declaration unit. For more details, see "DECLARE_SECTION".
The computational usage datatype COMP-4 (COMPUTATIONAL-4) is treated as a binary datatype. The IBM-implemented computational data type, COMP-4 (also represented as COMPUTATIONAL-4,) will be treated as a binary datatype.
Display usage datatypes now supported are:
See "Host Variables".
Pro*COBOL now allows the use of group items in embedded SQL statements. The host group items can be referenced in the INTO clause of a SELECT or a FETCH statement, and in the VALUES list of an INSERT statement. When a group item is used as a host variable, only the group name is used in the SQL statement. For more details see "Group Items as Host Variables".
The declaration of COBOL groups that are recognized as VARCHAR are of the following format:
nn <identifier-1> 49 <identifier-2> PIC S9(4) <integer declaration>. 49 <identifier-3> PIC X(nc).
where the level, nn, is in the range 01 to 48, the length, nc, is in the range 1 to 65533.
The VARCHAR=YES command line option must be specified for Pro*COBOL to recognize the extended form of the VARCHAR group items. Otherwise, any declarations in the above format will be interpreted as regular group items. For more details, see "Referencing VARCHAR Variables".
DB2 returns a SQLCODE value of 100 when an end-of-fetch condition occurs. To provide explicit control over the value returned by Oracle, the following option is available:
END_OF_FETCH={100 | 1403 (default)}
This precompiler option must be used on the command line or in a configuration file. For more details see "END_OF_FETCH".
DB2 closes all cursors on commit, by default. This can be overridden on a cursor (which has been declared as FOR UPDATE) by using the WITH HOLD clause in the declaration of the cursor. Any cursor with the WITH HOLD clause will remain open after a commit or a rollback. The DB2 default occurs when MODE=ANSI, but then all host variables must be declared in a declare section. See "Declaring a Cursor".
A new precompiler option is provided:
CLOSE_ON_COMMIT={YES | NO (default)}
This option must be used on the command line or in a configuration file. It will only have an effect when a cursor is not coded using the WITH HOLD clause, since that will override both the CLOSE_ON_COMMIT setting and the existing behavior which is associated with MODE option. For more details, see "Declaring a Cursor" and "CLOSE_ON_COMMIT".
DB2 provides a routine DSNTIAR to obtain a form of the SQLCA that can be displayed. Pro*COBOL now provides DSNTIAR. The interface is:
CALL "DSNTIAR" USING SQLCA MESSAGE LRECL.
where SQLCA is a SQL communication area, MESSAGE is the output message area, in VARCHAR form of size greater than or equal to 240, and LRECL is a full-word containing the length of the output messages, between 72 and 240. For more details, see "DSNTIAR".
For compatibility with DB2, Pro*COBOL now provides the following precompiler option to specify date strings:
DATE_FORMAT={ISO | USA | EUR | JIS | LOCAL | 'fmt' (default LOCAL)}
The DATE_FORMAT option must be used on the command line or in a configuration file. The date strings are shown in the following table:
'fmt' is a date format model, such as 'Month dd, yyyy'. See the Oracle8i SQL Reference for the list of date format model elements. For more details, see "DATE_FORMAT".
A SQL statement now can be terminated by a comma, a period or another COBOL statement. For more details, see "Sentence Terminator".
The configuration file is now called pcbcfg.cfg, instead of pccob.cfg. See "Configuration Files".
The computational usage datatype PACKED-DECIMAL is treated as COMP-3 datatype for ANSI compatibility.
The datatype SCALED DISPLAY (PIC 9(n) and PIC S9(n)) is supported. Digits are held in ASCII or EBCDIC format in radix 10, with one digit per byte of computer storage. If present, the sign is held in a separate byte (designated by the phrase SIGN SEPARATE). The position is trailing, the default, or may be specified using the SIGN TRAILING clause.
Pro*COBOL now allows nested programs with embedded SQL within a single source file. Nested programs cannot be recursive. All level 01 items which are marked as global in a containing program and are valid host variables at the containing program level are usable as valid host variables in any programs directly or indirectly contained by the containing program. For more details, see "Nested Programs".
The REDEFINES clause can be used to redefine group items. For more details, see "REDEFINES Clause"
The word FILLER is now allowed in host variable declarations. For more details, see "Host Variables"
The default datatype for PIC X variables is changed from VARCHAR2 to CHARF. A new precompiler option provides backwards compatibility:
PICX={VARCHAR2 | CHARF (default)}
This option is allowed only on the command line or in a configuration file. The new default behavior is consistent with the normal COBOL move behavior.
For more details, see "PICX".
This clause specifies an optional buffer used for conversion between character sets.
For more details, see "CONVBUFSZ Clause in VAR Statement".
Errors are now associated with the proper line in any list file or in any terminal output. "Invalid host variable" errors state why the given COBOL variable is invalid for use in embedded SQL.
The executable embedded SQL statement, CONNECT, has a new optional, final clause which allows you to change the password:
EXEC SQL CONNECT ... [ALTER AUTHORIZATION :new_password] END-EXEC.
See "Changing Passwords at Runtime" and "CONNECT (Executable Embedded SQL Extension)" .
Error and warning codes are different between earlier releases of Pro*COBOL and the current release. See Oracle8 Error Messages for a complete list of codes and messages.
The runtime messages issued by SQLLIB now have the prefix SQL-, rather than the RTL- prefix used in earlier Pro*COBOL releases. The message codes remain the same as those of earlier releases.
When precompiling with SQLCHECK=SEMANTICS, PLS is the prefix used by the PL/SQL compiler. Such errors are not from Pro*COBOL.
Existing applications written in Pro*COBOL will work unchanged with an Oracle8i server. To migrate to Oracle8i before adding new functionality to your application, re-link with the new SQLLIB library.
Pro*COBOL release 8.x applications will work with an Oracle7 server, if they do not use any new features.
For many more details, see Oracle8i Migration.