View Full Version : CHGPF Problem with field lengths
10-17-2003, 06:34 AM
fmoldenhauer wrote: > I am noticing that when I use CHGPF to change a field length, the > field length does not change in any logicals that do not use the > physical files record format (fields specified in DDS). Has anyone > seen a solution to this problem? I'm not sure I understand what you are saying, could you show us the relevant DDS code? Bill
10-17-2003, 07:00 AM
I guess it's just playing safe and not touching any fields that you explicitly define in the LF. For example, you may have specified the field there because you want to change it from how it was defined in the PF, in which case you probably would not want the CHGPF to overwrite your LF definition. I guess there is the argument that CHGPF could look a bit more closely at the LF source to see how you have defined the field and if it could be changed or left alone, but as it is I do not know of a way to "fix" this. Still, at least you're aware of the matter! That's one up on someone who might assume the LF is changed and then finds out some time later that it's not the case and they've then got big problems.
10-20-2003, 09:14 AM
The probelem occurs when you have a logical (see TESTL1 sample DDS below) where not all fields from the physical are used. When you change the field length of a field, say FIELD1 from 10 char to 12 char, and use command CHGPF FILE(testpf) SRCFILE(MYLIB/QDDSSRC)to recreate the file, the field length for FIELD1 in the physical (TESTPF) and the 2nd logical (TESTL2) is now 12 characters but in logical TESTL1 it is still 10 characters. <hr width=50 align=left>Code ('http://www.mcpressonline.com/mc/showcode@@.6ae825c5/2')
10-20-2003, 10:45 AM
The reason that the length of Field1 does not changes for TESTL1 is that it has a different record format name than the physical file. From DB2 UDB for iSeries Database Programming V5R1: When you change, add, and delete fields with the Change Physical File (CHGPF) command, the following relationships exist between the physical and logical files that share the same record format: o When you change the length of a field in a physical file, you will also change the length of the logical file's field. o When you add a field to the physical file, the field is also added to the logical file. o When you delete a field in the physical file, the field will be deleted from the logical file unless there is another dependency in the DDS, such as a keyed field or a select or omit statement.
10-20-2003, 10:59 AM
I am noticing that when I use CHGPF to change a field length, the field length does not change in any logicals that do not use the physical files record format (fields specified in DDS). Has anyone seen a solution to this problem?
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.