Query system configuration information.
Note: The user of this Built-In Function is responsible for any impact it has on any application. No warranty of any kind is expressed or implied. Refer to full Disclaimer.
Function No: |
993 |
DLL Required: |
U_BIF993.DLL |
For use with
|
Arguments
|
Return Values
|
Examples
The following sample RDML function (which can be copied and pasted in the CS/400 free form function editor) queries and displays all possible drive/path combinations:
FUNCTION OPTIONS(*DIRECT)
EXECUTE SUBROUTINE(SHOW_INFO) WITH_PARMS(SYS_DRIV)
EXECUTE SUBROUTINE(SHOW_INFO) WITH_PARMS(SYS_DIR)
EXECUTE SUBROUTINE(SHOW_INFO) WITH_PARMS(SYS_DIR_EXECUTE)
EXECUTE SUBROUTINE(SHOW_INFO) WITH_PARMS(SYS_DIR_OBJECT)
EXECUTE SUBROUTINE(SHOW_INFO) WITH_PARMS(SYS_DIR_SOURCE)
EXECUTE SUBROUTINE(SHOW_INFO) WITH_PARMS(PART_DRIV)
EXECUTE SUBROUTINE(SHOW_INFO) WITH_PARMS(PART_DIR)
EXECUTE SUBROUTINE(SHOW_INFO) WITH_PARMS(PART_DIR_EXECUTE)
EXECUTE SUBROUTINE(SHOW_INFO) WITH_PARMS(PART_DIR_OBJECT)
EXECUTE SUBROUTINE(SHOW_INFO) WITH_PARMS(PART_DIR_SOURCE)
EXECUTE SUBROUTINE(SHOW_INFO) WITH_PARMS(TEMP_DRIV)
EXECUTE SUBROUTINE(SHOW_INFO) WITH_PARMS(TEMP_DIR)
********** COMMENT(Display subroutine)
SUBROUTINE NAME(SHOW_INFO) PARMS( OV_QUERY)
DEFINE FIELD(#OV_QUERY) TYPE(*CHAR) LENGTH(50)
DEFINE FIELD(#OV_RESULT) TYPE(*CHAR) LENGTH(50)
USE BUILTIN(OV_QUERY_SYS_INFO) WITH_ARGS(#OV_QUERY) TO_GET(#OV_RESULT)
DISPLAY FIELDS(#OV_QUERY #OV_RESULT)
ENDROUTINE
This sample displays the drive letters and drive types of all disk drives attached to the current PC. Note that the drive type is returned as REM (Removable drive), FIX (Fixed drive), NET (Network drive), CD (CD-ROM drive) or RAM (RAM Drive).
Under Windows 3.1 the available drives are only classified as type REM, FIX or NET.
Under Windows 95/NT the available drives are only classified as type REM, FIX, NET, CD or RAM.
Note also that in this sample the drive letter is returned as a char(2) in format A:, B:, etc :
FUNCTION OPTIONS(*DIRECT)
DEFINE FIELD(#OV_RESULT) TYPE(*CHAR) LENGTH(50)
DEFINE FIELD(#OV_DRIVE) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#OV_TYPE) TYPE(*CHAR) LENGTH(3)
DEF_LIST NAME(#OV_DRIVD) FIELDS(#OV_DRIVE #OV_TYPE)
DEF_LIST NAME(#OV_DRIVW) FIELDS(#OV_DRIVE #OV_TYPE) TYPE(*WORKING) ENTRYS(26)
********** COMMENT(Extract list off drives and display)
USE BUILTIN(OV_QUERY_SYS_INFO) WITH_ARGS(DRIV_LIST) TO_GET(#OV_RESULT #OV_DRIVW)
CLR_LIST NAMED(#OV_DRIVD)
SELECTLIST NAMED(#OV_DRIVW)
ADD_ENTRY TO_LIST(#OV_DRIVD)
ENDSELECT
DISPLAY BROWSELIST(#OV_DRIVD)
This sample requests that you specify the drive type you are interested in as REM, FIX, NET or ALL and displays all drives of the requested type in a drop down. Note that in this sample the drive letter is returned as a char(1) in format A, B, C, etc :
FUNCTION OPTIONS(*DIRECT)
DEFINE FIELD(#OV_RESULT) TYPE(*CHAR) LENGTH(50)
DEFINE FIELD(#OV_DRIVE) TYPE(*CHAR) LENGTH(1) INPUT_ATR(DDHD)
DEFINE FIELD(#OV_WDRIVE) TYPE(*CHAR) LENGTH(1)
DEFINE FIELD(#OV_TYPE) TYPE(*CHAR) LENGTH(3)
DEFINE FIELD(#OV_WTYPE) TYPE(*CHAR) LENGTH(3)
DEFINE FIELD(#OV_RC) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#OV_WCOUNT) TYPE(*DEC) LENGTH(7) DECIMALS(0) DEFAULT(*zero)
DEF_LIST NAME(#OV_DRIVW) FIELDS(#OV_WDRIVE #OV_WTYPE) TYPE(*WORKING) ENTRYS(26)
DEF_COND NAME(*SHOWDRIV) COND('#OV_wcount *gt 0')
********** COMMENT(Request type to be shown in Drop Down)
BEGIN_LOOP
REQUEST FIELDS(#OV_TYPE (#OV_DRIVE *SHOWDRIV))
BEGINCHECK
VALUECHECK FIELD(#OV_TYPE) WITH_LIST('REM' 'FIX' 'NET' 'ALL') MSGTXT('Type must be REM, FIX, NET or ALL')
ENDCHECK
********** COMMENT(Extract list off drives and display)
USE BUILTIN(OV_QUERY_SYS_INFO) WITH_ARGS(DRIV_LIST) TO_GET(#OV_RESULT #OV_DRIVW)
USE BUILTIN(DROP_DD_VALUES) WITH_ARGS(DDHD) TO_GET(#OV_RC)
CHANGE FIELD(#OV_WCOUNT #OV_DRIVE) TO(*NULL)
SELECTLIST NAMED(#OV_DRIVW)
IF COND('(#OV_type = #OV_wtype) *or (#OV_type = ALL)')
CHANGE FIELD(#OV_WCOUNT) TO('#OV_wcount + 1')
USE BUILTIN(ADD_DD_VALUES) WITH_ARGS(DDHD *BLANKS #OV_WDRIVE) TO_GET(#OV_RC)
IF_NULL FIELD(#OV_DRIVE)
CHANGE FIELD(#OV_DRIVE) TO(#OV_WDRIVE)
ENDIF
ENDIF
ENDSELECT
IF COND('#OV_wcount <= 0')
MESSAGE MSGTXT('No drives of the requested type exist on (or are accessible to) this system')
ENDIF
END_LOOP