×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Here 'the math' comes from the details for the structure as given by
IBM. So it's just punching in the starting locations and lengths. And of
course you don't have to define EVERY variable, I do so in this example
as I use it as an example, you need define only what you want to use.
Where 'the math' part wins here is when you roll to the next entry in
the returned list, in this case next tape. You add the offset to the
pointer and instantly every defined variable that is a subfield of the
*BASED variable that the pointer points to has the new value. Before
*DEFINED and *BASED you had to do things like
CHGVAR &VARSTART (&VARSTART + & OFFSET)
CHGVAR &VOLID (SST(&APIRETURN &VARSTART 6))
etc etc for Every Single Variable. So the loop part was long and ugly.
And if IBM ever changed the layout of the return data (e.g. FMT0100
replaced with FMT0200) you got to go change all the lengths etc in the
math. Now you only change the positions in the data structure.
Fabulously less prone to error.
Note that I'm not saying you can't or even shouldn't do this in RPG
rather than CL but hey it's better!
- Larry "DrFranken" Bolhuis
www.Frankeni.com
www.iDevCloud.com - Personal Development IBM i timeshare service.
www.iInTheCloud.com - Commercial IBM i Cloud Hosting.
On 7/9/2019 1:53 PM, Rob Berendt wrote:
Isn't the example below still doing the math for every column?
I thought there was something newer where you didn't have to do the "33" part of the following:
DCL &Tsys *CHAR 8 STG(*DEFINED) DEFVAR(&Cinf 33) /* Tape System */
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.