|
Joe, This is a dangerous piece of code. It's relying on the memory layout of the indicators by the RPG compiler that isn't defined by the RPG language spec. You're assuming that *INKE is five bytes past the address of *INKA which might not always be the case. The RPG spec makes no mention of *INKA being stored in memory before *INKE. Maybe the compiler in V5R4 will do something different with these variables and break your code. Doing this with %Addr(*IN) is ok because *IN is defined by the compiler to always be an array of all the indicators from 01 to 99. D pINKE * Inz(%Addr(*INKE)) D F5Refresh N Based(pINKE) Will work and isn't dangerous. Now F5Refresh is an alias for *INKE. Paul BTW, Mr Cozzi doesn't like the use of the *INKx indicators. Renaming the *INKx indicators with a more meaningful name solves the problem with these indicators without resorting to a key code field is some system specific data structure. Use of a renamed *INKx variable is portable but the data structure layout isn't. -- Paul Morgan Senior Programmer Analyst - Retail J. Jill Group 100 Birch Pond Drive, PO Box 2009 Tilton, NH 03276-2009 Phone: (603) 266-2117 Fax: (603) 266-2333 "Joe Pluta" > Actually, this is a little "magic" on the part of the compiler folks. > You CAN specify the variable elsewhere as a pointer (type "*"), but if > you don't, the compiler will generate one for you. Typically you use > the latter when you want to initialize it. > > D FkeyDS DS BASED(pFkeyDS) > D Fkey N DIM(24) > DpFkeyDS S * inz(%addr(*INKA)) > > Ta da. Now Fkey(5) is the same as *INKE. > > Joe
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.