Re: Integer number with no leading zeros
- From: JF Mezei <jfmezei.spamnot@xxxxxxxxxxxx>
- Date: Wed, 18 Oct 2006 03:21:30 -0400
One easy but not foolproof way to remove leading zeros:
$READ/PROMPT="Please enter number:" SYS$COMMAND NUMBERIN
$NUMBEROUT = 'NUMBERIN
$WRITE SYS$OUTPUT "Integer number is ''numberout'"
What it does is use the DCL interpreter to convert the string that was
inputted into a fully binary number.
aka: NUMBEROUT = 003456 gives the symbol NUMBEROUT the numberic value
of 3456 which is what is then displayed in the write sys$output.
However, if the person enters jibberish, this may generate a DCL error
because DCL may end up trying to do:
NUMBEROUT = chocolate mousse consists of chocolate, eggs , butter and a
bit of grand marnier
and DCL won't like that statement.
You can look into using F$INTEGER which may give you better error control
aka: NUMBEROUT = F$INTEGER( numberin )
If there is jibberish in "numberin", then NUMBEROUT is equal to 0.
HELP LEXICALS will give you a list of various lexicals you can use and
each is usally funisehed with examples of use.
.
- Follow-Ups:
- Re: Integer number with no leading zeros
- From: briggs
- Re: Integer number with no leading zeros
- References:
- Integer number with no leading zeros
- From: apogeusistemas
- Integer number with no leading zeros
- Prev by Date: Re: All about Squirrel webmail - please tell me
- Next by Date: RUN process /ON=node
- Previous by thread: Re: Integer number with no leading zeros
- Next by thread: Re: Integer number with no leading zeros
- Index(es):