Hi Michael.
Glad you made it work!
And yes, it can be quite confusing with a message about object missing, when the cause is an incompatible variable. I have spend hours chasing this as well...
Best regards,
Christian
------------------------------
Christian Jorgensen | IT System Administrator
Network of Music Partners A/S
------------------------------
Original Message:
Sent: Thu December 02, 2021 06:44 AM
From: Michael Garczynski
Subject: Using Service Programs
Christian
The problem was related to the parameter variable being incorrect. When I corrected it, the function worked as expected. I was focusing on the error indicating the object wasn't found, not something being wrong with the parameters.
Thanks for the tip
------------------------------
Michael Garczynski
Director - SAP Architecture
DAP Products
Original Message:
Sent: Thu December 02, 2021 03:48 AM
From: Christian Jorgensen
Subject: Using Service Programs
Hi Michael.
Some debugging tips:
- Check the library list when you call your SQLRPGLE program. It should be the same as when you ran the successful STRSQL command.
- Check your parameters to the SQL table function! I often get this kind of error when I by mistake use a RPG variable not compatible with the parameter for the SQL function. You could try and use the same parameter value as you used in STRSQL - probably a constant value.
Best regards,
Christian
------------------------------
Christian Jorgensen | IT System Administrator
Network of Music Partners A/S
Original Message:
Sent: Tue November 30, 2021 01:35 PM
From: Michael Garczynski
Subject: Using Service Programs
I need a routine to split a large field into smaller ones for printing and need to simulate wordwrap similar to a DSPF. I found a service program which will wrap text for output and call it LINEWRAP. There is a Module and Service program and both reside in my library list.
I also followed the instructions to create an SQL procedure.
The program works fine with Interactive SQL. However, when try to code it in my SQLRPGLE program, I get an error the object LINEWRAP does not exist.
If my library list includes the objects, what are they not found, but yet OK using Interactive SQL. I can't figure out what I'm missing.
As I've never used a Service Program, I'm not sure how to troubleshoot. Any feedback is appreciated.
exec sql DECLARE C4 CURSOR FOR
Select lineno, linetext
From Table(LINEWRAP(:splitline,100)) Comments
FOR READ ONLY ;
exec sql OPEN C4;
exec sql FETCH C4 FOR 3 ROWS INTO :lines ;
exec sql CLOSE C4;
------------------------------
Michael Garczynski
Director - SAP Architecture
DAP Products
------------------------------
#RPG