Field Resizing Conundrum IBM i

Database modernization

With a legacy database you will need to change every program that uses the file at the same time you change the file definition. You simply have no choice. Level checking forces you to do so.

With a modern database using I/O servers, you can minimize the effort required. (Terms & Conditions apply)

Conditions:

  1. 1. Add an unused field to the end of the existing file.
  2. 2. Replace all the file IO with an IO server that does exactly what the READ WRITE SETLL CHAIN functionality does. You still need to recompile every program that uses the file, but life gets better after introducing the I/O server. This can be accomplished with minimal programming changes.

The Secret Sauce: (parameters used to call the I/O server)         

  • FUNCTION    I-Insert  U-Update  D- Delete… 
  • POINTER       Pointer is provided by caller of I/O server
  • KEY.               Key field or fields (optional depending on function)

Why locate the record format with a pointer?

  1.  1. The parameter list will not have to change every time you add a field to the file.
  2.   2. Programs using the I/O server will only have to be recompiled when an existing field or the record length changes.

Why add a 20-byte field of unused space to the record?

  To reserve space in I/O server to accommodate adding fields to the file/table in the future without disturbing the running of existing programs. The only programs that need to be recompiled are the ones using the newly added fields. Programs not using the new field are not affected by the change and will continue to work without recompilation.

This investment in IO server will allow you to handle DB Changes with minimal disruption because only one program accessing the file. This also simplifies the administration of the file.

 

Adding a Field

  1. 1. Add the field/column to the file/table.
  2. 2. Be careful not to change the length of the row/ record length
  3. 3.  Compile the I/O server and the programs requiring the new field
  4. 4.  You don’t need to compile anything that is not using the new field.
  5. 5.  Copy data.

Resizing a field:

  1. Make Changes to the file/table.
  2. Copy data from the old format to the new format.
  3. Recompile all programs using I/O server & the I/O server

I/O servers go a long way to simplify the maintenance and administration of a file.

See our open-source page for examples of a modern DB. https://databoroughservices.com/rpg-open-source-project/

Leave a Reply

Your email address will not be published. Required fields are marked *