You would like to have your application complete the previous generation of the application generated only. This Knowledge Document explains how to complete the previous generation and no others.
This is how it would be coded:
IF ESP_APPL_GEN THEN DO IF NOT COMPLETED THEN - ESPNOMSG AJ ALL APPL(%ESPAPPL..0) TERMINATE
To explain the above from the bottom up:
This will ensure that the application completion will only run when the application is being generated. If this code is not added the "complete the application" routine will run 2 times. Once when the application is generated (generation phase) and again when it runs(process phase). The result would be that the "complete the application" would run at generation phase and complete the previous generation. Then the "complete the application" will run again in the process phase and complete the new created generation. So then no job could ever be run.