4 - Setting RPG Free - RPG ILE Free Format

Set RPG Free

RPG Free Format is the younger (and imho much sexier) version of your grandads RPG Fixed Format.

RPG ILE (RPGLE) has a clear readable way of handling the SETGT (Set Greater Than) and SETLL (Set Lower Limits):

**free
// READ THROUGH FILE (BASICTBL)
// UPDATING COUNT FOR ANY ROWS WERE CODE = 'NICK'

dcl-f basictbl usage(*update);
dcl-c constantnicholas 'NICK';

setll 1 basictbl;

dou %error();

  read(e) basictbl;

  // if file error  
  if %error();    
    //  notify *sysopr that a file lock happened or something!    
    leave;
 
  // if end of file  
  elseif %eof();    
    // leave the do loop    
    leave;
 
  else; 
    // if it look good then do the logic     
    if key = constantnicholas;       
      count += 1;     
    else;       
      count -= 1;     
    endif;
    update rcdfmt;

  endif;
enddo;
 
*inlr = *on;
return; 


Confused by RPG Versions?

IBM branding has always managed to make a complete hash of things and this might explain why RPG/4 is sometimes called RPG/400 (if talking about it being column-based) and RPG/5 or RPG/free or RPG Freeformat or RPG/7 (referring to the IBM i Version you are on)

Resources

Resource 1

4 - Setting RPG Free - RPG ILE Free Format

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>