Function SET191G
********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_191);
********** COMMENT(Function .......: SET191G);
********** COMMENT(Created on .....: 10/10/00 at 14:43:32);
********** COMMENT(Description ....: OV_FILE_SERVICE GET_DIR);
********** COMMENT(Version.........: 1);
**********;
********** COMMENT(This function requests a directory name and then);
********** COMMENT(retrieves and displays its contents. The resulting );
********** COMMENT(contents display can be sorted into various orders.);
**********;
********** COMMENT(Disclaimer: The following material is supplied as an);
********** COMMENT(example only. No warranty is expressed or implied.);
**********;
********** COMMENT(Receives: nothing);
**********;
********** COMMENT(=======================================================);
********** COMMENT(Function control options);
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);
********** COMMENT();
********** COMMENT(Mainline);
********** COMMENT();
DEF_COND NAME(*AS400) COND('*CPUTYPE = AS400');
IF COND(*AS400);
MESSAGE MSGTXT('Not available on iSeries');
MENU;
ELSE;
**********;
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;
ENDIF;
**********;
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;
********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_191);
********** COMMENT(Function .......: SET191G);
********** COMMENT(Created on .....: 10/10/00 at 14:43:32);
********** COMMENT(Description ....: OV_FILE_SERVICE GET_DIR);
********** COMMENT(Version.........: 1);
**********;
********** COMMENT(This function requests a directory name and then);
********** COMMENT(retrieves and displays its contents. The resulting );
********** COMMENT(contents display can be sorted into various orders.);
**********;
********** COMMENT(Disclaimer: The following material is supplied as an);
********** COMMENT(example only. No warranty is expressed or implied.);
**********;
********** COMMENT(Receives: nothing);
**********;
********** COMMENT(=======================================================);
********** COMMENT(Function control options);
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);
********** COMMENT();
********** COMMENT(Mainline);
********** COMMENT();
DEF_COND NAME(*AS400) COND('*CPUTYPE = AS400');
IF COND(*AS400);
MESSAGE MSGTXT('Not available on iSeries');
MENU;
ELSE;
**********;
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;
ENDIF;
**********;
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;