- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: F$TYPE of space is INTEGER
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
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
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
04-30-2013 05:25 PM
04-30-2013 05:25 PM
F$TYPE of space is INTEGER
Who would have thought that f$type of a symbol containing a space is considered to be an integer! It looks more like a string. Oh well, I guess we can code around it.
$ s = " "
$ t = f$type(s)
$ show symbol %
S = " "
T = "INTEGER"
$
But the empty string is a string.
$ s = ""
$ t = f$type(s)
$ show symbol %
S = ""
T = "STRING"
$
$ tcpip show version
HP TCP/IP Services for OpenVMS Industry Standard 64 Version V5.6 - ECO 5
on an HP rx3600 (1.59GHz/9.0MB) running OpenVMS V8.3-1H1
$
Cheers,
Lester
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2013 07:54 PM
04-30-2013 07:54 PM
Re: F$TYPE of space is INTEGER
That's a bug/inconsistency....
fwiw,
Hein.
DCL
LEXICON
.. F$TYPE
TSTL R1 ;NULL STRING?
BEQL 10$ ;YES, THEN BRANCH
:
JSB DCL$CNVASCBIN ;CONVERT THE STRING TO DECIMAL
TSTL R0 ; Test return status
BEQL 150$ ;IF SUCCESSFUL, THEN INTEGER
; SYMBOL IS A STRING
10$: MOVAB STRING,R2 ;SETUP RETURN DESCRIPTOR
CONVERT
...DCL$CNVASCBIN:: ; CONVERT IN SPECIFIED RADIX
:
BSBW DCL$TRIM ; TRIM AND UPCASE THE STRING
:
CLRL-(SP); SAVE ROOM FOR "NUMBER SEEN" FLAG
:
MOVL R2,R0 ; TEST FOR ZERO LENGTH STRING
BEQL 70$ ; IF IT IS THE NULL STRING-RETURN ZERO
70$:...
BLBC (SP)+,90$ ; IF A NUMBER SEEN, FLAG OK AS IS
MOVL #1,R0 ; IF NO NUMBER SEEN, UNCONDITIONALLY SET TO FAILURE
90$: RSB ; BACK TO THE CALLER
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2013 03:58 PM
05-02-2013 03:58 PM
Re: F$TYPE of space is INTEGER
Never take even simple claims at face value. I just tested the sequence described here and got different ...
$ s = ""
$ t = f$type(s)
$ sho sym %
S = ""
T = "STRING"
$ tcpip show version
HP TCP/IP Services for OpenVMS Alpha Version V5.6 - ECO 5
on an AlphaServer DS25 running OpenVMS V8.3
The obvious difference is that I'm on Alpha and running 8.3 (nothing), but this code seems so fundamental to VMS you wouldn't think that it would change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2013 04:00 PM
05-02-2013 04:00 PM
Re: F$TYPE of space is INTEGER
Sorry - my mistake.
A single space character does indeed return type "INTEGER", so does a string of two spaces and even a string of about 30 spaces.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2013 04:07 PM
05-02-2013 04:07 PM
Re: F$TYPE of space is INTEGER
Further, it looks like an issue with how VMS converts numeric strings into integers.
$ s = "0"
$ t = f$type(s)
$ sho sym t
T = "INTEGER"
$ s = "A"
$ t = f$type(s)
$ sho sym t
T = "STRING"
and here's why I think so ...
$ s = " " ! space character
$ r = 4
$ x = r + s
$ sho sym x
X = 4 Hex = 00000004 Octal = 00000000004
A string that's comprised of a space character, is treated as a 0 when processing integer arithmetic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2013 04:52 PM
05-02-2013 04:52 PM
Re: F$TYPE of space is INTEGER
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2013 10:04 PM
05-05-2013 10:04 PM
Re: F$TYPE of space is INTEGER
Dan,
I agree with Hein. It looks like a bug to me. However, I'd bet that if you report this, VMS engineering will say they can't fix it because folk may be depending on the bug behaviour. The curse of fanatical upwards bug-for-bug compatibility! I've had far more serious bug reports rejected on these grounds.
That said, in this case I think I'd reluctantly agree with them. This is very basic stuff, and the behaviour must have been there a very long time. There is a rather unconvincing argument that it could be considered kind of, sort of correct (but that would apply equally to the null string).
re: John McL> A string that's comprised of a space character, is treated as a 0 when processing integer arithmetic.
Well, all strings have a numeric value, it's just not always obvious what it will be. Most are zero, but not always. For example, here's a good DCL trivia question. How come some of these results are 5?
$ r=4 $ s="A String" $ x=r+s $ show sym x X = 4 Hex = 00000004 Octal = 00000000004 $ s="This String" $ x=r+s $ show sym x X = 5 Hex = 00000005 Octal = 00000000005 $ s="Yellow string" $ x=r+s $ show sym x X = 5 Hex = 00000005 Octal = 00000000005 $ s="New string" $ x=r+s $ show sym x X = 4 Hex = 00000004 Octal = 00000000004 $ s="Forgotten string" $ x=r+s $ show sym x X = 4 Hex = 00000004 Octal = 00000000004
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2013 11:21 PM
05-06-2013 11:21 PM
Re: F$TYPE of space is INTEGER
> DCL trivia question
Good one John :-)
Cheers,
Lester