KMoody
Member
string_util.cls
scn-00.p
When I tried to run the following script:
...I got this error:
I made sure to compile all of the code in the same directory.
Any idea why I'm getting this error?
Code:
/* PROGRAM I.D. = string_util.CLS 06/20/2013
**
** Provides standard string/character manipulation functions.
**
*/
CLASS string_util:
CONSTRUCTOR STATIC string_util():
END CONSTRUCTOR.
METHOD PUBLIC STATIC CHARACTER EXTENT split(INPUT i_c AS CHARACTER, INPUT separator AS CHARACTER):
DEF VAR ii AS INT.
DEF VAR separatorIndex AS INT.
DEF VAR carray AS CHAR EXTENT.
DEF VAR cresult AS CHARACTER.
DEF VAR numEntries AS INT.
cresult = i_c.
numEntries = NUM-ENTRIES(i_c, separator).
/* MESSAGE numEntries.*/
IF numEntries > 0 THEN DO:
EXTENT( carray ) = NUM-ENTRIES(i_c, separator).
DO ii = 1 TO NUM-ENTRIES(i_c, separator):
separatorIndex = INDEX(cresult,separator).
IF separatorIndex > 0 THEN DO:
carray[ ii ] = RIGHT-TRIM(SUBSTRING(cresult, 1, separatorIndex),separator).
cresult = SUBSTRING(cresult,separatorIndex).
cresult = SUBSTRING(cresult, 2).
END.
ELSE carray[ ii ] = cresult.
END.
END.
RETURN carray.
END METHOD.
METHOD PUBLIC STATIC CHARACTER getFileNameExtension(INPUT i_c AS CHARACTER):
DEF VAR extArray AS CHAR EXTENT.
extArray = split(i_c,".").
IF EXTENT(extArray) EQ 0 THEN
RETURN "".
ELSE
RETURN extArray[EXTENT(extArray)].
END METHOD.
METHOD PUBLIC STATIC CHARACTER removeFileNameExtension(INPUT i_c AS CHARACTER):
DEF VAR extIndex AS INTEGER.
DEF VAR name AS CHARACTER.
extIndex = INDEX(i_c,".").
IF extIndex = 0 THEN
name = i_c.
ELSE DO:
name = SUBSTRING(i_c,1,extIndex).
name = RIGHT-TRIM(name,".").
END.
RETURN name.
END METHOD.
METHOD PUBLIC STATIC CHARACTER getFileName(INPUT i_c AS CHARACTER):
DEF VAR a AS CHARACTER EXTENT.
a = split(i_c,"/").
RETURN a[EXTENT(a)].
END METHOD.
END CLASS.
scn-00.p
Code:
MESSAGE string_util:getFileName("crash/abc.e").
When I tried to run the following script:
Code:
exec /usr/dlc/bin/_progres [dbname] -p scn-00.r
...I got this error:
Code:
Static instance failed to load. Cannot reference class string_util. (14631)
I made sure to compile all of the code in the same directory.
Any idea why I'm getting this error?
Last edited: