Showing posts from August, 2021

IBMi (AS400) fans only ' %DIFF BIF - How to add or subtract days from a date field %days(n)

#IBMiSample We can use %DAYS to add or subtract to a date. Hier is an example:

IBMi (AS400) fans only ' As an alternative to WRKACTJOB: How to get Active Jobs data using SQL ACTIVE_JOB_INFO table function

#IBMiSample The ACTIVE_JOB_INFO table function returns one row for every active job.  You can use it to get the same information as the WRKACTJOB command in an alternate mode. Look at the following examples: a. List all jobs of  user VDOTEST SELECT JOB_NAME, SUBSYSTEM, SUBSY00001, AUTHO00001, JOB_TYPE, FUNCT00001, FUNCTION, JOB_STATUS,  MEMOR00001                 FROM TABLE(ACTIVE_JOB_INFO())                                 WHERE JOB_NAME LIKE '%VDOTEST%'                               b. List all jobs of  subsystem QBATCH SELECT JOB_NAME, AUTHORIZATION_NAME, ELAPSED_TOTAL_DISK_IO_COUNT, ELAPSED_CPU_PERCENTAGE                                            FROM TABLE(QSYS2.ACTIVE_JOB_INFO(                                 SUBSYSTEM_LIST_FILTER => 'QBATCH')) A                             ORDER BY ELAPSED_TOTAL_DISK_IO_COUNT DESC                         c. List all jobs temporary storage SELECT JOB_NAME, AUTHORIZATION_NAME, TEMPORARY_STORAGE,      SQL_STATEMENT_TEXT         

IBMi (AS400) fans only ' Modernizing RPG's indicator with INDARA (Indicator Area) keyword

#IBMiSample INDARA (Indicator Area) keyword for ICF files workstn indds indicator data structure INDARA is used to put the field option indicators and function(response) key indicators in a separate area of memory called indicator area. By using this keyword, we can make indicator data structure in our program to give the customized name to indicators defined in the display file. Hence, it makes the program more readable and easy to understand. Step 1. indicate INDARA  keyword in your Display File Step 2. indicate INDDS in your RPG workstation file declaration dcl-f PKLTSFV workstn indds(Dspf) sfile(SFL1 : SF1NUM); Step 3. declare the  indicator area        dcl-ds Dspf qualified ;          Exit            ind pos(03) inz(*off);          SflClr          ind pos(50) inz(*off);          DspAtrRI        ind pos(61) inz(*off);          DspClrRed       ind pos(62) inz(*off);          SflEnd          ind pos(91) inz(*off);        end-ds ;     Step 4. In the RPG source program replace all the

IBMi (AS400) fans only ‘ Rpg Free: Create a Window to display a very long program message

#IBMiSample I'm tired of one-line messages. Too short. The average user needs clear and comprehensive messages. Then I need a large enough window to display a clear and complete message . Why not use a SUBFILE? A SUBFILE program can handle a list of many lines, a clear and complete message is just a list of many text lines! Here's how I did it I need a table that contains the messages.                           --                                                  --  RUNSQLSTM SRCFILE(VDOTEST1/QSOURCE) SRCMBR(W03AM00F) --                                                  CREATE TABLE VDOTEST1/W03AM00F (                    W3FANN CHARACTER(1) NOT NULL WITH DEFAULT,          W3TPMS CHARACTER(6) NOT NULL WITH DEFAULT,          W3COD0 NUMERIC(4, 0) NOT NULL WITH DEFAULT,         W3RIG0 NUMERIC(2, 0) NOT NULL WITH DEFAULT,         W3TXT0 CHARACTER(078) NOT NULL WITH DEFAULT         )                                                   RCDFMT W03AM                                       

IBMi (AS400) fans only ' RUNSQLSTM Run SQL Scripts example

#IBMiSample The Run SQL Statements (RUNSQLSTM) command processes a source file of Structure Query Language (SQL) statements. let's have an example: Create a source member AS52A00F into library VDOTEST1/QSQLSRC. VDOTEST1 is MyLibrary. Use your library name. AS52A00F.SQL