IMS status DA: Key field changed
IMS status code DA means a REPL or DLET call was rejected because the key field in the I/O area no longer matches the segment the program is holding. IMS doesn't let a program change a segment's key with REPL.
Other names for this code
Also written as status code DA, IMS DA, DL/I status DA, DA status code, key field changed IMS.
What it means
A program updates a segment by reading it with a get hold call (GHU, GHN or GHNP), changing the data in the I/O area, and issuing REPL. IMS compares the key (sequence) field in the I/O area with the segment it is holding. If the key is different, IMS returns DA and doesn't make the change. The same check applies to DLET. The segment's position in the database depends on its key, so the key can't be changed in place.
The check also covers fields the PSB marks as not replaceable. With field-level sensitivity, a SENFLD statement can say a field may not be replaced. If the program changes such a field and issues REPL, IMS returns DA. For a path call that replaces several segments at once, every segment in the path is checked.
DA is a programming error. The database isn't changed.
Common causes
- The program moved a new value into the key field before the REPL, often by building the whole segment from an input record.
- The program read one segment with the get hold call but built the I/O area for a different one. A get hold call with the wrong SSA returns the wrong segment, and the REPL then carries a key that doesn't match.
- A path call returned several segments into one I/O area, and the program changed a key in one of them.
- The program changed a field marked as not replaceable in the PSB.
- The I/O area layout doesn't match the segment, so data meant for a non-key field overlays the key.
How to find the problem
- Display the I/O area right after the get hold call and again just before the REPL or DLET. Compare the key field.
- Look up the key field's position and length in the DBD (the FIELD statement with SEQ) and check the copybook against it.
- Check the SSA on the get hold call. Make sure it retrieved the segment the program meant to update.
- If the PSB uses field-level sensitivity, look at the SENFLD statements for fields marked as not replaceable.
How to fix it
- Don't change the key in the I/O area between the get hold call and the REPL.
- To change a key, delete the old segment with DLET and insert a new one with ISRT. Remember that DLET also removes the segment's dependents, so reinsert them if needed.
- Fix the get hold call's SSA so it holds the segment the program means to update.
- Correct the copybook if it doesn't match the segment layout in the DBD.
IBM documentation
IBM documentation: status DA. Use the documentation for your installed release.
Related codes
Questions
How do I change the key of an IMS segment?
You can't do it with REPL. Delete the segment and insert it again with the new key, along with any dependents you need to keep.
Does DLET also check the key?
Yes. If the key in the I/O area doesn't match the held segment, DLET returns DA and nothing is deleted.
I didn't change the key. Why do I get DA?
Check whether the get hold call returned the segment you think it did, and whether the copybook matches the segment layout. Either can leave a different key in the I/O area.