Midrange News for the IBM i Community


Posted by: John Dowling
Array Processing
has no ratings.
Published: 01 Mar 2013
Revised: 05 Mar 2013 - 2144 days ago
Last viewed on: 15 Jan 2019 (3591 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Array Processing Published by: John Dowling on 01 Mar 2013 view comments(4)

I have a field in a customer master that contains both City and state.  I want to move state to another field.  My thought process is to load the address into an array, read from the last postion untill I find the first no blank field, read one more then I have the state. here is the code

 

D                 ds                                  
D    address                    30    dim(1)          
D      cycyst                   30    overlay(Address)

 

                    x       =  30;                  
               dou  address(x)<> ' ';               
                    x       =  x-1;                 
               enddo;                               
                    x       =  x-1;                 
                                                    
                    field6  =  %subst(Cucyst:x:2);  

 

I am getting a subscript out of range on the second pass (when x=29)

any ideas ?

thanks

 

 

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS