Once upon a time, it was a rather tedious task to left-adjust decimal values and right-adjust character values with RPG. Nowadays, some of the more recent operation codes make the adjustments easy. 1 contains the source code for RPG subroutine ADJUST, which will left- or right-adjust the contents of a 30-byte variable. All you need to do is load the receiver variable field (RCVVAR) with the value you want to adjust and load the adjustment type field (ADJTYP) with an 'L' to left adjust or 'R' to right-adjust.
Once upon a time, it was a rather tedious task to left-adjust decimal values and right-adjust character values with RPG. Nowadays, some of the more recent operation codes make the adjustments easy. Figure 1 contains the source code for RPG subroutine ADJUST, which will left- or right-adjust the contents of a 30-byte variable. All you need to do is load the receiver variable field (RCVVAR) with the value you want to adjust and load the adjustment type field (ADJTYP) with an 'L' to left adjust or 'R' to right-adjust.
Right-adjust or Left-adjust Subroutine
Figure 1 RPG Subroutine to Left- or Right-adjust a Value
*=============================================================== C Z-ADD1234567 FLDDEC 120 C MOVEL'ABCDEFGH'FLDALF 12 C MOVE FLDDEC RCVVAR 30 P C MOVEL'L' ADJTYP 1 C EXSR LRADJ C RCVVAR DSPLY C MOVE FLDALF RCVVAR P C MOVEL'R' ADJTYP C EXSR LRADJ C RCVVAR DSPLY C MOVEL*ON *INLR *=============================================================== *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 C LRADJ BEGSR * Load RCVVAR with value to be left or right adjusted * Load ADJTYP with 'L' to left adjust; 'R' to right adjust C MOVE ' 0' BLKZRO 2 C MOVE *BLANK BLANK 1 C *LIKE DEFN RCVVAR STRING+ 1 * Left adjust C ADJTYP IFEQ 'L' C 31 ADD 1 FACTOR 30 C MOVE RCVVAR STRING P C BLKZRO CHECKSTRING POS 30 C FACTOR SUB POS STRLGT 30 C STRLGT SUBSTSTRING:POSSTRING P C MOVELSTRING RCVVAR C ELSE * Right adjust C Z-ADD31 FACTOR C MOVELRCVVAR STRING P C BLANK CHEKRSTRING POS C FACTOR SUB POS BLK 30 C BLANK CAT STRING:BLKSTRING P C MOVE STRING RCVVAR C ENDIF C ENDSR *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 *===============================================================
Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:
LATEST COMMENTS
MC Press Online