User Tools

Site Tools


is_array_empty

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

is_array_empty [2018/02/07 08:47] (current)
mihael created
Line 1: Line 1:
 +====== Is Array Empty? ======
  
 +To test if a character array is empty you can iterate through all elements to check each element separately.
 +
 +Another method is to sort the array and then look if the first element is empty (empty elements should come last if sorted).
 +
 +You can also overlay the whole array with another variable and just check the variable if it is blank.
 +
 +<sxh>
 +dcl-proc main;
 +
 +  dcl-s values char(10) dim(3);
 +  dcl-s allValues char(30) based(ptr);
 +  ptr = %addr(values);​
 +
 +  values(2) = '​hallo';​
 +
 +  if (allValues = *blank);
 +    dsply '​blank';​
 +  else;
 +    dsply 'not blank';​
 +  endif;
 +
 +end-proc;
 +</​sxh>​
 +
 +{{tag>​devel ibm rpg}}
is_array_empty.txt ยท Last modified: 2018/02/07 08:47 by mihael