Pages

Wednesday, March 10, 2021

Retrieve System Values from SQL - IBM i

System Values

System values contain the control information related to the IBM i OS or parts of OS. 

System values are used to control or define the way working environment is setup on the system. For example, setting up time zone, default system library list, number of jobs allowed and so on...

System values can be accessed either from IBM Navigator for i or by using DSPSYSVAL (Display System Value) command. And, the same can be accessed from a program either by using RTVSYSVAL (Retrieve System Value) CL command or QWCRSVAL (Retrieve System Values) API. 

One other way of accessing this information from SQL is by using view 'SYSTEM_VALUE_INFO' present in QSYS2 library (System name for this view is SYSVALINFO).

SYSTEM_VALUE_INFO view has got the below three columns.
  • SYSTEM_VALUE_NAME - Name of the system value
  • CURRENT_NUMERIC_VALUE - System value, if numeric. if not, contains NULL. 
  • CURRENT_CHARACTER_VALUE - System value, if character. if not, contains NULL.
We can use these columns to query the system value we are looking for (like any other SELECT query). 

For example, let's have a look at the list of system values contain information related to date. 

Retrieve System Values from SQL - IBM i

In the above query, 
  • We are using the SELECT query on view SYSTEM_VALUE_INFO. 
  • WHERE condition on SYSTEM_VALUE_NAME column to check the values containing 'DAT'. 
All the values returned are in character format, so system value is returned in the column 'CURRENT_CHARACTER_VALUE' and column 'CURRENT_NUMERIC_VALUE' is NULL. 


If you have any Suggestions or Feedback, Please leave a comment below or use Contact Form. 

No comments:

Post a Comment

Popular Posts