I came across a strange behaviour of the base64_decode function. This is the code that I have:
Code: Select all
H DFTACTGRP(*NO) actgrp(*caller) decedit('.')
H debug option(*srcstmt:*nodebugio:*noshowcpy)
H bnddir('BASE64')
/copy BASE64_H
d message s 80000a ccsid(*utf8) varying inz(*all' ')
d msg s 80000a varying
// message = '';
msg = 'SGkgVGhlcmUu';
%len(message)=base64_decode(
%addr(msg:*data):%len(msg):
%addr(message:*data):%len(message:*max));
*inlr = *on;
When the line is commented as it is it works fine.
It seems that base64_decode takes into account the length of the variable before the call when it should not. Or is this rather a compiler issue (we are not quite current on PTFs)?
Regards,
Peter