Published on :
Test SASHELP

Unit test for the mp_reseterror macro

This code is also available in: Deutsch Español Français
Awaiting validation
This program starts by provoking an explicit error by attempting to lock the system table 'sashelp.class' via the LOCK statement (which is forbidden in read-only mode). It then calls the %mp_reseterror macro to clean up the error environment. Finally, the %mp_assert macro is used to verify that the previous macro worked correctly by testing if the automatic variable &syscc has returned to 0.
Data Analysis

Type : SASHELP


Uses 'sashelp.class' as the target to generate a lock error. Produces a results table 'work.test_results'.

1 Code Block
LOCK
Explanation :
Attempts to exclusively lock the sashelp.class table. This operation is intended to fail and raise an error, as SASHELP is generally read-only or used by the system.
Copied!
1lock sashelp.class;
2 Code Block
MACRO
Explanation :
Call to the %mp_reseterror macro to reset the session's error indicators (like &syscc) following the previously provoked error.
Copied!
1%mp_reseterror()
3 Code Block
MACRO Data
Explanation :
Asserts that the system return code (&syscc) is equal to 0, confirming that the error has been cleared. Test results are stored in the 'work.test_results' table.
Copied!
1%mp_assert(
2 iftrue=(&syscc=0),
3 desc=Checking error condition was fixed,
4 outds=work.test_results
5)
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.