Problem solve Get help with specific problems with your technologies, process and projects.

Compile physical file without any data Loss

If a physical file has already the valid data and if your vendor/company asks for a new fields introduction to the existing physical file which already has the data, this tip allows you to still retaining the data and at the same time adding new fields to the existing physical file.

As usual open the source of the physical file member and add the fields required.

Press the function key F3 to save and exit.

Now the physical file has some more added fields.

Type CHGPF command on any command line,
Press F4 function key, wherein you have to enter.

Name of the Physical file
Name of the library
Name of the source physical file
Name of the library in which the source Physical file exists. 

After supplying the above, press enter for the process, system will pop up a message saying, Changes to physical file are completed.

Now use either SQL or RUNQRY command to view the data again, you are surprised to see again the same data with new added fields. The new added fields data is defaulted to the field type category.

Dig Deeper on iSeries CL programming