OV_SYSTEM_SERVICE
Þ Note: Built-In Function Rules
Performs a basic system service.
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: |
991 |
DLL Required: |
U_BIF991.DLL |
For use with
|
Arguments
|
Return Values
|
Example
The following sample RDML function (which can be copied and pasted into the L4W free form function editor) requests that you specify a program (.EXE) name and any parameters to be passed to it. An attempt is then made to start the specified program executing:
FUNCTION OPTIONS(*DIRECT);
DEFINE FIELD(#OV_PGM) TYPE(*CHAR) LENGTH(50) LABEL('Program');
DEFINE FIELD(#OV_PARMS) TYPE(*CHAR) LENGTH(50) LABEL('Parameters') INPUT_ATR(LC);
DEFINE FIELD(#OV_RETC) TYPE(*CHAR) LENGTH(2) LABEL('Return Code');
DEFINE FIELD(#OV_ERRN) TYPE(*DEC) LENGTH(7) DECIMALS(0) LABEL('Error Code');
**********;
BEGIN_LOOP;
REQUEST FIELDS(#OV_PGM #OV_PARMS (#OV_RETC *OUT) (#OV_ERRN *OUT));
USE BUILTIN(OV_SYSTEM_SERVICE) WITH_ARGS(START #OV_PGM #OV_PARMS) TO_GET(#OV_RETC #OV_ERRN);
IF COND('#OV_RETC = OK');
MESSAGE MSGTXT('Program started');
ELSE;
MESSAGE MSGTXT('Error detected when attempting to start program');
ENDIF;
END_LOOP;
The following sample RDML function requests that you specify up to 100 lines of text. The lines you specify are transferred into a file, and then either the EPM (OS/2) or NOTEPAD (Windows) source line editors are started against the file created:
FUNCTION OPTIONS(*DIRECT);
DEFINE FIELD(#OV_TEMP) TYPE(*CHAR) LENGTH(20) LABEL('Temp File Name') DEFAULT('C:\TEMP.TXT');
DEFINE FIELD(#OV_EDITOR) TYPE(*CHAR) LENGTH(20) LABEL('Editor Name');
IF COND('*CPUTYPE = OS2');
CHANGE FIELD(#OV_EDITOR) TO(EPM);
ELSE;
CHANGE FIELD(#OV_EDITOR) TO(NOTEPAD);
ENDIF;
DEFINE FIELD(#OV_RETC) TYPE(*CHAR) LENGTH(2) LABEL('Return Code');
DEFINE FIELD(#OV_TEXT) TYPE(*CHAR) LENGTH(70) COLHDG('Text Details');
DEF_LIST NAME(#OV_LISTD) FIELDS(#OV_TEXT);
DEF_LIST NAME(#OV_LISTW) FIELDS(#OV_TEXT) TYPE(*WORKING) ENTRYS(100);
**********;
INZ_LIST NAMED(#OV_LISTD) NUM_ENTRYS(100) WITH_MODE(*CHANGE);
MESSAGE MSGTXT('Type in lines of text to be edited');
REQUEST BROWSELIST(#OV_LISTD);
SELECTLIST NAMED(#OV_LISTD) GET_ENTRYS(*NOTNULL);
ADD_ENTRY TO_LIST(#OV_LISTW);
ENDSELECT;
USE BUILTIN(TRANSFORM_LIST) WITH_ARGS(#OV_LISTW #OV_TEMP C B Y) TO_GET(#OV_RETC);
USE BUILTIN(OV_SYSTEM_SERVICE) WITH_ARGS(START #OV_EDITOR #OV_TEMP);
The following sample RDML function requests that you specify a program (.EXE) name and any parameters to be passed to it. An attempt is then made to start the specified program executing. You may start the application by using the START or the START_UNIQUE option .... thus allowing you to see the differences between these options when starting a program that is already active:
FUNCTION OPTIONS(*DIRECT);
DEFINE FIELD(#OV_PGM) TYPE(*CHAR) LENGTH(50) LABEL('Program') DEFAULT('NOTEPAD.EXE');
DEFINE FIELD(#OV_PARMS) TYPE(*CHAR) LENGTH(50) LABEL('Parameters') INPUT_ATR(LC);
DEFINE FIELD(#OV_RETC) TYPE(*CHAR) LENGTH(2) LABEL('Return Code');
DEFINE FIELD(#OV_ERRN) TYPE(*DEC) LENGTH(7) DECIMALS(0) LABEL('Error Code');
DEFINE FIELD(#OV_REQUST) TYPE(*CHAR) LENGTH(20) LABEL('Start Type') DEFAULT(START_UNIQUE);
**********;
BEGIN_LOOP;
REQUEST FIELDS(#OV_REQUST #OV_PGM #OV_PARMS (#OV_RETC *OUT) (#OV_ERRN *OUT));
BEGINCHECK;
VALUECHECK FIELD(#OV_REQUST) WITH_LIST(START START_UNIQUE) MSGTXT('Request value must be START or START_UNIQUE');
ENDCHECK;
USE BUILTIN(OV_SYSTEM_SERVICE) WITH_ARGS(#OV_REQUST #OV_PGM #OV_PARMS) TO_GET(#OV_RETC #OV_ERRN);
IF COND('#OV_RETC = OK');
MESSAGE MSGTXT('Program started or it is already started');
ELSE;
MESSAGE MSGTXT('Error detected when attempting to start program');
ENDIF;
END_LOOP;