I make frequent use of the RPG *LIKE DEFN operation, as I enjoy the increased security of defining work fields properly. There is, however, a very subtle consideration with *LIKE that caused me quite a bit of debugging time.
For a recent project, I had defined fields as shown in 3. Note that the field OFFSET is defined as a binary field, length four (which allows up to nine digits). I also wanted field PMOFST to be defined as a binary field, length four. By using *LIKE DEFN as shown in the figure, however, PMOFST is defined as a packed field, length nine.
For a recent project, I had defined fields as shown in Figure 3. Note that the field OFFSET is defined as a binary field, length four (which allows up to nine digits). I also wanted field PMOFST to be defined as a binary field, length four. By using *LIKE DEFN as shown in the figure, however, PMOFST is defined as a packed field, length nine.
In most circumstances, this probably would not cause any problems. But in my usage, I specifically needed a binary field, as I was using it as a parameter to an openness API. Many of the APIs require binary fields as parameters. In my case, the unforeseen conversion to packed is what caused erroneous processing.
Gotcha! Likewise, My Friend
Figure 3 RPG source for *LIKE DEFN
Figure 3: RPG Source for *LIKE DEFN I DS I B 1 40OFFSET C *LIKE DEFN OFFSET PMOFST
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