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

Re: [sqr-users] Reset all variables in the program.



sorry, that would be 

set $varname ""



>>> GJANSEN@aflcio.org 09/21/05 7:40 AM >>>
On another forum somebody was asking about the uses of "reflection". In a 
language that provided it, this would be straightforward--in Tcl

foreach varname [info vars] set varname ""

For SQR the path of least resistance would be to write a script to drive the 
programs. You'd still get the 20x overhead of starting a process, but at least 
you wouldn't need manual intervention.




>>> ceprn@hotmail.com 09/21/05 7:18 AM >>>
Ray, et al,

I think the only other way to accomplish this would be to put *everything* 
in local procedures, but that sounds like a lot more work than just getting 
all of the variables and plopping them in a procedure and resetting them 
after the record processes, but before the next one.

pecae,
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.

I work to live; I don't live to work.

"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----

Aleksandr,

The short answer is "No, and it's worse than you may think."

There is no command to reset all your global variables.  CLEAR-ARRAY
works for arrays, but that's all you get.

To make matters worse, all local variables (in procedures) will also
retain their values from call to call.  If you have procedures that
you normally only call once, you may want to make sure that they also
intialize all variables before use.

To avoid this problem, I always initialize variables before use.

Does anyone out there have a utility for finding uninitialized
variables that Aleksandr could use?

Ray

On Tue, Sep 20, 2005 at 07:14:59PM -0700, Aleksandr Slobodyanik wrote:
 > Hi.
 > I am modifying several programs that we run periodically for the number 
of clients.
 > I have to run every SQR separately for each client. If I have 20 clients, 
and 4 programs, I have to run them 80 times. I am modifying SQRs by adding 
while loop in BEGIN-PROGRAM section. Also I added flat file with parameters 
for each client. So on the first iteration program reads first line of the 
parameter file, runs through, produces CLIENT_NAME.PDF. Next line of the 
parameter file, NEW-REPORT another PDF with different client name, and so on 
until the end of the parameter file.
 > Instead of 80 times I have to run these programs just 4 times.
 > Everything would be fine if I would not have one problem. After each 
iteration all variables still have values from the previous loop. Sure, I go 
and reset them after each iteration, but there are tons of them in each 
program, and I have to go through each, find them, put into procedure and 
reset.
 > My question: Is there a command that would reset all variables in the 
program to 0 or NULL depending on the type?
 > Thank you.
 >
 >



_______________________________________________
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