Get Serial Number

GetSrlNbr

The GetSrlNbr procedure system serial number.

The GetSrlNbr procedure is used to retrieve the system serial number. Unlike GetSysValue('QSRLNBR') this procedure is a high-speed interface and does not call the QWCRSVAL API.

char-serial-number GetSrlNbr(
  nReserved       5I 0   Const Options(*NOPASS)
)

See also: GetSysValue GetSysName

Parameters

nReserved [ optional ]
[ input Int(2) const ] This parameter is reserved for future use, no value is required, or a value of zero (0) may be specified, but it is ignored.

Return Value

If the function succeeds, the return value is a character value containing the system serial number. As of this writing, the system serial number is stored as an 8-position value, but contains only 7 characters. The serial number is returned left-adjusted (leading blanks removed).

If the function fails, the return value is empty (blank).

Remarks

This procedure can not change the existing system serial number.

Example

To retrieve the system name and serial number, the following code may be used:

      /INCLUDE qcpysrc,sysvalue
.....DName+++++++++++EUDS.......Length+TDc.Functions++++++++++++++++++++++++++
     D SysName         S             10A   
     D SrlNbr          S             10A   
.....CSRn01..............OpCode(ex)Extended-factor2+++++++++++++++++++++++++++
     C                   eval      SysName = GetSysName(0)
     C                   eval      SrlNbr = GetSrlNbr(0)
 

The first calculation specification retrieves the system name, the second line retrieves the CPU serial number. Note that the (0) following both procedure calls is optional. The zero is unnecessary if using OS/400 V5R1 and later.