940 pts.
 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: December 20, 2009  7:20 AM
UPDATED: December 21, 2009  4:32 PM

Answer Wiki:
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 Wiki Answer Submitted:  December 21, 2009  4:32 pm  by  Teandy   5,830 pts.
All Answer Wiki Contributors:  Teandy   5,830 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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

 108,055 pts.