On 21 May 2012 12:03, ga wrote:
> I have a program written in RPG/III (not ILE although I can easily
> convert it to be).
>
> It calls an SQLRPGLE program. The SQLRPGLE calls one other C/L
> program which simply tells me if a file exists or not.
>
> I am guessing if the SQLRPGLE didn't "end" every time it was called
> the mainline program would run faster...and probably the C/L program
> which checked for the file existence??
Does that imply the SQLRPGLE is getting called repeatedly by the OPM
program?
> But the other thought I had is that these should probably be somehow
> all tied together to make them more efficient.
Convert the first program to ILE and make the called SQLRPGLE run in
the same named [by explicit name, or *CALLER] activation group. If no
other OPM needs to call that SQLRPGLE as a program, there may be value
to changing that program to a procedure in a service program. IIRC,
avoid ACTGRP(*CALLER) if any OPM will call the program. Depending on
what the program does, there may be value in registering the program as
an SQL procedure, and making the first program SQLRPGLE to use SQL CALL
instead; or just using a CALLP if not worthwhile to have available to
other SQL work.
> If a file doesn't exist in an SQLRPGLE program in a select, will it
> return an SQLSTATE code that I can test so I wouldn't have to do the
> C/L program call?
Yes. As such, I would eliminate the separate call to a CL to check
for existence, and allow the SQL to notify with the SQLCODE -204 for
"not found". That way an OVRDBF can be used to redirect the program to
another file without some unintelligent CHKOBJ-like processing
preventing [breaking] the ability to use overrides; avoids having to add
to the CHKOBJ-like processing, some extra intelligence to process
overrides, if whatever is used does not offer that capability [e.g. like
QDBRTVFD does].
> Can anyone point me to the right direction on how to do this; i.e.
> what manual should I start with??
Karl's reply.
Regards, Chuck