Problem Note 2955: Cannot compile Class syntax when argument of MLENGTH function is a class
attribute
If you use SAS Component Language (SCL) to create a SAS/AF class and
specify a class attribute for the argument of the MLENGTH function as
in the following example where ATTRSTR is a character attribute of
class X,
class x;
dcl char(14) attrstr;
m:method;
dcl num len;
len=mlength(attrstr);
put len=;
endmethod;
endclass;
the CLASS/ENDCLASS statement block may not compile and you may see the
following error messages in the Log window:
ERROR: Argument 1 of function MLENGTH must be variable.
ERROR: Compile error(s) detected. No code generated.
Although the MLENGTH function has no effect on the maximum length of a
character attribute when a class is loaded at runtime (see SAS Note
SN002954), you can circumvent this problem by declaring an SCL variable
that is local to the method and whose value is equal to that of the
character attribute. For example,
class x;
dcl char(14) attrstr;
m:method;
dcl num len;
dcl char(14) localstr=_self_.attrstr;
len=mlength(localstr);
put len=
endmethod;
endclass;
Operating System and Release Information
| Product Family | Product | System | Reported Release | Fixed Release* |
| SAS System | SAS/AF | OpenVMS Alpha | 8 TS M0 | 8.2 TS2M0 |
| CMS | 8 TS M0 | 8.2 TS2M0 |
| 64-bit Enabled HP-UX | 8 TS M0 | 8.2 TS2M0 |
| HP-UX | 8 TS M0 | 8.2 TS2M0 |
| ABI+ for Intel Architecture | 8 TS M0 | 8.2 TS2M0 |
| z/OS | 8 TS M0 | 8.2 TS2M0 |
| OS/2 | 8 TS M0 | 8.2 TS2M0 |
| IRIX | 8 TS M0 | 8.2 TS2M0 |
| 64-bit Enabled Solaris | 8 TS M0 | 8.2 TS2M0 |
| Microsoft Windows NT Workstation | 8 TS M0 | 8.2 TS2M0 |
| Microsoft Windows 95/98 | 8 TS M0 | 8.2 TS2M0 |
| OpenVMS VAX | 8 TS M0 | 8.2 TS2M0 |
| Microsoft Windows 2000 Professional | 8 TS M0 | 8.2 TS2M0 |
| Solaris | 8 TS M0 | 8.2 TS2M0 |
| 64-bit Enabled AIX | 8 TS M0 | 8.2 TS2M0 |
| Tru64 UNIX | 8 TS M0 | 8.2 TS2M0 |
| AIX | 8 TS M0 | 8.2 TS2M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Type: | Problem Note |
| Priority: | medium |
| Date Modified: | 2000-10-17 09:29:22 |
| Date Created: | 2000-06-30 13:40:05 |