Display the number of rows in a table on iSeries

Number of rows EXCLUDING deleted – three methods 1. The SQL COUNT function > STRSQL > SELECT COUNT(*) FROM cities ….+….1…. COUNT ( * ) 6 ******** End of data ******** 2. The display file description command > DSPFD cities Go to the bottom of the information and look for the line “Total records” Total number of members […]

Converting character to numeric with iSeries query

Query/400 provides many options for converting data, particularly dates, but lacks one important feature – converting character to numeric. However, there is a workaround even if it is a little “awkward” by using the MICROSECONDS function. Firstly, append your character field to the end of an arbitrary date. Next, use the MICROSECONDS function to extract it as […]

Comparing numeric dates using iSeries query

Many legacy systems stores dates in 6 digit numeric fields. This makes comparison difficult during a Query’s select statements. However, there is a way to handel these dates in Query/400.  Firstly, convert the numeric date field to a character field and formatting it with separators. Then it can be converted to a date field using the DATE function in query. […]

Converting ddmmyy to ccyymmdd using iSeries Query

The example below shows how to convert a six digit numeric date in DDMMYY format to an eight digit date using Query for i5/OS. Conversion takes place into CCYYMMDD and DDMMCCYY formats. Just replace example field mydate with your six digit numeric date. A date-window concept is used to interpret the year and the field window defines the […]

Sending Objects Between iSeries Machines

On the sending machine:   Create a temporary library & save file for the transfer CRTLIB TmpLib CRTSAVF TmpLib   Copy object to the temporary library CRTDUPOBJ OBJ(MyProg) FROMLIB(MyProgLib) OBJTYPE(*PGM) TOLIB(TmpLib)   Save the temporary library to save file SAVLIB LIB(TmpLib) DEV(*SAVF) SAVF(TmpLib)   Send the save file to the other machine SNDNETF FILE(TmpLib) TOUSRID((userName […]