Re: Integer number with no leading zeros



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.
.