OV_FILE_SERVICE

Performs basic file and directory services.

All Windows path names support environment variable substitution.

Case sensitivity for file names and paths used in this Built In Function depends platform it is executed on. For example, certain areas of the IFS on IBM i are case sensitive:

Note:
DO NOT ALTER this OV Built-In Function as it is used by LANSA programs. If you create a customized version of this Built-In Function, create a copy and amend the copy.
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:

992

DLL Required:

U_BIF992.DLL

For use with

Visual LANSA for Windows

YES

 

Visual LANSA for Linux

YES

 

LANSA for i

Yes

Only available for RDMLX.

 

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Type of file service required. Pass as one of:

MAKE_DIR  Make Directory.

REMOVE_DIR  Remove Directory.

REMOVE_DIR_TREE  Remove a directory tree recursively. Be careful!

CHECK_DIR  Check if directory exists.

CHECK_FILE  Check if a file exists.

SET_FILE  Set a file's attribute to read only or normal (read/write).

COPY_FILE  Copy a file to another file.

REMOVE_FILE  Remove file.

GET_DIR  Get contents of a directory.

COPY_DIR  Copy a directory and all its sub-directories to another directory. Any matching files in the target directory will be replaced.

COPY_PATTERN  Copy files matching the specified pattern to another directory. Any matching files in the target directory will be replaced.

1

256

 

 

2

A

Opt

Requested Service Argument 1

When Arg 1 is
      Pass this argument as:

MAKE_DIR  Name of directory to be made.

REMOVE_DIR  Name of directory to be removed.

REMOVE_DIR_TREE  Name of the directory to be removed.

CHECK_DIR  Name of directory to be checked for.

CHECK_FILE  Name of file to be checked for.

SET_FILE  Name of file to be set.

COPY_FILE  Name of file to be copied from.

REMOVE_FILE  Name of file to be removed /deleted.

GET_DIR  Name of directory whose contents are to be returned.

COPY_DIR  Name of the directory to be copied.

COPY_PATTERN  Fully qualified path with file pattern to be copied.  Note * is the only wildcard that is supported.

1

256

 

 

3

A

Opt

Requested Service Argument 2.

When Arg 1 is
      Pass this argument as:

MAKE_DIR  Not required. Do not pass.

REMOVE_DIR  Not required. Do not pass.

REMOVE_DIR_TREE  Optional (only supported on MS Windows and Linux).

Pass FORCE to delete every file even if a files is READ-ONLY. Any other value, or no value, will return an error if a file is read-only.

CHECK_DIR  Not required. Do not pass.

CHECK_FILE  Not required. Do not pass.

SET_FILE  Pass as READ_ONLY or NORMAL.

COPY_FILE  Name of file to be copied to.

REMOVE_FILE  Optional. (only supported on 32 bit MS Windows)

Pass FORCE to delete every file even if a file is READ-ONLY. Any other value, or no value, will return an error if a file is read-only.

GET_DIR  Optional file suffix to select files of only a specific type when retrieving the contents of a directory (e.g: DLL, EXE, DOC).

Do not pass or pass as blanks to select all files.

COPY_DIR  Name of the directory to be copied to.

COPY_PATTERN  Name of the directory to be copied to.

1

256

 

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Opt

Basic Return Code.
OK = Completed normally.
ER = Error occurred.

2

2

 

 

2

N

Opt

Extended Error Code. This is the operating system error code (when available) that may aid you in error handling or error reporting.

1

15

0

0

3

List

Opt

Returned working List. This list is only returned for certain argument 1 values as follows :

MAKE_DIR  Not returned.

REMOVE_DIR  Not returned.

REMOVE_DIR_TREE  Not returned.

CHECK_DIR  Not returned.

CHECK_FILE Not returned.

SET_FILE  Not returned.

COPY_FILE  Not returned.

REMOVE_FILE  Not returned.

GET_DIR  The working list that is to contain the contents of the directory. It can contain from 1 to 7 fields (i.e. columns) which will be returned as the full file name.
These are:
the real name (full file name)
the file name (without suffix),
the file suffix,
the file date (format YYYYMMDD),
the file time (format HHMMSS),
the file size (which must be a numeric field),
a (sub)directory indicator (which is returned as Y or N) and
Existing contents of this working lists are cleared by this Built-In Function. Refer to the following example for more information.

COPY_DIR  Not returned.

COPY_PATTERN  Not returned.

 

 

 

 

 

Examples

The following sample RDML function (which can be copied and pasted in the CS/400 free form function editor) requests that you specify a directory name and then attempts to create it. The basic and extended return codes from the attempt to create the directory are displayed:

FUNCTION OPTIONS(*DIRECT)
DEFINE FIELD(#OV_DIRECT) TYPE(*CHAR) LENGTH(65)

DEFINE FIELD(#OV_RETC) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#OV_ERRNO) TYPE(*DEC) LENGTH(7) DECIMALS(0) EDIT_CODE(4)
BEGIN_LOOP
MESSAGE MSGTXT('Specify name of directory to be created')
REQUEST FIELDS((#OV_DIRECT *NOID))
USE BUILTIN(OV_FILE_SERVICE) WITH_ARGS(MAKE_DIR #OV_DIRECT) TO_GET(#OV_RETC #OV_ERRNO)
MESSAGE MSGTXT('Response from OV_FILE_SERVICE')
POP_UP FIELDS(#OV_RETC #OV_ERRNO)
END_LOOP

The following sample RDML function (which can be copied and  pasted in the CS/400 free form function editor) creates a directory called C:\OV_DEMO and then creates directories A, B, C and D within it. It then destroys all the directories created. Note that this is done in reverse order because a directory must be empty to be removed (destroyed):

FUNCTION OPTIONS(*DIRECT)
EXECUTE SUBROUTINE(DIRECT) WITH_PARMS(MAKE_DIR 'C:\OV_DEMO')
EXECUTE SUBROUTINE(DIRECT) WITH_PARMS(MAKE_DIR 'C:\OV_DEMO\A')
EXECUTE SUBROUTINE(DIRECT) WITH_PARMS(MAKE_DIR 'C:\OV_DEMO\B')
EXECUTE SUBROUTINE(DIRECT) WITH_PARMS(MAKE_DIR 'C:\OV_DEMO\C')
EXECUTE SUBROUTINE(DIRECT) WITH_PARMS(MAKE_DIR 'C:\OV_DEMO\D')
MESSAGE MSGTXT('Directories all created .... use OK to delete them now')
POP_UP FIELDS((#DATE *L3 *P2)) AT_LOC(8 23) WITH_SIZE(55 10) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO)
EXECUTE SUBROUTINE(DIRECT) WITH_PARMS(REMOVE_DIR 'C:\OV_DEMO\A')
EXECUTE SUBROUTINE(DIRECT) WITH_PARMS(REMOVE_DIR 'C:\OV_DEMO\B')
EXECUTE SUBROUTINE(DIRECT) WITH_PARMS(REMOVE_DIR 'C:\OV_DEMO\C')
EXECUTE SUBROUTINE(DIRECT) WITH_PARMS(REMOVE_DIR 'C:\OV_DEMO\D')
EXECUTE SUBROUTINE(DIRECT) WITH_PARMS(REMOVE_DIR 'C:\OV_DEMO')
MESSAGE MSGTXT('Directories all deleted .... use OK to end this function')
POP_UP FIELDS((#DATE *L3 *P2)) AT_LOC(8 23) WITH_SIZE(55 10) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO)

SUBROUTINE NAME(DIRECT) PARMS((#OV_SERV *RECEIVED) (#OV_DIRECT *RECEIVED))
DEFINE FIELD(#OV_SERV) TYPE(*CHAR) LENGTH(20)
DEFINE FIELD(#OV_DIRECT) TYPE(*CHAR) LENGTH(65)
DEFINE FIELD(#OV_RETC) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#OV_ERRNO) TYPE(*DEC) LENGTH(7) DECIMALS(0) EDIT_CODE(4)
USE BUILTIN(OV_FILE_SERVICE) WITH_ARGS(#OV_SERV #OV_DIRECT) TO_GET(#OV_RETC #OV_ERRNO)
IF COND('#OV_RETC *NE OK')
DISPLAY FIELDS(#OV_SERV (#OV_DIRECT *NOID) #OV_RETC #OV_ERRNO) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO)
ABORT MSGTXT('Directory Operation failed')
ENDIF
ENDROUTINE

The following sample RDML function (which can be copied and  pasted in the CS/400 free form function editor) asks you to nominate a directory name. If it does not already exist you are prompted as to whether you want to create it:

FUNCTION OPTIONS(*DIRECT)
DEFINE FIELD(#OV_DIRECT) TYPE(*CHAR) LENGTH(70)
DEFINE FIELD(#OV_RETC) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#OV_MBA) TYPE(*CHAR) LENGTH(1)
BEGIN_LOOP
REQUEST FIELDS((#OV_DIRECT *NOID))
USE BUILTIN(OV_FILE_SERVICE) WITH_ARGS(CHECK_DIR #OV_DIRECT) TO_GET(#OV_RETC)
IF COND('#OV_RETC = OK')
MESSAGE MSGTXT('This directory already exists')
ELSE
USE BUILTIN(OV_MESSAGE_BOX) WITH_ARGS('Do you want to create this directory ?' 'Create ?' YN Q) TO_GET(#OV_MBA)
IF COND('#OV_MBA = Y')
USE BUILTIN(OV_FILE_SERVICE) WITH_ARGS(MAKE_DIR #OV_DIRECT) TO_GET(#OV_RETC)
IF COND('#OV_RETC *NE OK')
MESSAGE MSGTXT('Attempt to create directory failed')
ENDIF
ENDIF
ENDIF
END_LOOP

The following sample RDML function (which can be copied and  pasted in the CS/400 free form function editor) asks you to nominate a file name and then indicates whether or not the file exists:

FUNCTION OPTIONS(*DIRECT)
DEFINE FIELD(#OV_DIRECT) TYPE(*CHAR) LENGTH(70)
DEFINE FIELD(#OV_RETC) TYPE(*CHAR) LENGTH(2)
BEGIN_LOOP
MESSAGE MSGTXT('Specify name of file whose existence is to be checked for')
REQUEST FIELDS((#OV_DIRECT *NOID))
USE BUILTIN(OV_FILE_SERVICE) WITH_ARGS(CHECK_FILE #OV_DIRECT) TO_GET(#OV_RETC)
IF COND('#OV_RETC = OK')
MESSAGE MSGTXT('This file exists')
ELSE
MESSAGE MSGTXT('This file does NOT exist')
ENDIF
DISPLAY FIELDS((#OV_DIRECT *NOID))
END_LOOP

The following sample RDML function (which can be copied and  pasted in the CS/400 free form function editor) asks you to nominate a file name and whether the file should be set to read only status or normal (read/write) status:

FUNCTION OPTIONS(*DIRECT)
DEFINE FIELD(#OV_FILE) TYPE(*CHAR) LENGTH(70)
DEFINE FIELD(#OV_READ) TYPE(*CHAR) LENGTH(1) LABEL('Read Only') INPUT_ATR(RB01) DEFAULT(1)
DEFINE FIELD(#OV_NORM) TYPE(*CHAR) LENGTH(1) LABEL('Normal') INPUT_ATR(RB01) DEFAULT(0)
DEFINE FIELD(#OV_RETC) TYPE(*CHAR) LENGTH(2)
**********
BEGIN_LOOP
MESSAGE MSGTXT('Specify name of file whose attribute is to be changed and select attribute')
REQUEST FIELDS((#OV_FILE *L3 *P2 *NOID) (#OV_READ *L5 *P3) (#OV_NORM *L7 *P3))
IF COND('#ov_read = ''1''')
USE BUILTIN(OV_FILE_SERVICE) WITH_ARGS(SET_FILE #OV_FILE READ_ONLY) TO_GET(#OV_RETC)
ELSE
USE BUILTIN(OV_FILE_SERVICE) WITH_ARGS(SET_FILE #OV_FILE NORMAL) TO_GET(#OV_RETC)
ENDIF
IF COND('#OV_RETC = OK')
MESSAGE MSGTXT('File attribute successfully changed')
ELSE
MESSAGE MSGTXT('ERROR : File attribute was NOT changed')
ENDIF
END_LOOP

The following sample RDML function (which can be copied and  pasted in the CS/400 free form function editor) asks you to nominate a from and to file name and then attempts to perform a copy operation:

FUNCTION OPTIONS(*DIRECT)
DEFINE FIELD(#OV_FROM) TYPE(*CHAR) LENGTH(60) DEFAULT('C:\CONFIG.SYS')
DEFINE FIELD(#OV_TO) TYPE(*CHAR) LENGTH(60) DEFAULT('C:\CONFIG.SAV')
DEFINE FIELD(#OV_RETC) TYPE(*CHAR) LENGTH(2)
**********
BEGIN_LOOP
MESSAGE MSGTXT('Specify the from and to file names')
REQUEST FIELDS(#OV_FROM #OV_TO)
USE BUILTIN(OV_FILE_SERVICE) WITH_ARGS(COPY_FILE #OV_FROM #OV_TO) TO_GET(#OV_RETC)
IF COND('#OV_RETC = OK')
MESSAGE MSGTXT('File copied')
ELSE
MESSAGE MSGTXT('ERROR : File was NOT copied correctly')
ENDIF
END_LOOP

The following sample RDML function asks you to nominate a directory name and then retrieves and displays its contents. The resulting contents display can be sorted into various orders. This example can be copied and  pasted into the CS/400 free form editor but the long REQUEST command may have to be "unfolded" before the function will be accepted as valid RDML code:

FUNCTION OPTIONS(*DIRECT)
DEFINE FIELD(#OV_DIRECT) TYPE(*CHAR) LENGTH(70)
DEFINE FIELD(#OV_FILTER) TYPE(*CHAR) LENGTH(3) LABEL('Optional Filter')
DEFINE FIELD(#OV_BYTES) TYPE(*DEC) LENGTH(9) DECIMALS(0) LABEL('Total of Sizes') EDIT_CODE(3)
DEFINE FIELD(#OV_OBJECT) TYPE(*DEC) LENGTH(7) DECIMALS(0) LABEL('Total Objects') EDIT_CODE(3)
DEF_COND NAME(*OBJECTS) COND('#ov_object *gt 0')
DEFINE FIELD(#OV_RETC) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#OV_ERRN) TYPE(*DEC) LENGTH(15) DECIMALS(0)
DEFINE FIELD(#OV_NAME) TYPE(*CHAR) LENGTH(15)
DEFINE FIELD(#OV_PREFIX) TYPE(*CHAR) LENGTH(12)
DEFINE FIELD(#OV_SUFFIX) TYPE(*CHAR) LENGTH(3)
DEFINE FIELD(#OV_DATE) TYPE(*CHAR) LENGTH(8)
DEFINE FIELD(#OV_TIME) TYPE(*CHAR) LENGTH(6)
DEFINE FIELD(#OV_ISDIR) TYPE(*CHAR) LENGTH(1)
DEFINE FIELD(#OV_SIZE) TYPE(*DEC) LENGTH(9) DECIMALS(0) EDIT_CODE(3)
DEFINE FIELD(#OV_PB01) TYPE(*CHAR) LENGTH(30) INPUT_ATR(PB01) DEFAULT('''Order By Name''')
DEFINE FIELD(#OV_PB02) TYPE(*CHAR) LENGTH(30) INPUT_ATR(PB02) DEFAULT('''Order By Suffix''')
DEFINE FIELD(#OV_PB03) TYPE(*CHAR) LENGTH(30) INPUT_ATR(PB03) DEFAULT('''Order By Date/Time''')
DEFINE FIELD(#OV_PB04) TYPE(*CHAR) LENGTH(30) INPUT_ATR(PB04) DEFAULT('''Order By Size''')
DEF_LIST NAME(#WLIST) FIELDS(#OV_NAME #OV_PREFIX #OV_SUFFIX #OV_DATE #OV_TIME #OV_SIZE #OV_ISDIR) TYPE(*WORKING) ENTRYS(5000)
DEF_LIST NAME(#DLIST) FIELDS(#OV_NAME #OV_PREFIX #OV_SUFFIX #OV_DATE #OV_TIME #OV_SIZE #OV_ISDIR) COUNTER(#OV_OBJECT)
**********
EXECUTE SUBROUTINE(WTOD)
BEGIN_LOOP
REQUEST FIELDS((#OV_DIRECT *L3 *P2 *NOID) (#OV_FILTER *L4 *P2) (#OV_PB01 *L6 *P2 *NOID *OBJECTS *IOCOND) (#OV_PB02 *L8 *P2 *NOID *OBJECTS *IOCOND) (#OV_PB03 *L6 *P38 *NOID *OBJECTS *IOCOND)
               (#OV_PB04 *L8 *P38 *NOID *OBJECTS *IOCOND) (#OV_BYTES *L4 *P22 *OUT) (#OV_OBJECT *L4 *P49 *OUT)) BROWSELIST(#DLIST)
CASE OF_FIELD(#IO$KEY)
WHEN VALUE_IS('= B1')
SORT_LIST NAMED(#WLIST) BY_FIELDS(#OV_NAME)
EXECUTE SUBROUTINE(WTOD)
WHEN VALUE_IS('= B2')
SORT_LIST NAMED(#WLIST) BY_FIELDS(#OV_SUFFIX #OV_PREFIX)
EXECUTE SUBROUTINE(WTOD)
WHEN VALUE_IS('= B3')
SORT_LIST NAMED(#WLIST) BY_FIELDS(#OV_DATE #OV_TIME)
EXECUTE SUBROUTINE(WTOD)
WHEN VALUE_IS('= B4')
SORT_LIST NAMED(#WLIST) BY_FIELDS(#OV_SIZE)
EXECUTE SUBROUTINE(WTOD)
OTHERWISE
USE BUILTIN(OV_FILE_SERVICE) WITH_ARGS(GET_DIR #OV_DIRECT #OV_FILTER) TO_GET(#OV_RETC #OV_ERRN #WLIST)
IF COND('#OV_RETC =  OK')
EXECUTE SUBROUTINE(WTOD)
ELSE
MESSAGE MSGTXT('ERROR: Unable to list specified directory ')
ENDIF
ENDCASE
END_LOOP
**********
SUBROUTINE NAME(WTOD)
CLR_LIST NAMED(#DLIST)
CHANGE FIELD(#OV_BYTES) TO(0)
SELECTLIST NAMED(#WLIST)
CHANGE FIELD(#OV_BYTES) TO('#ov_bytes + #ov_size')
ADD_ENTRY TO_LIST(#DLIST) WITH_MODE(*DISPLAY)
ENDSELECT
ENDROUTINE

The following sample RDML function asks you to nominate a directory name and then retrieves and displays its contents. The resulting contents display can be sorted into various orders. By double clicking on a displayed file name you can delete it. File deletion requests must be confirmed by clicking "Yes" in a message box. This example can be copied and  pasted into the CS/400 free form editor but the long REQUEST command may have to be "unfolded" before the function will be accepted as valid RDML code:

FUNCTION OPTIONS(*DIRECT)
DEFINE FIELD(#OV_DIRECT) TYPE(*CHAR) LENGTH(70)
DEFINE FIELD(#OV_PIRECT) REFFLD(#OV_DIRECT)
DEFINE FIELD(#OV_FILTER) TYPE(*CHAR) LENGTH(3) LABEL('Optional Filter')
DEFINE FIELD(#OV_BYTES) TYPE(*DEC) LENGTH(9) DECIMALS(0) LABEL('Total of Sizes') EDIT_CODE(3)
DEFINE FIELD(#OV_OBJECT) TYPE(*DEC) LENGTH(7) DECIMALS(0) LABEL('Total Objects') EDIT_CODE(3)
DEFINE FIELD(#OV_SELECT) TYPE(*DEC) LENGTH(7) DECIMALS(0)
DEF_COND NAME(*OBJECTS) COND('#ov_object *gt 0')
DEFINE FIELD(#OV_RETC) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#OV_ERRN) TYPE(*DEC) LENGTH(15) DECIMALS(0)
DEFINE FIELD(#OV_NAME) TYPE(*CHAR) LENGTH(15)
DEFINE FIELD(#OV_PREFIX) TYPE(*CHAR) LENGTH(12)
DEFINE FIELD(#OV_SUFFIX) TYPE(*CHAR) LENGTH(3)
DEFINE FIELD(#OV_DATE) TYPE(*CHAR) LENGTH(8)
DEFINE FIELD(#OV_TIME) TYPE(*CHAR) LENGTH(6)
DEFINE FIELD(#OV_ISDIR) TYPE(*CHAR) LENGTH(1)
DEFINE FIELD(#OV_SIZE) TYPE(*DEC) LENGTH(9) DECIMALS(0) EDIT_CODE(3)
DEFINE FIELD(#OV_PB01) TYPE(*CHAR) LENGTH(30) INPUT_ATR(PB01) DEFAULT('''Order By Name''')
DEFINE FIELD(#OV_PB02) TYPE(*CHAR) LENGTH(30) INPUT_ATR(PB02) DEFAULT('''Order By Suffix''')
DEFINE FIELD(#OV_PB03) TYPE(*CHAR) LENGTH(30) INPUT_ATR(PB03) DEFAULT('''Order By Date/Time''')
DEFINE FIELD(#OV_PB04) TYPE(*CHAR) LENGTH(30) INPUT_ATR(PB04) DEFAULT('''Order By Size''')
DEF_LIST NAME(#WLIST) FIELDS(#OV_NAME #OV_PREFIX #OV_SUFFIX #OV_DATE #OV_TIME #OV_SIZE #OV_ISDIR) TYPE(*WORKING) ENTRYS(5000)
DEF_LIST NAME(#DLIST) FIELDS(#OV_NAME #OV_PREFIX #OV_SUFFIX #OV_DATE #OV_TIME #OV_SIZE #OV_ISDIR) COUNTER(#OV_OBJECT) SEL_ENTRY(#OV_SELECT)
**********
BEGIN_LOOP
CHANGE FIELD(#OV_PIRECT) TO(#OV_DIRECT)
REQUEST FIELDS((#OV_DIRECT *L3 *P2 *NOID) (#OV_FILTER *L4 *P2) (#OV_PB01 *L6 *P2 *NOID *OBJECTS *IOCOND) (#OV_PB02 *L8 *P2 *NOID *OBJECTS *IOCOND) (#OV_PB03 *L6 *P38 *NOID *OBJECTS *IOCOND)
               (#OV_PB04 *L8 *P38 *NOID *OBJECTS *IOCOND) (#OV_BYTES *L4 *P22 *OUT) (#OV_OBJECT *L4 *P49 *OUT)) BROWSELIST(#DLIST)
CASE OF_FIELD(#IO$KEY)
WHEN VALUE_IS('= B1')
SORT_LIST NAMED(#WLIST) BY_FIELDS(#OV_NAME)
EXECUTE SUBROUTINE(WTOD)
WHEN VALUE_IS('= B2')
SORT_LIST NAMED(#WLIST) BY_FIELDS(#OV_SUFFIX #OV_PREFIX)
EXECUTE SUBROUTINE(WTOD)
WHEN VALUE_IS('= B3')
SORT_LIST NAMED(#WLIST) BY_FIELDS(#OV_DATE #OV_TIME)
EXECUTE SUBROUTINE(WTOD)
WHEN VALUE_IS('= B4')
SORT_LIST NAMED(#WLIST) BY_FIELDS(#OV_SIZE)
EXECUTE SUBROUTINE(WTOD)
OTHERWISE
IF COND('(#ov_pirect = #ov_direct) *and (#ov_select *gt 0) *and (#ov_object *gt 0)')
EXECUTE SUBROUTINE(DELETE_FIL)
ELSE
EXECUTE SUBROUTINE(LOAD_DIR)
ENDIF
ENDCASE
END_LOOP
**********
SUBROUTINE NAME(LOAD_DIR)
USE BUILTIN(OV_FILE_SERVICE) WITH_ARGS(GET_DIR #OV_DIRECT #OV_FILTER) TO_GET(#OV_RETC #OV_ERRN #WLIST)
IF COND('#OV_RETC =  OK')
EXECUTE SUBROUTINE(WTOD)
ELSE
MESSAGE MSGTXT('ERROR: Unable to list specified directory ')
ENDIF
ENDROUTINE
**********
SUBROUTINE NAME(DELETE_FIL)
DEFINE FIELD(#OV_MBA) TYPE(*CHAR) LENGTH(1)
DEFINE FIELD(#OV_MSG) TYPE(*CHAR) LENGTH(100)
GET_ENTRY NUMBER(#OV_SELECT) FROM_LIST(#DLIST)
IF COND('#ov_isdir = Y')
MESSAGE MSGTXT('Selected object is a directory and cannot be deleted')
ELSE
USE BUILTIN(BCONCAT) WITH_ARGS('Confirm that file' #OV_NAME 'is to deleted') TO_GET(#OV_MSG)
USE BUILTIN(OV_MESSAGE_BOX) WITH_ARGS(#OV_MSG 'Delete File' YN Q) TO_GET(#OV_MBA)
IF COND('#OV_MBA = Y')
USE BUILTIN(TCONCAT) WITH_ARGS(#OV_DIRECT '\' #OV_NAME) TO_GET(#OV_MSG)
USE BUILTIN(OV_FILE_SERVICE) WITH_ARGS(REMOVE_FILE #OV_MSG) TO_GET(#OV_RETC)
IF COND('#OV_RETC =  OK')
EXECUTE SUBROUTINE(LOAD_DIR)
MESSAGE MSGTXT('File successfully deleted')
ELSE
MESSAGE MSGTXT('ERROR : Attempt to delete file failed')
ENDIF
ENDIF
ENDIF
ENDROUTINE
**********
SUBROUTINE NAME(WTOD)
CLR_LIST NAMED(#DLIST)
CHANGE FIELD(#OV_BYTES) TO(0)
SELECTLIST NAMED(#WLIST)
CHANGE FIELD(#OV_BYTES) TO('#ov_bytes + #ov_size')
ADD_ENTRY TO_LIST(#DLIST) WITH_MODE(*DISPLAY)
ENDSELECT
ENDROUTINE