Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
The various iQuery.GETxxx() UDF return system information as a varchar or integer value.
UDF | Return Type | Description |
GETCPUCOUNT | integer | Returns the number of CPU CORES installed on the system. |
GETCURLIB | varchar(10) | Returns the current library from the library list. |
GETSRLNBR | varchar(10) | Returns the System Serial Number. Similar to RTVSYSVAL SYSVAL(QSRLNBR) |
GETSYSNAME | varchar(10) | Returns the System Name. Similar to RTVNETA SYSNAME(&SYSNAME) |
GETENV | varchar(32739) | Returns the value of an Environment Variable |
With the exception of GETENV(), these UDFs have no input parameter.
Parameter | Type | Description |
Environment Variable Name | varchar(256) | The name of the environment variable whose value is to be returned. |
The GETENV() UTF runs the getenv() API to return the environment value. This API is case-sensitive, therefore the iQuery GETENV() UDF input value is also case sensitive. getenv('java_Home') is not the same as getenv('JAVA_HOME').
The following examples assume the host variables are already declared unless SQL iQuery Script is being used, in which case host variables are auto-created.
values iQuery.getCPUcount() INTO :cores;
values iQuery.getCurLib() INTO :myCURLIB;
values iQuery.getSRLNBR() INTO :SRLNBR;
values iQuery.getSysName() INTO :SysName;
values iQuery.getEnv('JAVA_HOME') INTO :classPath;