Macros for SAS Application Developers
https://github.com/sasjs/core
mv_jobflow.test.2.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing mv_jobflow macro
4  @details All jobs complete successfully with syscc = 0 - test to
5  make sure this comes back to the calling session
6 
7  <h4> SAS Macros </h4>
8  @li mp_assert.sas
9  @li mv_createjob.sas
10  @li mv_jobflow.sas
11 **/
12 
13 /**
14  * Test Case 1
15  */
16 filename testprog temp;
17 data _null_;
18  file testprog;
19  put '%put this is job: &_program;'
20  / '%put this was run in flow &flow_id;'
21  / 'data ;'
22  / ' rval=rand("uniform");'
23  / ' rand=rval*&macrovar1;'
24  / ' do x=1 to rand;'
25  / ' y=rand*&macrovar2;'
26  / ' output;'
27  / ' end;'
28  / 'run;'
29  ;
30 run;
31 
32 %mv_createjob(path=/Public/temp,name=demo1,code=testprog)
33 %mv_createjob(path=/Public/temp,name=demo2,code=testprog)
34 
35 data work.inputjobs;
36  _contextName='SAS Job Execution compute context';
37  do flow_id=1 to 2;
38  do i=1 to 4;
39  _program='/Public/temp/demo1';
40  macrovar1=10*i;
41  macrovar2=4*i;
42  output;
43  i+1;
44  _program='/Public/temp/demo2';
45  macrovar1=40*i;
46  macrovar2=44*i;
47  output;
48  end;
49  end;
50 run;
51 
52 * Trigger the flow ;
53 
54 %put NOTE: &=syscc;
55 
56 %mv_jobflow(inds=work.inputjobs
57  ,maxconcurrency=2
58  ,outds=work.results
59  ,outref=myjoblog
60  ,raise_err=1
61  ,mdebug=1
62 )
63 
64 %put NOTE: &=syscc;
65 
66 data _null_;
67  infile myjoblog;
68  input; put _infile_;
69 run;
70 
71 %mp_assert(
72  iftrue=(&syscc eq 0),
73  desc=Check that a zero return code is returned if no called job fails
74 )