Adding a Field to a Database File

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Adding a Field to a Database File

If a field is added to the end of a database file record format, compiling the new file definition with LVLCHK(*NO) does not always save you the effort of recompiling all the programs that use the file. If the new field is numeric, any programs that add records to the file should be recompiled anyway.

You may not be aware of the disadvantages of the following steps which programmers often use to add a new field to an AS/400 database file:

o Delete any logical files that are built over the file to be changed.

o Rename the existing file to save the current data.

o Modify the DDS for the file by adding the new field to the end of the existing record format.

o Compile the new file definition with LVLCHK(*NO).

o Copy the data back from the renamed file using the Copy File (CPYF) command with FMTOPT (*MAP *DROP).

o Recreate the logical files using LVLCHK(*NO).

Because the new file is compiled with LVLCHK(*NO), all existing programs which do not refer to the new field will work normally with the new version of the file, with one exception.

The exception has to do with the initialization of the new field when new records are written. When a program that was compiled with the old version of the file writes new records to the file, the new field will be properly initialized to blanks if it is alphanumeric. However, if the new field is numeric, it will not be initialized to zero and will contain invalid data.

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: