Program abends when setting *ERROR

I have the following program:

DEFINE DATA LOCAL
1 #RET-CODE-NUM (N4)
END-DEFINE
FORMAT EM=OFF AD=IL
MOVE 0002 TO #RET-CODE-NUM
*ERROR := #RET-CODE-NUM
WRITE ‘=’ #RET-CODE-NUM ‘=’ *ERROR
END

The program abends in the ASSIGN statement.

So, how is *ERROR defined inside NATURAL. By this I mean is it defined as a N4 or something else. Second, why would this program abend on this statement (*ERROR := #RET-CODE-NUM)

:smiley:

Very humorous. You will soon be laughing.

Change the MOVE to MOVE 3145 TO #RET-CODE-NUM

Look at the abend message you get.

Time to laugh.

steve

Yes, I tried that value and a few other values to see what would happen. It looks like NATURAL is trying to find the value in its table of error numbers. So, if a value does not exist, then it abends. What we ended up doing is moving the final WRITE statement before the ASSIGN statement. We did this so that we could see the information from the write statement before we triggered the ABEND!

Partly right; partly wrong.

The main reason to move something to *ERROR is to test out code you have written in an ON ERROR clause. Moving something into *ERROR produces that error. Thus when I suggested 3145, the error message was about a record being held, which of course, is what a 3145 error is.

steve