How can I convert numbers to character strings (and vice-versa)? I used to use ENCODE and DECODE but I don't dee these in the help. 😦 For example looking at a hex dump I have the following two bytes 32 38 i.e. 28 I need an integer with 28.
ENCODE AND DECODE
I don't think that ENCODE and DECODE were ever part of the fortran standard. I remember they were VAX extensions. Certainly on the VAX they were equivalent to an internal read and write, where instead of reading from and writing to a unit number a character string variable replaced the unit number. This is part of the fortran standard.
READ(character_string_variable,*)K
and
WRITE(character_string_variable,'(I8)')K
came out wrong !
READ(character_string_variable,*)K
WRITE(character_string_variable,'(I8)')K
Here are some examples on other websites: http://gcc.gnu.org/onlinedocs/gcc-3.1.1/g77/ENCODE-and-DECODE.html and http://docs.hp.com/cgi-bin/doc3k/B3150190021.12118/44 http://docs.hp.com/cgi-bin/doc3k/B3150190021.12118/36
In your case for two characters, you will need the I2 format in the read statement described by John Regards
Ian
I have a feeling that they were more than VAX-only extensions, and existed prior to the VAX. You can also give the statement number of a format statement if you wish.
E
Actually, ENCODE and DECODE go back much farther than VAX/VMS. Before there was even a Digital Equipment Corp. The oldest implementation I am aware of was as library routines on the IBM 1620. That would be circa 1960, but it may be even older.