I can see that the system() command requires a *string type variable (that is, a null-terminated string – one that ends with hex ’00’).
You are passing it an RPG varying string – one whose length is given by a length attribute. RPG will pass the data part of the string, without the two-byte length part, which system() would not have understood anyway.
So, what you need to do is add the X’00’ to the end of your string:
command = ‘CRTDIR \XMLDATA’ + path + X’00’;
Et voila! As Del Boy would say, you should have liftoff.
Sloopy, after a long lunch.
The CRTDIR command requires a quoted string if the value contains special characters such as a back-slash. Send in the correct string value and the error should change.
Since you define <i>Options(*String) </i>, the prototype should handle the null-termination fine for you. That’s one of the reasons for specifying it.