DECODE Statement (Executable) [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation
HP FORTRAN 77/iX Reference
DECODE Statement (Executable)
The DECODE statement transfers data from internal storage to variables
according to a format specification.
-----------------------------------------------------------------------------------------------
| | | |
| Item | Description/Default | Restrictions |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| count | Integer expression that specifies | Must be the first item. |
| | the number of bytes to be | |
| | translated. | |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| fmt | Format designator. | Must be the second item. Must be |
| | | as specified for the PRINT |
| | | Statement. |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| unit | Internal storage designator. | Must be the third item. Must be a |
| | | scalar record field name or array |
| | | name. Assumed-size and |
| | | adjustable-size arrays are not |
| | | permitted. |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| ios | Integer variable or array element | None. |
| | for error code return. | |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| label | Statement label of an executable | None. |
| | statement. If an error occurs or | |
| | an end-of-file is detected during | |
| | execution of the DECODE statement, | |
| | control transfers to the statement | |
| | specified by this label rather | |
| | than aborting the program. | |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| list | List specifying the data to be | Each list item must be a variable |
| | transferred. | name, an array element, an array |
| | | name, a substring, or a scalar |
| | | record field name |
| | | |
-----------------------------------------------------------------------------------------------
Semantics
The DECODE statement is provided for compatibility with older versions of
FORTRAN. It is a nonstandard statement and its use in new programs is
strongly discouraged. If possible, use the internal file capabilities of
the READ statement instead.
Examples Notes
---------------------------------------------------------------------------------------
CHARACTER*20 buf i, j, and k receive the values 1234, 45,
INTEGER i, j, k and -12.
BUF = 'XX1234 45 -12XXXXXX'
DECODE (15,'(2x,3I4,1X)', buf) i,j,k
MPE/iX 5.0 Documentation