BASE64DECODE

BASE64DECODE decodes a source buffer from base 64 that is encoded in the character set specified by the ASCII or EBCDIC suboption of the DEFAULT compiler option. It returns a size_t value that indicates the number of bytes that are written into the target buffer.

Read syntax diagramSkip visual syntax diagramBASE64DECODE( p, m, q, n)
p
Specifies the address of the target buffer.
m
Specifies the length in bytes of the target buffer. It must have a computational type and is converted to type size_t.
q
Specifies the address of the source buffer.
n
Specifies the length in bytes of the source buffer. It must have a computational type and is converted to type size_t.
Note: Some arguments or return values are of type size_t. If the LP(32) compiler option is in effect, size_t is FIXED BIN(31); if the LP(64) compiler option is in effect, size_t is FIXED BIN(63).
The returned value depends on the address of the target buffer or the size of the target buffer:
  • If the address of the target buffer p is zero, the number of bytes that would be written is returned.
  • If the target buffer is not large enough, a value of -1 is returned.
  • If the target buffer is large enough, the number of bytes that are written to the buffer is returned.

This built-in function is the reverse of the built-in function BASE64ENCODE and expects that the base 64 source was encoded by using the same convention that the BASE64ENCODE built-in function uses. See Convention for encoding a source buffer into base 64 as EBCDIC for details. If other conventions were used, the results are unpredictable.