TechTip: The DSPREL Command

RPG
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times
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

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: