[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



I'm with you, Steve.  I've spent WAY too much time digging through include
files trying to determine where the value of some miserable global variable
got set.  The original programmer may (or may not) remember how it works,
but for anyone attempting to do maintenance (and yes boys and girls, someone
else WILL do maintenance on your stuff) it can be pure HECK!  When all
variables are global the result resembles something we used to call
'spaghetti code' in the days before light bulbs were invented.  I can still
be convinced to use global variables on occasion, but those occasions are
rare.

Jim Womeldorf


-----Original Message-----
From: Alexander, Steve [mailto:Steven.Alexander@sanjoseca.gov]
Sent: Friday, April 30, 2004 2:51 PM
To: 'This list is for discussion about the SQR database reportinglangu
age from Hyperion Solutions.'
Subject: RE: [sqr-users] Global VS parameter list


Oh boy, a controversy for a Friday afternoon, and a subjective technical one
at that.  There is never a requirement for a local procedure, but one reason
for them is simplicity.  After all, the built-in functions like substr() and
mod() are local procedures.  We could call them like this:


let $needle = 'A'
let $haystack = $alphabet
let #start_position = 1
do instr
if #found_position > 0
 ....
end-if


but isn't it easier and clearer to write:

if instr($alphabet, 'A', 1) > 0
 ....
end-if



-----Original Message-----
From: the dragon [mailto:ceprn@hotmail.com]
Sent: Friday, April 30, 2004 12: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

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

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