Bryan's RPG IV Journal
Free Format Alternatives to MOVE
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?
A. There are a number of alternatives to the MOVE-related operation codes, and therein lies the challenge in converting to free format. Which option you'll use depends upon the data types and sizes of the source field and the target field. Here's a table to get you started:
To replace MOVEA, at V5R3, you can use the %SUBARR function. For example:
A. There are a number of alternatives to the MOVE-related operation codes, and therein lies the challenge in converting to free format. Which option you'll use depends upon the data types and sizes of the source field and the target field. Here's a table to get you started:
| Source Field | Target Field | Alternative Coding |
| Character | Character | Use EVAL/EVALR, with or without %SUBST. |
| Character | Numeric | Use %DEC, %INT, %UNS functions (V5R2). |
| Character | Date | Use %DATE, %TIME, %TIMESTAMP functions. |
| Numeric | Character | Use %EDITC function with X edit code, with or without %SUBST function. |
| Numeric | Numeric | Use simple EVAL. |
| Numeric | Date | Use %DATE, %TIME, %TIMESTAMP functions. |
| Date | Character | Use %CHAR function. |
| Date | Numeric | Use %DEC, %INT, %UNS functions, with %CHAR function (V5R2). |
| Date | Date | Use simple EVAL. |
To replace MOVEA, at V5R3, you can use the %SUBARR function. For example:
/Free
%Subarr(Arrayname:50:5) = '10101';
/End-free
Log of Journal Entries |
|
Use this scrollable blog map to view other journal entries: |
|
| It is your responsibility to ensure procedures, techniques, and code used from this website are accurate and appropriate for your installation. No warranty or support is implied or expressed. |
![]() |
| Privacy and Email Policy |
| AS/400®, eServer, i5/OS, IBM i, Integrated Language Environment®, iSeries, OS/400®, RPG/400®, System i5, VisualAge®, and WebSphere® are trademarks of IBM Corporation. Note: IBM® System i is the latest member of the family of eServer iSeries. This site might refer to System i as System i5, iSeries, or AS/400. |
|
If you are having trouble navigating the menu at the top of this page, you may use the following scrollable site map instead: |
|
|











International visitors: