Create a Stored Procedure using CL and RPGLE programs

20 pts.
Tags:
CL
CL Program
RPGLE
RPGLE Program
Stored Procedures
I have an RPGLE program called from a CL program for database files overrides. I want to call the same programs from a stored prodecure on SQL Server from within a Web application. I am brand new to SQL Server but am pretty good on the AS400.

Answer Wiki

Thanks. We'll let you know when a new response is added.

CREATE PROCEDURE ABCSP(
IN PARM1 CHAR(1),
IN PARM2 NUMERIC(9,0),
IN PARM3 NUMERIC(9,0))
LANGUAGE RPGLE RESULT SET 1
NOT DETERMINISTIC
MODIFIES SQL DATA
EXTERNAL NAME ABCRPG( program name )
PARAMETER STYLE GENERAL

Type of Sp as like SQLSPE

Create and compile your CL on the AS400 as normal. Then from a command line type STRSQL and enter the following code.
<pre>CREATE PROCEDURE library/clpgm (IN parm1 DEC(3), IN parm2 CHAR(10))
RESULT SETS 1
EXTERNAL NAME library/clpgm
LANGUAGE CL NOT DETERMINISTIC NO SQL
PARAMETER STYLE GENERAL

You should receive a message back:
Procedure clpgm was created in library

You can have as many IN and OUT parms as you need, the must be exactly defined. Also as long as you don’t change your parms you can change the CL on the AS400 and recompile without recreating the procedure. If you need to recreate the procedure it is:
<pre>DROP PROCEDURE library/clpgm

Then you can Create it again. I have had problems with using the DEC parms so I always convert them to CHAR in the CL before using.</pre></pre>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following