The ZTOOLS source (pronounced "Zee Tools") contains useful subprocedures that can be included in any RPG IV release 2 (or later) program. The prototypes for the ZTOOLS procedures are listed on the following pages. Compile the ZTOOLS file as a module and then include that module on the CRTPGM when compiling an application. To download the latest source for these and other routines, go to the RPG IV Web site at http://www.rpgiv.com and click on the Downloads link.
/**************************************************************/ /* Cozzi RPGIV Includes | (c) 1996 by Robert Cozzi, Jr. | /* ——————————— All rights reserved. | /* ——————————————————————————————- /* PC Filename(zINCLUDE.RG4) AS/400 Filename(ZINCLUDE) TYPE(RPGLE) /* This source file contains example source code for the RPGIV /* language for your consideration. /* /* These examples are provided "as is" without warranty of /* any kind. If you choose to use these examples, you do so /* at your own risk. Further, you agree to hold the author of /* these examples, the copyright holder, its agents and suppliers /* harmless for any results from the use or misuse of these /* enhancements. No warranty is expressed or implied and /* none is given. /***************************************************************/** ** Procedure interface for the get DayOfWeek function ** Format: day-of-week = DAYOFWEEK( ISO-DATE ) ** Input: A valid date in *ISO format ** Return value: -1 if an error occurred ** ** 1=Sunday, 2=Monday, 3=Tuesday 4=Wednesday ** 5=Thursday, 6=Friday, 7=Saturday ** ** See also: WeekDay — Returns day of week in text format ** .....D*ame+++++++++++EUDS.......Length+TDc.Functions++++++++++++++++++++++++++++ D DayOfWeek PR 10I 0 D InDate D CONST DATFMT(*ISO) /***************************************************************/ ** ** Procedure interface for the get WeekDay (text) function ** Format: day-of-week = WeekDay( ISO-DATE ) ** Input: A valid date in *ISO format ** Return value: Character string representing the day of ** the week: ** Sunday, Monday, Tuesday Wednesday ** Thursday, Friday, Saturday ** ** See also: DayOfWeek — Returns day of week as a numeral ** D WeekDay PR 10A D InDate D CONST DATFMT(*ISO) /***************************************************************/ ** ** Procedure interface for the RUN function ** Format: Runcmd( 'cmd-string' : len of cmd-string : [graphic] ) ** Input: Any system command ** Length of the system command ** Optional: Double-byte character support parameter ** D Runcmd PR ExtPgm('QCMDEXC') D cmdstr 3000A Const Options(*VarSize) D cmdlen 15P 5 Const D cmdDbcs 3A Const Options(*NOPASS) /***************************************************************/ ** ** Procedure interface for the TOUPPER function ** Format: upper-case-value = ToUpper( const 'char-string' ) ** ** Input: Character value to be converted ** ** Output: The upper-case equivalent of the input value .....D*ame+++++++++++EUDS.......Length+TDc.Functions++++++++++++++++++++++++++++ D ToUpper PR 1024A D tu_input 1024A CONST /***************************************************************/ ** ** Procedure interface for the NUMTOCHAR function ** Format: character-value = NumToChar( const numeric-value ) ** ** Input: Numeric value to be convert (no decimal positions) ** ** Output: The return value is the character string form ** D NumToChar PI 32A D NumInput 30P 0 CONST