IMS status code

IMS status AD: Invalid function parameter

IMS status code AD means IMS rejected the call because the function code is invalid, or because that function isn't allowed with the type of PCB the program passed. A database call sent to the I/O PCB is the classic case.

Other names for this code

Also written as status code AD, IMS AD, DL/I status AD, AD status code, function parameter invalid.

What it means

Every DL/I call starts with a 4-byte function code, such as GU , GHN or ISRT, and a PCB. IMS checks that the function is one it knows and that it makes sense for that kind of PCB. Database calls must go to a database PCB. Message calls must go to the I/O PCB or an alternate PCB, as the call requires. If either check fails, IMS returns AD and does nothing else.

AD can come back on any call, because the check happens before IMS looks at the database or the message queue. It is always an error in the program or in how it was set up to run. Programs that use EXEC DLI can get AD when they issue a command that isn't supported in the environment they run in.

Common causes

  • The PCB list is shifted by one. A BMP or MPP always gets the I/O PCB first. A batch program gets it only if the PSB was generated with CMPAT=YES. A program written without the I/O PCB in its entry statement and then run as a BMP sends its database calls to the I/O PCB.
  • The function code is misspelled or not padded to 4 bytes, for example 'GHU' in a 3-byte field instead of 'GHU '.
  • A database call was made with a PCB that isn't a database PCB, such as the I/O PCB or an alternate PCB.
  • A message GU was issued on the I/O PCB in a BMP that wasn't given an input transaction code in its parameters, so it has no message queue to read.
  • A message call such as GU or GN was issued against an alternate PCB, which is for output only.

How to find the problem

  1. Display the function code in hex just before the call. Check that it's a valid code and exactly 4 bytes, padded with blanks.
  2. Check which PCB the call used. In a dump or a debugger, look at the PCB's first 8 bytes. A database PCB holds a DBD name there, and the I/O PCB holds a logical terminal name.
  3. Compare the PCB list in the program's entry statement with the PSB source. Check the CMPAT option on the PSBGEN statement if the program runs both as batch DL/I and as a BMP.
  4. For a BMP that issues a message GU, check the EXEC statement parameters for the input transaction code.

How to fix it

  • Correct the function code and define it as a 4-byte field with trailing blanks.
  • Make the entry statement match the PSB. Code the I/O PCB first when the program runs as a BMP or MPP, and generate the PSB with CMPAT=YES if the same program also runs as batch DL/I.
  • Send database calls to a database PCB and message calls to the I/O PCB.
  • If a BMP needs to read messages, give it the input transaction code. If it doesn't, remove the message GU.

IBM documentation

IBM documentation: status AD. Use the documentation for your installed release.

Report a correction to WND Software.

Questions

Why does my program work as a batch job but get AD as a BMP?

A BMP always receives the I/O PCB as its first PCB. If the program's entry statement doesn't expect it, every PCB is shifted by one and the first database call goes to the I/O PCB.

Does AD change anything in the database?

No. IMS rejects the call before it reads or updates anything.

What is CMPAT=YES?

It's a PSBGEN option that gives a batch DL/I program an I/O PCB, so the same program can run as batch or as a BMP with the same PCB list.