FOCUS Subroutine: CTRAN

When trying to decode define on values containing special characters, the system won't  recognize the characters as text.  Special characters in field values can cause problems when trying to use those values in a defines.   For example:  Work Location may contain characters reserved for special use in the system, such as &, *, /, - and $.  

 

In order to perform the decode define on the values, use the CTRAN subroutine to translate the special characters to regular text characters. Subroutines are built-in functions that are available which enable you to manipulate alphanumeric fields or character strings.

 

The syntax for the CTRAN subroutine is:  

CTRAN(inlen, infield, decfrm, decto, 'output')

Where:  

inlen -  is the length in characters of the input string

infield - is the fieldname of the alphanumeric input string

decfrm - is the decimal ASCII or EBCDIC value of the character to be translated

decto  - is the decimal ASCII or EBCDIC value of the character used as a substitute

output - is the format of the resulting output string enclosed in single quotation marks

 

For an example of using CTRAN, see common library program: CTRANTST  To read more about subroutines and identify available subroutines, refer to your FOCUS documentation.