SASUnit Examples  Version 1.5.0
endtestcall.sas
Go to the documentation of this file.
1 
25 %MACRO endTestcall();
26 
27  %GLOBAL g_inTestcase;
28  %IF &g_inTestcase NE 1 %THEN %DO;
29  %PUT &g_error.(SASUNIT): endTestcall muss nach InitTestcase aufgerufen werden;
30  %RETURN;
31  %END;
32  %LET g_inTestcase=2;
33 
34  %LOCAL l_casid l_filled l_lstfile;
35 
36  /* restore log and listing of test scenario */
37  %LET g_logfile =&g_log/%substr(00&g_scnid,%length(&g_scnid)).log;
38  %LET g_printfile=&&g_testout/%substr(00&g_scnid,%length(&g_scnid)).lst;
39 
40  PROC PRINTTO
41  LOG="&g_logfile."
42  PRINT="&g_printfile."
43  ;
44  RUN;
45 
46  /* determine and store end time */
47  PROC SQL NOPRINT;
48  SELECT max(cas_id) INTO :l_casid FROM target.cas WHERE cas_scnid=&g_scnid;
49  %LET l_casid = &l_casid;
50  PROC SQL NOPRINT;
51  UPDATE target.cas
52  SET
53  cas_end = %sysfunc(datetime())
54  WHERE
55  cas_scnid = &g_scnid AND
56  cas_id = &l_casid;
57  QUIT;
58 
59  /* delete listing if empty */
60  PROC SQL NOPRINT;
61  SELECT max(cas_id) INTO :l_casid FROM target.cas WHERE cas_scnid=&g_scnid;
62  QUIT;
63  %LET l_casid = &l_casid;
64  %LET l_filled=0;
65  %LET l_lstfile=&g_testout/%substr(00&g_scnid,%length(&g_scnid))_%substr(00&l_casid,%length(&l_casid)).lst;
66  DATA _null_;
67  INFILE "&l_lstfile";
68  INPUT;
69  CALL symput ('l_filled','1');
70  STOP;
71  RUN;
72  %IF NOT &l_filled %THEN %DO;
73  %LET l_filled=%_delfile(&l_lstfile);
74  %END;
75 
76  ODS _ALL_ CLOSE;
77 
78 %MEND endTestcall;