Service program YAJLR4 not found.

Discussions relating to the ScottKlement.com port of the open source YAJL JSON Reader/Generator. This includes the YAJL tool as well as the YAJLR4, YAJLGEN, YAJLINTO and YAJLDTAGEN add-ons from ScottKlement.com. http://www.scottklement.com/yajl/
Post Reply
abermudez
Posts: 4
Joined: Tue Aug 15, 2023 9:06 pm

Service program YAJLR4 not found.

Post by abermudez »

Team,

I have an RPG program using YAJL that works most of the time. Every now an then I get the following error message when I call the program.
“Service program YAJLR4 not found.”.

On the green screen when I add YAJL to the library list the program begins to work again. I am not sure why this happens. In the RPG program I add the YAJL library programmatically before any code begin to execute.

Once the program finishes executing I verify my library list and YAJL is no longer in the list because the program removes the library from the list when it clean up at the end.

if I sign out and then back in again I will get the “Service program YAJLR4 not found.”. error until I add YAJL to my library list.

Any suggestions?

In our shop that is the standard way of doing things . 1 Modify the library list when starting adding utility libraries and then remove them at the end of the job run to keep the original list.

One thing I have noticed is that when the error occurs if I have a debugging session stated on the program it will not start I get the error and it will not enter the program. The error is occurring when the program initiates.

See code logic below.

Code: Select all

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
// Data Description Lines
;
;
;
//  ADD YAJL to library list
         cmdstr ='ADDLIBLE LIB(YAJL) POSITION(*LAST)';
         monitor;
          ExcCmd(cmdstr:%len(cmdstr));
         on-error;
         endmon;    

//Code to process JASON strings
;
;
;

// clean up library List remove YAJL from list 
         cmdstr ='ADDLIBLE LIB(YAJL) POSITION(*LAST)';
         monitor;
          ExcCmd(cmdstr:%len(cmdstr));
         on-error;
         endmon; 
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Thank you for your input.
Scott Klement
Site Admin
Posts: 658
Joined: Sun Jul 04, 2021 5:12 am

Re: Service program YAJLR4 not found.

Post by Scott Klement »

By default, service programs are loaded when your program is loaded ("activated") into the computer. Since that is before any code in your program runs, setting the library list within your code doesn't really help.

Possible solutions
  • Create a CL program that sets the library list before calling the RPG program that uses YAJL (or any other service programs -- this applies to all service programs, it's not specific to YAJL!)
  • Change it to bind to YAJLR4 and other service programs with *DEFER. In this case, it doesn't load the service program until the first time you call a procedure in it -- which means, you can set your library list in the same program if you like.
I guess you're new to RPG and ILE in general? Welcome!
abermudez
Posts: 4
Joined: Tue Aug 15, 2023 9:06 pm

Re: Service program YAJLR4 not found.

Post by abermudez »

Thank you for the solution
Post Reply