Daron,
There are two types of stored procs on DB2/400 - ones that call SQL and
ones that call other programs (RPG, COBOL, etc). Both are created using
the SQL CREATE PROCEDURE statement. Here's examples of both:
SQL:
Create procedure &LIB/PC001S
(in_ProductFamilyCode IN Char(3),
out_ProductMasterStatus OUT Char(1),
out_ProductFamilyDescription OUT Char(25),
out_ProductFamilyContact OUT Char(25),
out_ProductFamilyContactExt OUT Decimal(5, 0))
Language SQL Reads SQL Data
BEGIN
Declare Exit Handler for SQLState '02000'
Set out_ProductMasterStatus = '1';
Set out_ProductMasterStatus = '0';
Select PM_FAMDESC, PM_CONTACT, PM_CONEXT
Into out_ProductFamilyDescription,
out_ProductFamilyContact,
out_ProductFamilyContactExt
From PCPMSTP
Where PM_FAMCODE = in_ProductFamilyCode;
END;
"Other":
Create procedure &LIB/PC012S
(in_FamCode IN Char (3),
in_Package IN Char (2),
in_Dim1 IN Char (9),
in_Dim2 IN Char (9),
in_Lead IN Char (6),
in_Format IN Char (4),
in_Die IN Char (4),
in_Factor1 IN Char (4),
in_Factor2 IN Char (4),
in_SPO IN Numeric (5, 0))
Result sets 1
Language RPGLE Reads SQL Data
External name &LIB/PC012R;
Best regards,
Rob Brooks-Bilson
Web Technology Manager
Amkor Technology
Author, Programming ColdFusion (O'Reilly)
>>>>>Forgive me if this is OT but I noticed there were some people using
stored
procs with the 400. I use 400 data and SQL Server, Most of my calls
to the
SQL Server are in stored procs, I would like to do the same with our
AS400
which runs DB2. Could anyone point me to a stored procedure example
from
the 400 so that I could show it to my 400 programmer?
Thanks for the help,
Daron Smith
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists