On 18-Jul-2014 11:34 -0500, Gary Segal wrote:
> <<SNIP>>
>
> I need to find out which program calls one of the CLs that is
> somehow randomly called either by system or by one of the users.
> I searched the whole system, but I could not find where it is called
> from.
>
> <<SNIP>> Is there a way find out who called the program or what
> screen(PGM) called it?
Auditing is probably the easiest. The Change Object Audit
(CHGOBJAUD) command against the program is minimally required; obviously
minimally beyond that, is establishing the QAUDJRN journal and the
auditing system values. I do not recall the User auditing [setup]
requirements, in conjunction; been too long.
> I was thinking to add few lines into CL to retrieve Job attributes
> and store it into DataArea, but there is no attribute like PRIORPGM.
That seems to imply the program source is available and the program
can be recompiled to replace the current version [with the proper\same
attributes and authorization].?
The _prior program_ is easily enough retrieved at run-time, in a
variety of ways. Messaging, API, MI instruction, Dump, Trace, Inquiry,
PgmStk, WRKJOB, etc. What method(s) are available depends on whether
the effects can be disruptive, can be presumed to be /untouched/ by the
producer, need to be /invisible/ to the user, require access to the CL
source, require knowing only the parameter(s) of the CLP, and ?other?
Probably better however, to /log/ the caller versus merely /storing/
the invoker information. As contrasted with /logging/, /storing/ [and
esp. in a Data Area (*DTAARA) seemingly] implies the possibility that
the information could be overwritten; only the most recent stored info
would be available for review, rather than every incident. The audit
log [or any other journal, using Send Journal Entry (SNDJRNE)] would be
a good place for logging, and auditing [using the QAUDJRN journal] is
probably already a direct and probably better means, and auditing is
something every system should have in effect anyhow; noting however, use
of a data area, even with stored data vs /logged/ entries, events could
be logged as separately visible values by having journaled [Start
Journal Object (STRJRN)] the data area.
> Any suggestions?
If the means is allowed to be disruptive, then likely just rename
(RNMOBJ) and\or move (MOVOBJ) the CLP; unless the *PGM is invoked by
address, which is unlikely except invoked via some registered
exit-point, such that the program is a user-exit; the source of the
program would be telling, if that were the purpose of the program. The
failure [of the user] to invoke\call should result in an error that
manifests as a help-desk inquiry to resolve; the "not found" error will
identify the program\screen that failed to locate that program by name.
Similarly, the existing program can be replaced [an effective Trojan
Horse]; depending on the availability of source, the replacement program
could log and then optionally Transfer Control (TFRCTL) to the
renamed\moved program. The design could be either disruptive, or not.
--
Regards, Chuck