- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Checking a String symbol for numerics
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
тАО06-12-2006 01:43 PM
тАО06-12-2006 01:43 PM
thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2006 04:12 PM
тАО06-12-2006 04:12 PM
Re: Checking a String symbol for numerics
HELP LEXICALS F$TYPE
alp $ x = 123
alp $ wso f$type( x)
INTEGER
alp $ x = "123"
alp $ wso f$type( x)
INTEGER
alp $ x = "1o3"
alp $ wso f$type( x)
STRING
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2006 04:58 PM
тАО06-12-2006 04:58 PM
Re: Checking a String symbol for numerics
$ A="ABC"
$ Write Sys$output F$Type(A)
STRING
$ A="%XABC"
$ Write SyS$Output F$Type(A)
INTEGER
regards kALLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2006 11:16 PM
тАО06-12-2006 11:16 PM
Solutionsince you specify that you are starting with a STRING symbol, you can just examine each character in turn and check for a numeric. With a bit of work, you can also allow for negative numbers, leading/trailing spaces etc.
Here is a simplistic sample
$check_for_numeric: SUBROUTINE
$!
$! Check a supplied string for all numeric
$! sets $STATUS on exit
$! 1 = numeric
$! 2 = false
$! usage CALL CHECK_FOR_NUMERIC string_to_test
$ inp_string = p1
$ len_inp = f$length(inp_string)
$ inp_sub = 0
$char_loop:
$ test_char = f$extract(inp_sub,1,inp_string)
$ if test_char .lts. "0" -
.or. test_char .gts. "9"
$ then
$ exit 2
$ endif
$ inp_sub = inp_sub + 1
$ if inp_sub .lt. len_inp
$ then
$ goto char_loop
$ endif
$ exit 1
$ENDSUBROUTINE
Duncan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-13-2006 05:14 AM
тАО06-13-2006 05:14 AM
Re: Checking a String symbol for numerics
Thanks, all, for the responses.