|
I've been listening in on the debate at IBM on the lack of support for local variables in SQL. They are currently trying to decide whether to fix this or declare it a limitation Let's keep our fingers crossed and get our Design Change Requests ready! If any of the rest of you have support contracts, please open up a problem so I am not the lone voice in the wilderness. Note: This is not the qualified variable support issue, that's another pmr. This is for reuse of variable names in subprocedures being supported in SQL. Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin rob@dekko.com Sent by: To: rpg400-l@midrange.com rpg400-l-admin@mi cc: drange.com Fax to: Subject: SQL precompiler does not support local variables. (at least being redefined) 02/27/2002 09:26 AM Please respond to rpg400-l Ok, I use Code/400. It has a wonderful wizard to do many things. One is to create a subprocedure. This wizard follows the form that you store your results into a variable and use one return statement. (I don't want to clutter this thread as to the merit of this logic, please.) The variable they always use is retField. I've defined a multitude of subprocedures with this pattern. And the size of retField changes based on what I am returning. No big deal, they're local variables in subprocedures. I was getting the error message: Record *...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ... +... 7 ...+... 8 SEQNBR Last change 010893020225 10893 02/25/02 173 C/end-exec ct tptfile into :retField 010914020225 10914 02/25/02 ... MSG ID SEV RECORD TEXT SQL0312 30 193 Position 30 Variable RETFIELD not defined or not usable. So I renamed the retField in the first subprocedure to retFieldX. The error message dropped down to the next subprocedure. Sample subprocedure: P*-------------------------------------- P* Procedure name: GetTPTLIB P* Purpose: P* Returns: Library name or *NONE P* Parameter: tptType => Trading partner type P*-------------------------------------- P GetTPTLIB B EXPORT D GetTPTLIB PI 10A D tptType LIKE(TPTYPE.TPTTYPE) CONST D* Local fields D retFieldX S 10A inz(*loval) C/exec sql C+ Select tptlib into :retFieldX C+ from eis/tptype C+ where tpttype=:tptType C/end-exec /free return retFieldX; /end-free P GetTPTLIB E pmr 78018,500 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 RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-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.