MC Press Online

Tuesday, May 23rd

Last updateMon, 22 May 2017 4pm

You are here: Home ARTICLES Programming RPG TechTip: The DSPREL Command

Programming / RPG

TechTip: The DSPREL Command

Support MC Press - Visit Our Sponsors

NEW BOOK!

Evolve Your RPG Coding: Move from OPM to ILE ... and Beyond


ORDER YOUR COPY

*******************

Click for this Month's

Bookstore Special Deals

I had a problem. I needed to access a physical file that holds sales order information, but I needed it in a specific sequence. I don't like creating unnecessary logicals, so I had a look at the existing logicals. The problem with IBM's DSPDBR command is that it gives you a list of the dependent logical files but doesn't tell you anything about them. I had to look at the keys for each logical in turn using DSPFD. This gives you a list of the field names that make up the key.

My problem with that is that the file was generated by Synon, and the field names don't give you any clue as to what's actually held in the field. So that meant using DSPFFD to get the list of the fields and their descriptions. After a load of searching, I thought I had found the logical I was looking for. But when I used DSPFD again, I found that it had some select/omit statements that excluded some of the records that I needed. This was getting to be a real pain!

I started thinking about a better way of spending my time. Enter the QDBRTVFD API. This retrieves all of the info you could ever need about database files, plus a bit more. After some trial and a lot of errors, I managed to create my own DSPREL command. It shows all of the related logicals in a subfile. Listed beneath each file are the fields that make up the key, complete with their text description, so that you can easily see what the field holds. It also shows whether there are any select/omit rules. It lets you enter a selection beside any of the files that shows those rules, shows a complete list of all of the fields, allows you to query the file (in a better way than WRKQRY or RUNQRY), and a few other things as well. It also has an F16=Search function that lets you search for any text string in the file name, key field, or field text. It's handy if you are looking through a list of 20 logicals for something using the customer number. Just hit F16 and type "customer," and it will show you all of the hits.
BLOG COMMENTS POWERED BY DISQUS