Global Variables work like a data area within the QTEMP library, i.e. the
same variable can have different values within different jobs.
Global Variables are great to store Information on a job level, for example
the language to be used or the client or company you are currently working
with. If you need to change the information on job level, it can be done
with a simple SET statement.
The nice thing about Global Variables, they can be specified within Views,
Triggers and all kinds of SQL routines.
If you need a universally used counter, a SEQUENCE Object would be a better
solution.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von
Justin Dearing
Gesendet: Thursday, 17.12 2015 04:20
An: Midrange Systems Technical Discussion
Betreff: No way to ALTER VARIABLE besides CREATE/DROP?
If I CREATE VARIABLE foo INT DEFAULT 5 it will always be 5 until I do a SET,
but the SET foo = 6; is only scoped to the session.
So, its actually not a big deal for my current application because the
variable (a start date for new business rules) should be a constant, and I'm
only going to change it in QA. If the business rules get delayed, then a
CREATE/DROP is fine. However, what if I had a variable that was a counter of
some kind? What if I expected some job to be constantly changing the value
of a global variable and several other jobs to be periodically SELECT
SCHEMA.VARIABLE FROM SYSIBM.SYSDUMY1? Is DROP/CREATE in a transaction the
appropriate behavior? Is there a risk that the SELECT might occur when the
variable doesn't exist?
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx 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.