I did it with DEFINE/READ WORK FILE. It works, but just only once (ON ERROR). When I come a second time to the
READ WORKFILE statement and ERROR-NR 1599 in my program, this ON ERROR-Block is ignored.
Does my Program “forget” this ON ERROR-BLOCK?
Can you explane me why?
ON ERROR
IF *ERROR-NR = 1599
PROCESS PAGE UPDATE FULL AND SEND EVENT 'nat:page.message'
WITH PARAMETERS
NAME 'type' VALUE 'E'
NAME 'short' VALUE 'No File found'
END-PARAMETERS
END-IF
END-ERROR
ON ERROR is a non procedural clause in Natural. More importantly, it interrupts the execution of a program.
With the exception of a record-held error (3145), which permits execution to continue via RETRY, your program ends after the ON ERROR clause ends.
Thus, for anything to happen again, you must have logic in the ON ERROR clause that continues execution of your “system”. For example, you might FETCH a driver program to your existing program. You could use the stack, or *COM, to “tell” the driver what happened.