One way to handle this is to determine what your final string the host system will send is, and to create an integer for the other strings. If they are received, they will be marked 1, otherwise they will remain 0.
In this example, the host system would ultimately return to "Make Selection" and possibly send a combination of "ERROR", and "COMPLETED" or "REJECTED" beforehand. Nested "if" statements are used to combine values and affect the next step.
Note that the Integers are global variables, above the Proc Main, so the values will be transmitted between sub routines:
Integer WASERROR, COMPLETED, REJECTED
Proc Main
When Target 1 "ERROR" call MARKERROR
When Target 2 "COMPLETED" call MARKCOMPLETE
When Target 3 "REJECTED" call MARKREJECT
Transmit "^M"
Waitfor "Make Selection" Forever
If COMPLETED == 1
If WASERROR == 1
Transmit "Exit^M"
Else
Transmit "Resend^M"
Endif
Else
If REJECTED == 1
Transmit "Exit^M"
Else
Transmit "Main^M"
Endif
Endif
EndProc
Proc MARKERROR
WASERROR = 1
EndProc
Proc MARKCOMPLETE
COMPLETED = 1
EndProc
Proc MARKREJECT
REJECTED = 1
EndProc
Robert Harris