Convert text (string) to number
A text variable with the content "123.5" is still a text. You can't calculate with it. To do this, the text must be converted into a number.
C Convert text to a number
C
C call:
C CALL PCO001 (TEXTVAR,RZAHL,IERR,LUWRIT,LUREAD)
C
C The following variables must be defined beforehand:
C
C TEXTVAR : Text to be converted
C RZAHL : Result as real value
C IERR : Error code of the function
C 0 = the conversion was successful
C 1 = the conversion was not successful
C LUWRIT : is not evaluated, but must be specified
C LUREAD : is not evaluated, but must be specified
C
C NOTE: The text variable TEXTVAR must be declared in the program header
C !
C CHARACTER *80 TEXTVAR
C
C Example:
C ------------------------------
C Convert text to a number
C ------------------------------
TEXTVAR = "123.5"
C
CALL PCO001 (TEXTVAR,RZAHL,IERR,LUWRIT,LUREAD)
C
C The output with the instruction:
WRITE(6,*)RZAHL
C
C produces: 123.5
C
C NOTE: TEXTVAR may only contain numbers and the decimal point.
C As a decimal point, both a period (.) and
C a comma (,) are allowed.
C If the conversion fails, RZAHL is 0 and
C IERR is 1.
C