Midrange News for the IBM i Community


Posted by: Chris Proctor
Programmer Analyst
Columbia Sports Company
Portland, OR
Can I use a SRVPGM in an RPG Stored Procedure?
has no ratings.
Published: 02 Apr 2013
Revised: 03 Apr 2013 - 4040 days ago
Last viewed on: 25 Apr 2024 (9219 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Can I use a SRVPGM in an RPG Stored Procedure? Published by: Chris Proctor on 02 Apr 2013 view comments(3)

Good afternoon! I have an RPG stored procedure (SQL calls the RPG pgm) that I would like to use a service program with, but it appears that when I try to test it from iNav the stored procedure can't find the service program. I get the following error:

 

SQL State: 38501
Vendor Code: -443
Message: [MCH3401] Cannot resolve to object SODSRVPGM. Type and Subtype X'0203' Authority X'0000'. Cause . . . . . :   Either a system pointer or a data pointer can not be resolved. For a system pointer, it can not be resolved to object SODSRVPGM, type and subtype X'0203', authorization X'0000', because either the named object was not in any context referred to or the correct object was located but the user profile did not have the required authority. The object types for some common type or subtype codes follow: -- 0190-Access group, 0201-Program, 0401-Library, -- 0701-Journal receiver, 0801-User profile, 0901-Journal, -- 0B90-Data space, 0C01-Directory, 0C90-Data space index, -- 0E01-Job queue, 0E02-Output queue, 0E03-Message file, -- 0E02-User index, 0A01-Data queue, 1401-Class of service description -- 1501-Mode description, 0E05-Session description, -- 1001-Device description, 1101-Line description, -- 1201-Controller description, 1901-File, 1902-Message queue, -- 1903-Job description, 1904-Class, 1905-Command, 1906-Table, -- 1908-Edit description, 1909-Subsystem description, -- 190A-Data area, 190C-Graphic symbol set, 190D-Chart format, -- 1911-Query definition, 1912-Folder, -- 1915-Panel group, 1916-Menu group description, -- 1920-Data dictionary, 192D-Management collection, 19D0 Work control block table, -- 19D2-System value, 1B01-Process control space, -- 1E01-Byte stream file, 1E03-Local socket, 1E06-Character special file, -- 1E07-First-in first-out special file For a data pointer, it can not be resolved because the named object is not located within any program activation currently known to the process. Recovery  . . . :   Either specify the correct object name or specify the correct authority for the object.

Is there a way to get around this, or can you not use SRVPGMs with a RPG sproc program? Any ideas would be appreciated.

Chris

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Can I use a SRVPGM in an RPG Stored Procedure?
Posted: 11 years 23 days 10 hours 27 minutes ago

Yes, provisionally. What works for me is have the Stored Procedure call an RPG program, then from the RPG program make your procedure calls (to service programs). RPG programs have a single entry point - which most calls can resolve. Service programs have multiple entry points (1 per exported procedure) which are resolved under the special ILE rules.

Definitely I support writing common code as function/procedure calls, so green screen, batch processing and browser based Stored Procedure calls all use the same code to determine a rule, a value or whatever. So then it's just a matter of making arrangements for those applications that have challenges dealing in the ILE world.

Also remember your USES SQL, READS SQL, MODIFIES SQL settings are job wide, so if your service program procedure is modifying audit files using SQL (and I think file triggers might be included in this cascade) then set the Stored Procedure create parms to account for this.

Posted by: chrisp
Premium member *
Portland, OR
Comment on: Can I use a SRVPGM in an RPG Stored Procedure?
Posted: 11 years 23 days 9 hours 8 minutes ago

Hi Neil. Thanks for the input. My stored procedure is calling the RPG program, which in then calls the module from the service program. Is that different from what you do?

What may be a little different is that I compile my RPG for stored procedures into the data library rather than the program library (where the srvpgm resides) because that way I don't have to qualify the call (ie. external name pgmlib/pgmname). I found that if the program is compiled into the data library (where the stored procedure also exists) there's no need for the qualifying.

Maybe there's another way around it, but the calling application (BizTalk) can only use one library, so that's why I'm doing it this way.

Unless you have a suggestion, I may have to settle for copy source and forget the service program, right?

 

Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Can I use a SRVPGM in an RPG Stored Procedure?
Posted: 11 years 23 days 3 hours 49 minutes ago

Yes, call RPG which then calls the service program. We keep all our programs in the main program object library - not sure where the Stored Procedures are as I am not their keeper. Our system admin has things set up so that the job initiated by the calling application sets up a default library list to include all the applicable libraries.

Another suggestion would be to bind by copy rather than copy source. When we create the service programs we compile the modules into a service objects library and then bind the service program into the main program object library - means we can recreate a multi-module service program from the core modules, without having to compile those modules every time. Now while it's a PITA to remember every program into which a module is bound directly, it could be a solution for you - and if your service programs are created with 1 procedure per module (not the way I do it), then you only need to bind the module(s) that include the procedure(s) you need.