Xref: utzoo comp.lang.fortran:5082 comp.os.vms:37480 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!romp!auschs!awdprime!heyman.austin.ibm.com!jerry From: jerry@heyman.austin.ibm.com (Jerry Heyman) Newsgroups: comp.lang.fortran,comp.os.vms Subject: Re: Checking a string for an integer Message-ID: <6313@awdprime.UUCP> Date: 1 Apr 91 21:06:38 GMT References: <1991Apr1.104227.243@biivax.dp.beckman.com> Sender: news@awdprime.UUCP Followup-To: comp.lang.fortran Organization: IBM Austin, TX Lines: 25 In article <1991Apr1.104227.243@biivax.dp.beckman.com> dsroberts@biivax.dp.beckman.com writes: >I would like to take a 3 byte string and find out if it contains only ascii >digits for number or if letters were entered. On VMS, the DCL command would be > >result = f$integer (string) > You could always use an internal READ statement. You would also have to specifiy an error state on the READ to handle alphabetic input when its not expected. Something like: READ (string, 'I3', error=xxx) result where xxx is a line number where the code should branch to if an error occurs. Its been a while since I tried this, so the syntax might be a little rough, but you get the general idea. jerry -- Jerry Heyman Internet : jerry@ajones.austin.ibm.com PSP Development Environment Tools VNET : HEYMAN at AUSTIN Austin, TX 78758 IBM T-R : jerry@heyman.austin.ibm.com *** All opinions expressed are exactly that - my opinions and NOT IBM's