A Handy ‘Quick Query’ Command on the iSeries

This will note whatever file youve enter in a raw format, sort of like what you get when you type:
select * from file-name
in SQL.

on a command line. The * n tells the command interpreter that you are utilizing the default for the fist criterion.

Heres a fun- and useful – little command you can develop on the iSeries (or IBMi, AS400) in about 2 minutes. Since I use it constantly, I usually develop some version of this on every system I work on. Ill discuss how below.
Initially, the essentials.
The RUNQRY command can be utilized to run a raw question on a file (or table) that does not need to be specified utilizing WRKQRY. To do so, all you have to do is type in:
runqry * n file-name. Prompted it appears like

If you desire to use the question with record selection, your can enter it this method:
runqry * n file-name rcdslt( * yes), which appears like

, if the command is triggered.
The RQ Command
I used to always name the command simply Q, however I found that Q was frequently used by other individuals. It became RQ (one more keystroke:-RRB-). Heres how to set it up:

( The only issues you may have is whether you have the correct authority to do this, and what library you desire to put the command in. The library ought to be in the typical library list youll be utilizing so you dont constantly have to add the library prior to carrying out the command. I suggest QUSRSYS or QGPL, but your library setup may vary. Well utilize QTEMP for this example so you can see how it works).

We use the CRTDUPOBJ command to create a copy of RUNQRY. The initial RUNQRY lies in the QSYS library, however with CRTDUPOBJ you truly dont need to understand that.

crtdupobj runqry * libl * cmd qtemp rq.

If you prompt it, it will appear like

Frequently, if Im composing a program where I require to pack a number of fields from a file, I will use the RQ command to display the field names, and then copy/paste them into the programs source member.

If you desire to see a file, in a formatted columnar style (like SQL), just type in the command and hit Enter twice.

Heres an enjoyable- and helpful – little command you can create on the iSeries (or IBMi, AS400) in about 2 minutes. I generally produce some variation of this on every system I work on because I use it constantly. I used to constantly name the command merely Q, however I found that Q was often utilized by other people.( The only concerns you may have is whether you have the appropriate authority to do this, and what library you want to put the command in. The library must be in the typical library list youll be using so you dont always have to include the library prior to carrying out the command.

Naturally, the other criteria can be used, as required, to dump the file to a printer or outfile (like RUNQRY).

Other times, when Im working in SEU and I need a field name I forgot, Ill just conjure up the F21 command line window, and RQ the file to get the name. Quick and easy!

When you get to the selection screen, you can take a look at the files layout – field names and qualities. Sure beats needing to print out a layout or visit the source member every time you want to discover something.

If you desire to search for worths utilizing the record selection screen, enter the command and struck Enter as soon as. Type in your selection requirements, his Enter again, and youre golden.

What did we do here? We changed the default that was consisted of with RUNQRY for the RCDSLT parameter from its default of * NO to * YES. Weve moved from needing to go into
runqry * n file-name rcdslt( * yes).
rq * n file-name.
How to Use the Command.
Naturally, the most apparent is to look at raw file information.

Now you have useful brand-new command that can perform a lot of functions and increase your productivity. Have enjoyable!

Thats not the RQ commands only usage.

At the selection screen you can press F18 to see the record format name.

Great, now you have a replicate of RUNQRY in QGPL with the name of RQ. However, what good does that do, other than conserving 4 crucial strokes? Absolutely nothing until we do this:
chgcmddft qtemp/rq rcdslt( * yes). Or

You May Also Like These Topics...

I am a Code Maker.

Software developer sounds like more of the same, however with a product for sale at the end. And consultant is, in the minds of numerous, simply someone who does not have a “task”. Go into “maker”. To quote Wikipedia: ” The maker culture is a contemporary culture or subculture representing a technology-based extension of DIY […]

Word of the Day: User Story

A user story is a tool utilized in Agile software advancement (see definition listed below) to catch a description of a software application feature from an end-user perspective. The user story describes the type of user, what they desire and why. A user story helps to produce a simplified description of a requirement. Agile software […]

Tags: , , , , ,
Previous Post
Social Media

The Social Media Marketing Revolution

Next Post
Web Design

Videos And Web Design

Leave a Reply