× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Ok. That was it. I'm not sure where that came from as I have been doing a
lot of searching and looking at code to figure out how to do what I want.
I normally code in RPGLE, so this is all new to me.

Thanks, Matt

On Tue, Apr 29, 2025 at 12:50 PM Korinne Adler <kadler@xxxxxxxxxx> wrote:

I’m not sure where you got that syntax, but that’s not how you call
procedures with node-odbc.

Here’s the docs:
https://github.com/IBM/node-odbc?tab=readme-ov-file#callprocedurecatalog-schema-name-parameters-callback

parameters?: An array of parameters to pass to the procedure. For input
and input/output parameters, the JavaScript value passed in is expected to
be of a type translatable to the SQL type the procedure expects. For output
parameters, any JavaScript value can be passed in, and will be overwritten
by the function. The number of parameters passed in must match the number
of parameters expected by the procedure.

All parameters are just values, there is no need to describe what types
they are.

Try this instead:

const result = await connection.callProcedure(null,
defaultSchema,
procedureName,
[
runSchema,
undefined // output parameter
]
);


From: OpenSource <opensource-bounces@xxxxxxxxxxxxxxxxxx> on behalf of
Hopkins, Matt <hopkins.matthew@xxxxxxxxxxxxxx>
Date: Tuesday, April 29, 2025 at 10:52 AM
To: opensource@xxxxxxxxxxxxxxxxxx <opensource@xxxxxxxxxxxxxxxxxx>
Subject: [EXTERNAL] [IBMiOSS] nodejs stored procedure call - Program type
out of range
I’m new to Node and stored procedures, so I’m sure I’ve done something
wrong,
but I keep getting an error ‘Program type out of range’. As far as I can
tell
everything should line up.



This is what I am getting:

Error calling RPGLE procedure: [Error: [odbc] Error binding parameters to
the
statement] {

odbcErrors: [

{

state: 'HY003',

code: 0,

message: '[unixODBC][Driver Manager]Program type out of range'

}

]

}





Here is the RPGLE procedure interface definition. It is in service program
PLOC
:

Dcl-pi PlocReview;

RunLib char(10) const;

Match varchar(5000);

End-pi;





Here is the stored procedure definition:

CREATE OR REPLACE PROCEDURE MODVANTIS.PLOC_REVIEW (

IN RUNLIB CHAR(10) ,

OUT MATCH VARCHAR(5000) )

LANGUAGE RPGLE

SPECIFIC MODVANTIS.PLOC_REVIEW

NOT DETERMINISTIC

NO SQL

EXTERNAL NAME 'MODVANTIS/PLOC(PLOCREVIEW)'

PARAMETER STYLE GENERAL ;



I have tried 2 different methods to call the procedure with the same
results.



try {

// Connect to the database via ODBC

const connection = await odbc.connect(connectionConfig);



const sql = `{CALL ${defaultSchema}.${procedureName}(?, ?)}`;



let outputparm = '';



const statement = await connection.createStatement();

await statement.prepare(sql);



const result = await statement.bind([

{ParamType: 'INPUT', DataType: 'CHAR', LENGTH: 10, Data:
runSchema.padEnd(10, ' ') },

{ParamType: 'OUPUT', DataType: 'VARCHAR', LENGTH: 5000, Data:
outputparm }

]);



const result = await statement.execute();



Also tried:

const result = await connection.callProcedure(null, defaultSchema,
procedureName, [

{ Value: runSchema, IO: 'IN' }, // Input parameter: Run library

{ Value: '', Length: 5000, IO: 'OUT' }, // Output parameter: name
(varchar)

]);





■ Matt Hopkins ▪ IBMi Programmer Analyst

IM&T

The Penn Mutual Life Insurance Company

e. Hopkins.Matthew@xxxxxxxxxxxxxx

p. 860-298-6005 c. 410-258-8845

w. pennmutual.com ▪ gateway.pennmutual.com




This message, including any attachments, is intended only for the
recipient(s)
named above. It may contain confidential and privileged information. If
you have
received this communication in error, please notify the sender immediately
and
destroy or delete the original message. Also, please be aware that if you
are
not the intended recipient, any review, disclosure, copying, distribution
or any
action or reliance based on this message is prohibited by law.
--
This is the IBMi Open Source Roundtable (OpenSource) mailing list
To post a message email: OpenSource@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/opensource
or email: OpenSource-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/opensource .
--
This is the IBMi Open Source Roundtable (OpenSource) mailing list
To post a message email: OpenSource@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/opensource
or email: OpenSource-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/opensource.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.