What it means
Some z/OS services are restricted to authorized programs, because they can change storage keys and get around security checks. A program gets that authority through APF, the authorized program facility. When a program without it issues one of those supervisor calls (SVCs), z/OS ends the step with system completion code 047. There is no reason code.
A job step runs APF-authorized only if the program that starts the step was link-edited with the authorization code AC(1) and was loaded from an APF-authorized library. When the step has a STEPLIB or JOBLIB, every library in that concatenation must be authorized. One unauthorized library anywhere in it is enough to make modules loaded from the concatenation unauthorized.
Libraries in the link list are treated as authorized by default. That's why a program can work when it comes from the link list and fail with S047 when someone runs a copy of it from a private library.
Common causes
- The program was loaded from a library that isn't in the APF list, often a test or personal load library in STEPLIB.
- STEPLIB or JOBLIB concatenates an unauthorized library with authorized ones. Putting a test library in front of a production STEPLIB is a common way to cause this.
- The program was link-edited without AC(1), so it never runs authorized, even from an APF library. A relink with different binder options can drop the attribute.
- The library is in the APF list by volume serial and has since been moved to another volume. The APF entry now points at a volume where the library no longer lives.
- Under TSO, the command or program isn't in the AUTHCMD or AUTHPGM list in the IKJTSOxx parmlib member, so TSO runs it unauthorized.
How to find the problem
- The IEA995I symptom dump names the load module that made the restricted call.
- In a dump, look at the two bytes just before the PSW address. They are usually the SVC instruction, X'0A' followed by the SVC number in hex, which tells you which service was refused.
- List the APF libraries with the operator command
D PROG,APF, or ask a systems programmer to. Compare that list with every library in the step's STEPLIB or JOBLIB. - Check the program's authorization code. The ISPF member list of a load library has an AC column, and an AMBLIST or binder listing shows it too.
- If it fails only under TSO, compare the command name with the AUTHCMD and AUTHPGM entries in IKJTSOxx. The TSO
PARMLIB LISTcommand shows the settings in use.
How to fix it
- Run the program from its authorized production library, not from a private copy.
- Remove unauthorized libraries from STEPLIB or JOBLIB. If you need a test library there, ask for it to be added to the APF list on the test system.
- If the program must run authorized, link-edit it with AC(1) and put it in an APF-authorized library.
- If the library moved, have a systems programmer correct the APF entry with
SETPROG APFand in the PROGxx member, so the change survives an IPL. SMS-managed libraries can be listed without a volume, which avoids this problem. - For TSO, ask for the command to be added to AUTHCMD or AUTHPGM in IKJTSOxx. A changed member can be activated without an IPL.
What it looks like
IEA995I SYMPTOM DUMP OUTPUT
SYSTEM COMPLETION CODE=047
ACTIVE LOAD MODULE ADDRESS=0001A000 OFFSET=000000F6
NAME=GLUTIL04
IEF450I GLMAINT1 STEP010 - ABEND=S047 U0000 REASON=00000000