/****************************************************************************** * Programme : Orchestration et Test de Flux de Jobs SAS Viya * Reference : ORCHESEA21 * Source : https://www.wearecas.eu/de/sampleCode/ORCHESEA21 ******************************************************************************/ /* --- BLOC 1 --- */ filename testprog temp; data _null_; file testprog; put '%put this is job: &_program;' / '%put this was run in flow &flow_id;' / 'data ;' / ' rval=rand("uniform");' / ' rand=rval*¯ovar1;' / ' do x=1 to rand;' / ' y=rand*¯ovar2;' / ' if (rval>0.50) then abort;' / ' else output;' / ' end;' / 'run;' ; run; /* --- BLOC 2 --- */ %mv_createjob(path=/Public/temp,name=demo1,code=testprog) /* --- BLOC 3 --- */ %mv_createjob(path=/Public/temp,name=demo2,code=testprog) /* --- BLOC 4 --- */ data work.inputjobs; _contextName='SAS Job Execution compute context'; do flow_id=1 to 2; do i=1 to 4; _program='/Public/temp/demo1'; macrovar1=10*i; macrovar2=4*i; output; i+1; _program='/Public/temp/demo2'; macrovar1=40*i; macrovar2=44*i; output; end; end; run; /* --- BLOC 5 --- */ %put NOTE: &=syscc; /* --- BLOC 6 --- */ %mv_jobflow(inds=work.inputjobs ,maxconcurrency=2 ,outds=work.results ,outref=myjoblog ,raise_err=1 ,mdebug=1 ) /* --- BLOC 7 --- */ %put NOTE: &=syscc; /* --- BLOC 8 --- */ data _null_; infile myjoblog; input; put _infile_; run; /* --- BLOC 9 --- */ %mp_assert( iftrue=(&syscc ne 0), desc=Check that non zero return code is returned if called job fails ) /* --- BLOC 10 --- */ %let syscc=0;