StarQuest Technical Documents

Sample SQL for Registering a Stored Procedure on the AS/400

Last Update: 26 June 2008
Product: StarSQL
Version: 5.x
Article ID: SQV00SQ021

Abstract

This document provides sample SQL used to register a stored procedure on an AS/400. It assumes you have already written the stored procedure that you want to register and that you have program on the AS/400 that the stored procedure will reference.

Solution

Here is sample SQL to register a stored procedure on an iSeries. This statement will put a line into the QSYS2.SYSPROCS and QSYS2.SYSPARMS catalog tables for you.

Example:

CREATE PROCEDURE MYLIB.MYPROC (INOUT PARM1 CHAR(10)) EXTERNAL NAME MYLIB.MYPGM LANGUAGE COBOL GENERAL

In the above example, the procedure name is MYLIB.MYPROC.

This procedure references the COBOL program MYLIB.MYPGM. The program takes one input parameter called PARM1 which is a char field of length 10. This procedure does not return a result set.

For more information on creating and defining stored procedures, refer to the "Defining an SQL Procedure" topic in the DB2 UDB for iSeries SQL Programming guide at the IBM i5/OS Information Center.

 


DISCLAIMER

The information in technical documents comes without any warranty or applicability for a specific purpose. The author(s) or distributor(s) will not accept responsibility for any damage incurred directly or indirectly through use of the information contained in these documents. The instructions may need to be modified to be appropriate for the hardware and software that has been installed and configured within a particular organization.  The information in technical documents should be considered only as an example and may include information from various sources, including IBM, Microsoft, and other organizations.