165 pts.
Q:
WRKQRY'S USE TO ADD NUMERIC FIELD'S RECORDS
How can i add up the records of my physical file's numeric field lets say Esal's records using wrkqry?

Please help me by an appropriate code example.

thanks in advance.

 

 



Software/Hardware used:
AS/400
ASKED: Dec 20 2009  7:20 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
4695 pts.
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • Bookmark and Share
If I understand the question correctly, you want to sum a numeric field in a file using AS/400 Query.

Select the "Select report summary functions" option and put a 1 next to the field you want to sum.
Last Answered: Dec 21 2009  4:32 PM GMT by Teandy   4695 pts.
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

TomLiotta   18875 pts.  |   Dec 21 2009  7:52AM GMT

I’m only discussing the question, not attempting to answer it.

Personally, I’d skip that entirely and do the work with a QM query instead. To produce a sum over a field named FLD1 in a file named MYFILE in a library named MYLIB, I’d put this statement into a source member:

select sum( FLD1 ) from MYLIB/MYFILE

Then I’d create the QM query with the CRTQMQRY command and run it with the STRQMQRY command.

That assumes I didn’t have the SQL Dev Kit installed. If I was entitled to it, I’d install it. If it was installed, I’d simply work through the STRQM command. If I already knew Query/400, I’d start my work with the ‘Prompted’ mode and move to SQL mode later. If I was already comfortable with SQL, that’s the mode I’d start with.

I don’t know if Query/400 (now apparently renamed Query for i5/OS) has been meaningfully updated since OS/400 V4. I won’t be surprised if it’s never updated again.

Tom