- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- How to test if a symbol has been initialised
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2003 02:00 AM
тАО09-03-2003 02:00 AM
Cos the way I'm doing it seems a bit backwards.
$ON WARNING THEN GOTO WARNUSER
$!
$!This will fail if MYSYMBOL not set
$TEMP = MYSYMBOL
$!
$!Restore action upon warning
$ON WARNING THEN GOTO JOBERROR
When I joined this forum I thought I was quite good with DCL and OpenVms, having read a lot of this forum, I bow my head to you guys!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2003 02:20 AM
тАО09-03-2003 02:20 AM
Solutionif f$type(MYSYMBOL) .eqs. "" then goto warnuser
If MYSYMBOL has been defined, f$type will hold it's type. Consequently, if MYSYMBOL hasn't been initilazed (not even to "") - so actually doesn't exist, f$type will return "".
So this can be exploited....
OpenVMS Developer & System Manager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2003 02:40 AM
тАО09-03-2003 02:40 AM
Re: How to test if a symbol has been initialised
Thanks for the help willem but the batches I need to add the code to may have various actions to perforn in the event of a warning.
ie. they may start with
$ ON WARNING THEN GOTO JOBERROR
Your suggestion works ok on the commands line, but in the code, causes the batches to jump to label JOBERROR.
Is there a way to do it without causing any warnings at all?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2003 05:22 AM
тАО09-03-2003 05:22 AM
Re: How to test if a symbol has been initialised
if you will be sure symbol is initialized you can use this code run quicly than test f$type
$ MYSYMBOL="''MYSYMBOL'"
Otherwise you can assingn a value to another symbol, set null if symbol is not defined without test:
$ SYMBOL_TWO="''MYSYMBOL'"
Prior statement are functionally with string symbols. Using numeric symbol you need use f$type function.
Bye
Antoniov
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2003 05:58 AM
тАО09-03-2003 05:58 AM
Re: How to test if a symbol has been initialised
My whole problem is trying to discover if a symbol is initialised without raising a warning.
Your lines are basically assigning the string representation of MYSYMBOL to another symbol, (something that could also be done with the lexical f$string).
I need to find out if MYSYMBOL (global symbol) has ever been initialised (ie. in a calling batch)
I know I check search the result of
$ SHO SYM /GLOBAL MYSYMBOL
Or I can do what I am doing which is
$ SET NOON
$!
$ IF F$TYPE(MYSYMBOL) .EQS. ""
$ THEN
$ GOSUB JOBERROR
$ ENDIF
$!
$ SET ON
$!
I just want to know if there's a tidier way!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2003 06:21 AM
тАО09-03-2003 06:21 AM
Re: How to test if a symbol has been initialised
if you need only stop a batch, use f$type.
Sometimes you could need assing value without error and f$string can't work!
I've learned use of "''MYSYMBOL'" reading various VMS system files.
Bye
Antoniov
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2003 06:55 AM
тАО09-03-2003 06:55 AM
Re: How to test if a symbol has been initialised
$ MYSYMBOL = "''MYSYMBOL'"
throws no warnings but will leave MYSYMBOL initialised to either the value or ""
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2003 08:09 AM
тАО09-03-2003 08:09 AM
Re: How to test if a symbol has been initialised
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2003 08:19 AM
тАО09-03-2003 08:19 AM
Re: How to test if a symbol has been initialised
Yes, you are right, I don't know what I tried before but it works ok now ??!?!?!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2003 08:35 AM
тАО09-03-2003 08:35 AM
Re: How to test if a symbol has been initialised
Excuse me
MY_SYMBOL=""MY_SYMBOL"" it's a error
If you set a symbol and you can accept null value if symbol not defined you can write
TWO_SYMBOL="''MY_SYMBOL'"
If MY_SYMBOL is not defined TWO_SYMBOL is set to "".
If you write
MY_SYMBOL="''MY_SYMBOL'" you are sure MY_SYMBOL is defined as value of caller (if defined) or null (if caller has not set MY_SYMBOL).
Same using == (to assing global values).
F$STRING permit convert a numeric symbol into string symbol. There are few differents between string symbol and numeric symbol.
If you stil need help about symbol post question.
Excuse me again for prior error.
Antoniov