Macros for SAS Application Developers
https://github.com/sasjs/core
mv_getjobcode.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing mv_getjobcode macro
4 
5  <h4> SAS Macros </h4>
6  @li mp_assert.sas
7  @li mp_assertscope.sas
8  @li mv_createjob.sas
9  @li mv_getjobcode.sas
10 
11 **/
12 
13 /**
14  * Test Case 1
15  */
16 
17 /* write some code to a job */
18 %let incode=%str(data test; set sashelp.class;run;);
19 filename testref temp;
20 data _null_;
21  file testref;
22  put "&incode";
23 run;
24 %mv_createjob(
25  code=testref,
26  path=&mcTestAppLoc/services/temp,
27  name=some_job
28 )
29 
30 /* now get the code back */
31 %mp_assertscope(SNAPSHOT)
32 %mv_getjobcode(
33  path=&mcTestAppLoc/services/temp,
34  name=some_job,
35  outref=mycode
36 )
37 /* exclude automatic proc json macro variables from scope check */
38 %mp_assertscope(COMPARE,
39  ignorelist=MCLIB2_JADP1LEN MCLIB2_JADP2LEN MCLIB2_JADPNUM MCLIB2_JADVLEN
40  MCLIB2_JADP3LEN
41 )
42 
43 %let diditexist=NO;
44 data work.test1;
45  infile mycode;
46  input;
47  putlog _infile_;
48  line=_infile_;
49  check=symget('incode');
50  if _infile_=symget('incode') then call symputx('diditexist','YES');
51 run;
52 
53 %mp_assert(
54  iftrue=(&diditexist=NO),
55  desc=Check if the code that was sent was successfully retrieved
56 )