|
As Mr Spock has often mentioned, "When the logical is not the answer, then we have to look at the illogical" (or words to that effect) Is there by any chance a different object type named INVENTORY in the library list? If so, can you rename it and try again. Like I said - illogical - does NOT make sense - stupid idea. But have a look see. >>> <rob@dekko.com> 11/30/01 07:55AM >>> Same message with ONHAND INVENTORY in ROB3 type *SRVPGM not found. Rob Berendt ================== "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin "David Morris" <David.Morris@plumc To: <midrange-l@midrange.com> reek.com> cc: Sent by: Fax to: midrange-l-admin@mi Subject: Re: Error using a function drange.com 11/29/2001 05:27 PM Please respond to midrange-l Rob, One thing that stands out to me is the way you specified the name of the procedure. Procedure names are case sensitive. Did you actually use OnHand? if you did try ONHAND, which is what RPG actually exports. I think that should fix your problem. David Morris ----- Original Message ----- From: <rob@dekko.com> To: <midrange-l@midrange.com> Sent: Thursday, November 29, 2001 11:03 AM Subject: Error using a function > I was trying to use an example out of an enewsletter when I ran into a > problem. Anyone know how to fix the error? Below is what I had forwarded > to the author. > > > I was trying this out, creating a memo for our department, using the > following steps, when I ran into a problem. Can you follow along? > > > Often we have issues in which fields must be computed to calculate values. > Examples may include: > On hand balances > Special pricing > Available inventory > etc. > > I found an interesting article at: > http://www.midrangeserver.com/guruO/GuruO-10-19-2001.html#1 > > Of which I would like to give you a sample involving our data. I'll start > from the finished product and work our way back. > > I've created a view, or a logical file, depending on whatever terminology > floats your boat. The one I created is DATDIVF/IIMLROB. > > I can run a Query/400 on it which basically does this: > Select iprod, OnHand from iimlrob > Now isn't that easier than each query, etc calculating the on hand? Or > making sure that someone didn't make an error? Or, if you want to change > all queries, etc as to how they calculate onhand you can do it in one spot. > > Now lets start at the beginning. > > First I have the following source member, I'll give you the Code/400 name, > <OS400>ROB/QPGMSRC(INVENTORY) > H nomain > > D OnHand pr like(iadj) > D OpenBal like(iopb) > D Adjustments like(iadj) > D Receipts like(irct) > D Issues like(iiss) > > P OnHand B export > D OnHand pi like(iadj) > D OpenBal like(iopb) > D Adjustments like(iadj) > D Receipts like(irct) > D Issues like(iiss) > > D ItemMast E DS extname(iim) > > /free > return OpenBal+Adjustments+Receipts-Issues > /end-free > P OnHand B export > > Then I created a module, not a program, using the command > CRTRPGMOD MODULE(ROB/INVENTORY) SRCFILE(ROB/QPGMSRC) DBGVIEW(*LIST) > > Then I created a service program using the command > CRTSRVPGM SRVPGM(ROB/INVENTORY) EXPORT(*ALL) > Normally I would use binder language, but I kept it simple for this example > > Then I did the following: > > STRSQL > > create function OnHand (dec (11,3), dec (11,3), dec (11,3), > dec (11,3)) > returns dec (11,3) > language rpgle > deterministic > no sql > returns null on null input > no external action allow parallel > simple call > external name 'ROB/INVENTORY(OnHand)' > > Now to test this I ran: > Select iprod, OnHand(iopb,iadj,irct,iiss) from iim > And I got: > Message ID . . . . . . : SQL0204 Severity . . . . . . . : 30 > Message type . . . . . : Diagnostic > Message . . . . : INVENTORY in ROB type *SRVPGM not found. > Cause . . . . . : INVENTORY in ROB type *SRVPGM was not found. If this is > an > ALTER TABLE statement and the type is *N, a constraint was not found. If > this is not an ALTER TABLE statement and the type is *N, a function, > procedure, or trigger was not found. > Recovery . . . : Change the name and try the request again. If the > object > is a node group, ensure that the DB2 Multisystem product is installed on > your system and create a nodegroup with the CRTNODGRP CL command. > > But I can do the following: > wrkobj rob/inventory > and get > Object Type Library Attribute > INVENTORY *SRVPGM ROB RPGLE > INVENTORY *MODULE ROB RPGLE > > What gives? > > For more information on functions: > http://publib.boulder.ibm.com/html/as400/v5r1/ic2924/info/db2/rbafzmst57.htm #HDRCH2FUNCTION > > > > Rob Berendt > > ================== > "They that can give up essential liberty to obtain a little temporary > safety deserve neither liberty nor safety." > Benjamin Franklin > > Rob Berendt > > ================== > "They that can give up essential liberty to obtain a little temporary > safety deserve neither liberty nor safety." > Benjamin Franklin _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l or email: MIDRANGE-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l. _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l or email: MIDRANGE-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.