The DECODE statement substitutes English words for coded data obtained from the input file. This makes a report more accessible to end users.
All hexadecimal literals must be expressed in X'ab' format.
DECODE "Parms".
Parms:
Fldname1 REPLACE ‘literalx’ WITH ‘literaly’ [REPLACE ‘literalx’ WITH ‘literaly’] ... [ELSE ‘literalz’]
Indicates the name of the coded field. The field must have a data type of A/N or BIT.
Indicates the encoded value in the coded field.
Indicates the translation or decode value. All decode values must be the same length. Pad shorter decode values with blanks to equalize decode value lengths.
Indicates a decode value used for undefined coded data. 'literalzn' must be the same length as 'literalx' and 'literaly'. If it is shorter, pad it with spaces. If you do not specify an ELSE clause, VMRGRW uses blanks for data that do not match ‘literalx’ or ‘literaly’.
Example
Say you want to replace the numeric values in the AUREJ field (from the CA VM:Tape AUDIT database) with English words. The statement below does this. The statement also replaces any value other than '010', '011', and '012' with the word NONE. Note that all of the decode values in the statement are padded to the same length.
DECODE AUREJ REPLACE '010' WITH 'READ '
REPLACE '011' WITH 'WRITE' REPLACE '012' WITH 'WRITE' ELSE 'NONE '.
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |