Avatar of matrix0511
matrix0511
 asked on

What is the AS400 Command to Run a Record Count on a Table?

I just need to run a simple record count on a table on an AS400. I'm running the command:

select count (*) from crpdta.f551201z

But that command is failing. I know the file exists. So I just want to make sure I"m stating the command correctly.

Can someone let me know real quick for me?

See below.

Thanks!RRecord Count
DB2Mainframe OS

Avatar of undefined
Last Comment
Member_2_276102

8/22/2022 - Mon
n2fc

Your command is correct... SQL is complaining about the table name... It is either mistyped or you are not connected to the proper SQL server to access that table.
momi_sabag

your command looks fine
are you sure you don't have a typo in the object name?
matrix0511

ASKER
Well, I can open the table from the application (JD Edwards E1). See below. It opens and I can even pull data. And the "Business Data - CRP" refers to the schema owner: CRPDTA which I stated in the command. NOt sure what else to check.

Application View
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
Member_2_2484401

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
matrix0511

ASKER
@davelash, that was it! You DA Man!! :-)
matrix0511

ASKER
Excellent work Dave!!
Member_2_276102

The problem is that you've specified *SYS naming convention instead of *SQL.

To expand just a little, the default on the STRSQL command is *SYS. You can prompt the command and change it to *SQL when you run the command. (Or simply type the command with the parm on the command line.)

Or, once you're already in an interactive SQL session, you can press <F13> to access session services. Option 1, 'Change session attributes', lets you switch naming convention among other things.

The "Naming convention" can be involved in just about every SQL interaction that you'll have with an AS/400. Usually, whichever client you're using will default according to the platform the client is running on. And every client that I've seen will allow you to change to the alternative mode. Keep it in mind.

Tom
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.