[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] Global VS parameter list



The example I have here is to show the errors that I'm getting in the real
SQR program.

As a matter of fact, I am adding functionality to a SQR program.

In this SQR program, almost almost all variables are shared globally.

When I add a new procedure with parameters, it complains with the error
listed here because there's a whole bunch of variables that are not in the
parameter list.

So either I have to add ALL variables (that are being referenced in the new
procedure) to the parameter list, or I have to make this new procedure's
parameters global.

In my case, I had no choice but to do the latter. But that complicates the
code a lot, so I'm wondering if there's any suggestions to better coordinate
the variables being declared. 

Thanks!
Nicholas

-----Original Message-----
From: the dragon [mailto:ceprn@hotmail.com]
Sent: Friday, April 30, 2004 2:28 PM
To: sqr-users@sqrug.org
Cc: Nicholas.Chu@RedPrairie.com
Subject: RE: [sqr-users] Global VS parameter list


Nicholas,

in your procedure that you have shown us, there is no reason for it to be a 
local procedure - it isn't doing anything.  Drop the 'local' part and make 
it a global procedure; you're over-complicating it...  In my opinion, and 
I'll start a load of conversation here, there is never a reason for a local 
procedure in most cases.

www.techsunite.org/offshore/


clark 'the dragon' willis



PSA: Salary <> Slavery.  If you earn a salary, your employer is renting your

services for 40 hours a week, not purchasing your soul.  Your time is the 
only real finite asset that you have, and once used it can never be 
recovered, so don't waste it by giving it away.

"Time is the coin of your life. It is the only coin you have, and only you 
can determine how it will be spent.  Be careful lest you let other people 
spend it for you."

Carl Sandburg
(1878 - 1967)

----Original Message Follows----

 > Hi,
 >
 > I am supposed to modify an SQR report by adding a procedure to it.
 > When I add my procedure I passed in a couple of parameters and 1 as 
return
 > parameter.
 > Within that procedure I am also referencing some field variables that I
 > retrieved earlier.
 >
 > However it errored out and complained that the &xxxxx variables that I'm
 > referencing are not declared.
 > Later I found out that I have to put those variables that I want to use 
in
 > the parameter list of the procedure to make it work.
 >
 > For example:
 >
 > begin-report
 >   let $aa = 'A'
 >   let $bb = 'B'
 >   do sel
 >   do main($aa,$bb)
 > end-report
 >
 > begin-procedure sel
 > begin-select
 > 'TESTING'     &dummy
 > from dual
 > end-select
 > end-procedure
 >
 > begin-procedure main($in_aa,$in_bb)
 >   print $in_aa (1,1)
 >   print $in_bb (+1,1)
 >   print &dummy (+1,1)
 > end-procedure
 >
 >
 >
 > When you run it:
 >
 >
 >
 > SQR V6.1.4
 > Copyright (C) Brio Technology 1994-2000.  All Worldwide Rights Reserved.
 >
 > (SQR 4407) Referenced variables not defined:
 >
 >   &dummy (local)
 >
 > Errors were found in the program file.
 >
 >
 >
 >
 > This is the version that runs:
 >
 > begin-report
 >   let $aa = 'A'
 >   let $bb = 'B'
 >   do sel($dummy)
 >   do main($aa,$bb,$dummy)
 > end-report
 >
 > begin-procedure sel(:$ret_dummy)
 > begin-select
 > 'TESTING'     &dummy
 > from dual
 > end-select
 >
 > let $ret_dummy = &dummy
 > end-procedure
 >
 > begin-procedure main($in_aa,$in_bb,$in_dummy)
 >   print $in_aa (1,1)
 >   print $in_bb (+1,1)
 >   print $in_dummy (+1,1)
 > end-procedure
 >
 >
 >
 >
 >
 > Is there any way to get around?
 >
 > What if I have an array to reference? Can I pass it in as a parameter
 > list?
 >
 >
 > Many thanks!!
 > Nicholas

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users

_________________________________________________________________
Express yourself with the new version of MSN Messenger! Download today - 
it's FREE! http://messenger.msn.com/go/onm00200471ave/direct/01/

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users