Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Examples for Pro*Cobol using Oracle Transparent Gateway

Re: Examples for Pro*Cobol using Oracle Transparent Gateway

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Wed, 24 Jun 1998 19:55:58 GMT
Message-ID: <3591593c.357183@192.86.155.100>


A copy of this was sent to joconnell_at_ussco.com (if that email address didn't require changing) On Wed, 24 Jun 1998 18:15:37 GMT, you wrote:

>I was looking for an example for using the SQLGLM function in a PRO*Cobol
>program. This function of Oracle’s SQL Server gateway, it makes the error
>message longer than the default 70 characters. I looked in the manuals there
>where no PRO*Cobol examples.
>Thanks Jerry
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/ Now offering spam-free web-based newsreading

this is from the Pro*COBOL Supplement to the Oracle Precompilers Guide Release 1.8 February 1996 Part No. A42524–1

<quote>

Getting the Full Text of
Error Messages

The SQLCA can accommodate error messages up to 70 characters long. To get the full text of longer (or nested) error messages, you need the SQLGLM subroutine.

If connected to Oracle, you can call SQLGLM using the syntax CALL ”SQLGLM” USING MSG–TEXT, MAX–SIZE, MSG–LENGTH where:

MSG–TEXT
is the field in which to store the error message. (Oracle blank–pads to the end of this field.)

MAX–SIZE
is an integer that specifies the maximum size of the MSG–TEXT field in bytes.

MSG–LENGTH
is an integer variable in which Oracle stores the actual length of the error message.

The maximum length of an Oracle error message is 512 characters including the error code, nested messages, and message inserts such as table and column names. The maximum length of an error message returned by SQLGLM depends on the value specified for MAX–SIZE.

The following example uses SQLGLM to get an error message of up to 200 characters in length:

WORKING–STORAGE SECTION.
...
* Declare variables for the SQL–ERROR subroutine call. 01 MSG–TEXT PIC X(200).
01 MAX–SIZE PIC S9(9) COMP VALUE 200.
01 MSG–LENGTH PIC S9(9) COMP.
...
PROCEDURE DIVISION.
MAIN.
EXEC SQL WHENEVER SQLERROR GOTO SQL–ERROR END–EXEC. ...
SQL–ERROR.
* Clear the previous message text.
MOVE SPACES TO MSG–TEXT.
* Get the full text of the error message. CALL ”SQLGLM” USING MSG–TEXT, MAX–SIZE, MSG–LENGTH. DISPLAY MSG–TEXT. In the example, SQLGLM is called only when a SQL error has occurred. Always make sure SQLCODE is negative before calling SQLGLM. If you call SQLGLM when SQLCODE is zero, you get the message text associated with a prior SQL statement.

Note: If your application calls SQLGLM to get message text or your Oracle*Forms user exit calls SQLIEM to display a failure message, the message length must be passed. Do not use the SQLCA variable SQLERRML; SQLERRML is a PIC S9(4) COMP integer while SQLGLM and SQLIEM expect a PIC S9(9) COMP integer. Instead, use another variable declared as PIC S9(9) COMP.
</quote>  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Wed Jun 24 1998 - 14:55:58 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US