AS400 – Query

1230 pts.
AS/400 Query
How to find the Count using RunQry and WrkQry Command without using Pagedown Key?


Software/Hardware used:

Answer Wiki

Thanks. We'll let you know when a new response is added.

If all you want is to see the # of records in the file, add the function to count on any field.
The under the output select summary. That should do it.

Silly question is why not just use DSPF and get the number of records?

Discuss This Question: 6  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TomLiotta
    Although this isn't an answer, it might help you until a better answer is available. You can type "B" or "b" in the 'Position to line' prompt to jump to the "bottom" of the file. That allows you quickly to see the row number of the last row. Tom
    125,585 pointsBadges:
  • rajeshece
    I wanted to count without Pressing Pagedown / Without Ebtering 'B/b'
    1,230 pointsBadges:
  • slateken
    SQL might be a better option that RUNQRY for you in this case: Select count(*) from FILE where COLUMN = VALUE If you're not doing any record selection, then the DSPF suggestion would work, but often, we need a count of records given certain selection criteria. I recommend using SQL via iseries Navigator SQL or even the IBM i command STRSQL (if available to you). Keep in mind, that if using STRSQL, the request will run interactively and can bog down your system when run over large files. For this reason and also for its superior user interface, I recommend iseries Navigator SQL. One thing that keeps some folks from using Navigator SQL more often is that navigating to the SQL panel is a bit cumbersome and time consuming. To remedy this, I recommend a little bit of up-front footwork to save yourself time in future queries: Open Navigator, select your connection under "My Connections" (you may need to set one up if you haven't already), select "Databases", select your target system, then select "Schemas". At the bottom of the current window, you should se an option to "Run an SQL script" -- Choose this option. An untitled "Run SQL Scripts" window should appear. Click "File", then "Save As"... Save this wherever convenient for you (I'd recommend your Desktop and Task Bar), then add a Windows Shortcut to it. Now, anytime you want to run an SQL via Navigator, you will not have to trudge through all the above steps. All you need to do hit your shortcut keys or click the icon on your Task Bar... Then just sign in and run your SQL. If you are not very familiar with SQL, there is a handy "SQL Assist" function under the Edit option when in "Run SQL Scripts"... Check it out. Now instead of keying your field tests after running: RUNQRY QRY(*NONE) QRYFILE((YOURFILE)) OUTTYPE(*DISPLAY) RCDSLT(*YES) you now launch the SQL Scripts window and type: select count(*) from YOURFILE where COLUMN1 = x and COLUMN2 = 'y'
    230 pointsBadges:
  • Kapiltiwari
    I think this is what u want... RUNQRY QRYFILE((IPAQUOTE)) OUTFORM(*SUMMARY)
    350 pointsBadges:
  • Splat
    I wanted to count without Pressing Pagedown / Without Ebtering ‘B/b’ If you want the record count for the entire file with no exclusions, just use DSPFD.
    12,915 pointsBadges:
  • Featured Member: Slateken - ITKE Community Blog
    [...] AS/400 Query [...]
    0 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: