Posts

Showing posts from October, 2022

IBMi (AS400) fans only ' From Query to SQL with one command

Image
#IBMiSample Each IBMi user knows they run the most efficient system. All others just have too much money. In most of IBMi we have a large number of QUERIES. Often these QUERIES are provided to end users, with all limitations of this practice. I think this practice is deplorable. How about turning these queries into SQL and then writing an RPG with embedded SQL? The QUERY to SQL translation process is really simple, it only takes one command: RTVQMQRY QMQRY(MyQueryLib/MyQuery) SRCFILE(MyLib/MySrcFile) ALWQRYDFN(*YES) That's it! Below an example of a cursor declaration in an SQLRPGLE program (Sql embedded) // preapre the data recordset exec sql declare C1 cursor for select OTORD00F.OTANN0, OTORD00F.OTCOR0, CLANA00F.CLNOM0 from OTORD00F inner join CLANA00F on OTCCL0 = CLCCL0 where OTANN0 like :F1ANN0lke and OTCOR0 between :F1COR0str and :F1COR0end and CLNOM0 like :F1NOM0lke order by OTCOR0 for read only; Here is a complete SQLRPGLE sample program with SQL embedded . #IBMiSam

IBMi (AS400) fans only ‘ Another way to manage spooled files

Image
New feature:  F18=Search string into listed files WSF utility, works like WRKSPLF but... New feature: Searching a string into  spooled files New feature: Generate a PDF from a spooled file #IBMiSample Each IBMi user knows they run the most efficient system. All others just have too much money. Users often have many spool-file rows. How to  quickly   find the last done? how to quickly find the one produced on October 15th? These and other options are just a click away. The WRKSPLF command does not show spool-file rows sorted by Creation-Date/Creation-Time, so the last one is not the first one in the list. I thought a different way of looking at spooled-file rows might be useful. In this program (WSF) the spool-file rows appears in order of Creation-Date/Creation-Time, with the last one at the top of the list. I also added the ability to filter each column, for example to see only the rows in HOLD status. I also added the possibility to sort each column with F16 or double-click on the co