Pro*COBOL® Programmer's Guide Release 9.2 Part Number A96109-03 |
|
|
View PDF |
This appendix looks at the improvements and new features offered by the Oracle Pro*COBOL Precompiler. Each description includes a reference to more complete descriptions in the chapters is provided.
These topics are presented:
The new features and terminology in release 9.0.1 include:
Pro*COBOL supports five new datetime datatypes: INTERVAL DAY TO SECOND
, INTERVAL YEAR TO MONTH
, TIMESTAMP
, TIMESTAMP WITH TIMEZONE
, and TIMESTAMP WITH LOCAL TIMEZONE
. You can select from columns of these datatypes onto the OCIInterval
and OCIDateTime
host variables and into objects where attributes are datetime types. For details, see "Datetime and Interval Datatype Descriptors".
This section describes features which were new to release 8.1.
Multithreaded COBOL applications are supported. A multithreaded Pro* C/C++ program can call a Pro*COBOL subprogram. See Chapter 12, "Multithreaded Applications".
The CALL embedded SQL statement invokes a stored procedure. It can be used instead of an embedded PL/SQL block or a stored Java procedure 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 enables 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 Precompiler Option".
This clause, which enables 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".
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 "Mimicking the CURRENT OF Clause".
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 "Division Headers that are Optional".
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:
Over-Punch (ZONED-DECIMAL). This is the default signed numeric for the COBOL language. Digits are held in ASCII or EBCDIC format in radix 10, with one digit for each byte of computer storage. The sign is held in the high order nibble of one of the bytes. It is called over-punch because the sign is punched-over the digit in either the first or last byte. The default sign position will be over the trailing byte. PIC S9(n)V9(m) TRAILING or PIC S9(n)V9(m) LEADING is used to specify the over-punch.
Display-1 Multibyte type (PIC G). This datatype is equivalent to PIC N and is used for multibyte characters.
See "Host Variables".
Pro*COBOL now enables 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:
Table A-1 Formats for Date Strings
Format Name | Abbreviation | Date Format |
---|---|---|
International Standards Organization | ISO | yyyy-mm-dd |
USA standard | USA | mm/dd/yyyy |
European standard | EUR | dd.mm.yyyy |
Japanese Industrial Standard | JIS | yyyy-mm-dd |
installation-defined | LOCAL | Any installation-defined form. |
'fmt' is a date format model, such as "mm, dd, yyyy". See the Oracle Database 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".
This section describes features which were new for release 8.0.
The configuration file is now called pcbcfg.cfg, instead of pccob.cfg. See "Entering Precompiler Options ".
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 for each 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.
See "Host Variables".
Pro*COBOL now enables 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 enables 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 Oracle Database 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 Oracle9i server. If you precompile again, you may have to change the settings of the precompiler options. See Chapter 14, "Precompiler Options".
See Also: Oracle Database Upgrade Guide for additional details.