IMS status code

IMS status AJ: Invalid SSA format

IMS status code AJ means an SSA is badly formed. A command code, relational operator, parenthesis or Boolean connector is wrong, or the call has a qualified SSA where IMS only accepts an unqualified one.

Other names for this code

Also written as status code AJ, IMS AJ, DL/I status AJ, AJ status code, invalid SSA.

What it means

An SSA has a strict layout. Bytes 1 to 8 hold the segment name. Byte 9 is a blank for an unqualified SSA, an asterisk if command codes follow, or a left parenthesis if a qualification follows. A qualification holds an 8-byte field name, a 2-byte relational operator and a value as long as the field, then either a right parenthesis or a Boolean connector and another qualification. When IMS can't parse an SSA, or finds a part it doesn't accept for this call, it returns AJ.

Any call that takes SSAs can get AJ. That covers the get calls, ISRT, REPL and DLET. Two rules cause a lot of AJs. The last SSA on an ISRT, the one naming the segment being inserted, must be unqualified. SSAs on REPL and DLET must be unqualified too. They can only say which segment of a path call to act on. AJ is a programming error, and the call does nothing.

Common causes

  • A qualified SSA is passed as the last SSA on an ISRT, or on a REPL or DLET.
  • The relational operator isn't one IMS accepts. Valid ones are EQ, GT, LT, GE, LE and NE, or their symbol forms.
  • A command code is invalid or isn't allowed on this call, or the asterisk before the command codes is missing.
  • The parentheses don't match. A right parenthesis is missing, or there's an extra one.
  • The value in the qualification isn't the same length as the field in the DBD, so IMS finds the wrong byte where it expects the right parenthesis or a connector.
  • A Boolean connector between qualifications is missing or isn't valid.

How to find the problem

  1. Display each SSA in hex just before the call. Walk through it byte by byte against the SSA layout.
  2. Check the length of each field in the DBD and count the bytes of the value in the SSA.
  3. Check the function code. If it's ISRT, REPL or DLET, look at whether any SSA that must be unqualified carries a qualification.
  4. Check each command code against the list of codes the call allows.

How to fix it

  • Make the last SSA on an ISRT unqualified, and use only unqualified SSAs on REPL and DLET.
  • Use a valid relational operator, and make the value exactly as long as the DBD field.
  • Close every qualification with a right parenthesis. Remember that a blank in byte 9 makes IMS treat the SSA as unqualified and ignore the rest.
  • Define SSAs as fixed copybook structures, and fill in only the values at run time, so the layout can't drift.

IBM documentation

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

Report a correction to WND Software.

Questions

Can I qualify the SSA on an ISRT?

Only for the parent levels. The last SSA, for the segment you're inserting, must be unqualified because the key comes from the I/O area.

Why does a short key value cause AJ?

IMS takes the value length from the DBD. If your value is shorter, IMS reads past it and doesn't find the right parenthesis or connector where it expects one.

What is the difference between AJ and AK?

AJ means the SSA is badly formed. AK means the layout is fine but the field name isn't valid for that segment.