Or don’t put CL into RPG — put it into a CL module and bind it for a procedure. Compile it rather than calling an API to interpret it. The CL compiler already does a lot of work for you. Why write RPG code to construct a command in a string out of multiple variables, pass it to an API and then handle whatever results it might log in the job? That’s all easier to do in a module that’s written in the appropriate language.