Problem solve Get help with specific problems with your technologies, process and projects.

How to load compile time arrays in D-specs

Compiled time arrays, both numeric and character, can be loaded in the D-specs. Using data structures and the overlay keyword allows the array to be both specified and loaded

Compiled time arrays, both numeric and character, can be loaded in the D-specs. Using data structures and the overlay keyword allows the array to be both specified and loaded. No more scrolling all the way to the bottom of the source and trying to figure out which part of that long string is the 25th array entry! This sample program shows how to load the array, and in debug see the array members with the loaded data.

 
  
 d testds          ds
     d  fld1                         25a
inz('0001202562000390043300050')
     d  arr1                          5s 0 dim(5) overlay(fld1)
     d
     d  fld2                         25a   inz('XyZ  ab  cLMN Odefgh  x
')
     d  arr2                          5a   dim(5) overlay(fld2)

     d x               s              2s 0
     d dspnbr          s              5s 0
     d dspstr          s              5a

      /free
       for x = 1 to 5;
         dspnbr = arr1(x);
         dspstr = arr2(x);
       endfor;

       *inlr = *on;
      /end-free                                               
  
  


Dig Deeper on iSeries programming commands

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close