Category: <span>FAQs and Tips</span>

Q. I’ve been trying to convert a series of RPG IV programs to free format, but I’ve been very frustrated, because free format doesn’t support the MOVE operation. I don’t want to switch back and forth between fixed format and free format (the result is ugly). What can I do? Is there an easy alternative?

It’s common to use the QCMDEXC or QCAPCMD API when you want to execute a CL command from an RPG program. But you may find it more convenient to use a C runtime library function, system(), to accomplish the same purpose. The system() function will pass a command string to the command processor, without the need to pass the length of the command string, or any other parameters for that matter.

Q: In your RPG IV Modules, Procedures & Service Programs presentation, there is an example showing how to use QCMDEXC in a prototype. If an error occurred while executing this code is there a way to handle it internally?