From: Tim Johnston To: All
Attention all OPNQRYF gurus:
I have an order entry file which has an item number (LPROD), quantity ordered (LQORD) and selling price (LNET). I want to summarize the information into a file that has month-to-date information. I decided to try to use OPNQRYF and the mapped fields. The summary file looks like:
LPROD (15) MTD (11 2)
What I want to do is multiply the quantity ordered times the selling price, and summarize on that result. The CL compiles when I select the query for the month-to-date and tell it to summarize:
MAPFLD(('MTD %SUM+ ("LQORD * LNET")')) But when I run the program, I get an error message "Operand for %SUM Function not valid."
Can I summarize a mapped field which has a calculation in it or am I going to have to find a way around it?
From: Ted Holt To: Tim Johnston
I think you have quote problems. Try this. I'll assume your data is in file FILEX and the summary file you're using to format the data is called SUMFILE.
OVRDBF FILE(SUMFILE) + TOFILE(FILEX) SHARE(*YES) OPNQRYF FILE((FILEX)) + FORMAT(SUMFILE) + QRYSLT(whatever) + KEYFLD((LPROD)) + MAPFLD((MTD '%SUM+ (LQORD * LNET)')) + GRPFLD(LPROD) CALL program CLOF FILEX DLTOVR SUMFILE
This is off the top of my head, so there may be a parenthesis or something out of whack.
From: Tim Johnston To: Ted Holt
You were close. All I needed was double parentheses around the expression:
MAPFLD((MTD '%SUM+ ((LQORD * LNET))'))
Makes perfect sense now, doesn't it? OPNQRYF is great, but some of the syntax rules just don't jive!
From: Ted Holt To: Tim Johnston
It wouldn't be so bad if you could catch more of these errors with the syntax checker, but most OPNQRYF errors are run-time errors. But OPNQRYF wouldn't have nearly the power it has if everything were bound at compile-time, rather than at run-time.
Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:
LATEST COMMENTS
MC Press Online