When running an ATTACH_SYNC script to a job that has Generate at Runtime set on the Attributes tab, the job ends not okay as expected with the following error:
U00020604 Runtime error in object 'JOBS.UNIX.TEST.SYNC' line '00001': ATTACH_SYNC is not possible for 'generation at runtime', in this case the Sync checks are done before running the script.
This makes sense. However, if the job is restarted, it works just fine even though it is still using Generate and Runtime.
This behavior is as expected and has to do with the dcmodus or dialog mode. DCMODUS is set to No on the initial start of tasks that have generate at runtime set. On restart, DCMODUS is not set to No, so the Generate at runtime setting does not get evaluated. Because of this, there are some behaviors that happen differently in restarts, which includes ATTACH_SYNC.