Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mv_jobflow.test.3.sas
Go to the documentation of this file.
1/**
2
3 @file
4 @brief Testing mv_jobflow macro
5 @details A job parameter value may contain any character. A value holding a
6 double quote is escaped when the paramstring is built, and the escaping shifts
7 how the macro processor pairs quotes - a single quote in the value then reads
8 as an unterminated literal and stops the flow. The flow must still submit the
9 job, and the value must arrive in the child session intact.
10
11 <h4> SAS Macros </h4>
12 @li mp_assert.sas
13 @li mv_createjob.sas
14 @li mv_jobflow.sas
15
16**/
17
18/**
19 * Test Case 1 - parameter value with a double quote and an odd number of
20 * single quotes
21 */
22
23data _null_;
24 length v $200;
25 dq=byte(34);
26 v=cats(dq,"'=the formula with leading apostrophe",dq);
27 call symputx('quoteval',v);
28run;
29
30filename testprog temp;
31data _null_;
32 file testprog;
33 put 'data _null_;'
34 / ' x=symget("quoteval");'
35 / ' put "received: " x;'
36 / 'run;'
37 ;
38run;
39
40%mv_createjob(path=&mcTestAppLoc,name=quotejob,code=testprog)
41
42data work.inputjobs;
43 _contextName="&mcTestContext";
44 _program="&mcTestAppLoc/quotejob";
45 quoteval=symget('quoteval');
46run;
47
48* Trigger the flow ;
49
50%mv_jobflow(inds=work.inputjobs
51 ,maxconcurrency=1
52 ,outds=work.results
53 ,outref=myjoblog
54 ,raise_err=1
55 ,mdebug=1
56)
57
58%mp_assert(
59 iftrue=(&syscc=0),
60 desc=Checking the flow runs when a parameter value has an odd number of quotes
61)
62
63data _null_;
64 infile myjoblog end=eof;
65 retain found 0;
66 input;
67 if index(_infile_,"the formula with leading apostrophe") then found=1;
68 if eof then call symputx('foundval',found);
69run;
70
71%mp_assert(
72 iftrue=(&foundval=1),
73 desc=Checking the parameter value arrived in the child job
74)