Computing.Net > Forums > OpenVMS > check if input has all integer char

check if input has all integer char

Reply to Message Icon

Original Message
Name: snn
Date: November 28, 2006 at 20:43:05 Pacific
Subject: check if input has all integer char
OS: open vms
CPU/Ram: anything
Model/Manufacturer: anything
Comment:

i m new to open vms......kindly help to check if input has all integer characters in DCL SCRIPTS.


Report Offensive Message For Removal

Response Number 1
Name: Joseph.Huber
Date: November 29, 2006 at 02:50:31 Pacific
Subject: check if input has all integer char
Reply: (edit)

Probably (not sure it covers all cases :-) the easiest is
if f$type( symbol ) .eqs. "INTEGER" ...
If the input has been read into DCL symbol "symbol".

Example:
$ inquire symbol "Enter a number"
$ if f$type(symbol).eqs."INTEGER"
$ then
$ write sys$output "o.k., number:",symbol
$ else
$ write sys$output "not a number: ",symbol
$ endif

And the check does not prove if it is Decimal,hexadecimal or Octal.



Report Offensive Follow Up For Removal

Response Number 2
Name: Joseph.Huber
Date: November 29, 2006 at 04:19:54 Pacific
Subject: check if input has all integer char
Reply: (edit)


Depending on what You want to do with the input afterwards, You might want to convert the symbol afterwards to an integer DCL symbol to be independent of the source (decimal, %X for hexadecimal, %O for octal):

$ if f$type(x).eqs."INTEGER" then x=f$integer(x)


Report Offensive Follow Up For Removal

Response Number 3
Name: Waxinator
Date: December 2, 2006 at 09:19:19 Pacific
Subject: check if input has all integer char
Reply: (edit)

$ menu:
$ type sys$input

Here are your choices:
1. fgdgfgdf
2. fsfdsdf
3. fsfsdfsd

$ read /err=menu /end=end_it /prompt=" Make a choice: " sys$command choice
$ if choice .lt. 1 .or. choice .gt. 3 then goto menu
$ goto choice_'choice'
$
$ choice_1:
...
$ goto menu
...
$ end_it:


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: check if input has all integer char

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software