Hello all, I have a question on how best to approach returning the status of multiple jobs, contained within a larger job in SAS DI Studio (4.904). I have multiple, separate jobs, to be run from a 'controller', or master, job that is scheduled on our enterprise SAS (scheduling on SAS is outside of my control). For example, the following four jobs are run from my master job. UpdateDepartments UpdatePersonnel UpdatePayroll UpdateOfficeSpaces While the jobs are run together, each of the jobs is independent -- if UpdateDepartments fails, it does not necessarily mean that UpdatePersonnel or UpdatePayroll will fail. Upon completion of the master job, I send out an e-mail with information on the jobs that successfully ran. Currently, as part of the e-mail, I am returning (or attempting to return) the status of each job. Right now, if a job fails, the email returns ALL the jobs that were run successfully up until the first failure -- so, for example, if UpdateDepartment and UpdatePersonnel run successfully, and UpdatePayroll fails, the e-mail will return an output table with UpdateDepartment and UpdatePersonnel, but not UpdateOfficeSpaces, even if it successfully ran (because it occurred after the first failure, UpdatePayroll). I am generating this information based on the job_rc variable. After each sub-job (UpdateDepartment, UpdatePersonnel, etc.) runs, in their post-code, I run a macro (CheckSASJobStatus) that inserts the job's name into a SAS work table (and my e-mail prints out that work table). My understanding is that, after the first failure, job_rc will always be a '5', since it defaults to the highest, which is why I am only getting jobs listed up until the first failure (because my conditional only applies when the job_rc code is equal to 0, the jobs after the first failure never get inserted into the table). Is there a paradigm for returning this -- that is, get the return code for individual jobs within the overall job? Below is the macro I am using (note that I pass a parameter, var_version to it, and append it to the job name, as a way of keeping track of which version of the job I am working on, as we currently don't have git enabled...so you may end up with something like UpdateOfficeSpaces_1.3). %MACRO CheckSASJobStatus(var_version);
%if (&job_rc eq 0) %then
%do;
%let job_c=&etls_jobname._;
%let job_tag=&job_c&var_version;
proc sql;
insert into work.completed_sas_steps(sas_job, sas_job_completed)
values("&job_tag", %sysfunc(datetime()));
quit;
%end;
%MEND CheckSASJobStatus;
... View more