By design, the -GRIDWAIT option of SASGSUB does not alter its return code based on the return code of its submitted job.
A wrapper script was written to use -GRIDWAIT to wait for the completion of the job and then use the -GRIDGETSTATUS option to capture the return code of the job as its own.
For additional information, see the following technical support code sample.