how to change the length of the field in a physicalfile?
Answers were Sorted based on User's Feedback
Answer / shanky
CHGPF Command:-
You need to Change DDS of Physical file for Changing Fileds
Length. and after det u need to complie it but if you
complie it then u will loose Existing Data of ur File.
So By Using CHGPF Command u can Keep ur Existing Data with
Compilation Of changed fields(DDS).
| Is This Answer Correct ? | 13 Yes | 1 No |
Answer / vani
i think by using the CHGPF it is possible.if anybody tell
me is it right or wrong
| Is This Answer Correct ? | 18 Yes | 9 No |
Answer / gautam
As per my understanding,we can not change length of a field
in a physical file using command CHGPF.Using this command
we can change number of records and so on.
If we want to change length of a field then we have to
change its source where we previously defined the size of
the field and then requires a compilation.After compiling it
we delete all logicals based on this physical file then
file is re-build in respective file groups from where
prorams use records.
Please let me know if there is any issues!
| Is This Answer Correct ? | 13 Yes | 5 No |
Answer / sachin
By Using CHGPF, We can Change Length add New field or
change field Attributes in PF
| Is This Answer Correct ? | 8 Yes | 3 No |
Answer / abhishek bajpai
Hi All,
Just to elaborate on the above answers..offcourse CHGPF is
correct and we can just press enter on this command and it
modifies the object based on the current DDS keeping the
data intact. But there are a couple of things to be taken
care of in this:
1.> If we are increasing the field lenghts then there is no
problem at all and chgpf runs absolutely fine.
2.> If we are decreasing the field length, then in case of
character field it will give warning as the existing
records might be truncated because of the shortened length.
But in case of numeric field the caommand will fail because
OS400 cannot truncate the existing numeric data and the
command blows up.
3.> If suppose the command is successfully run and the
field length is changed in the PF then there r chances that
the LF wont reflect the change. If in LF Pfile is mentioned
and no fields (that means the whole record format is copied
from PF) then it will reflect the new length. But in case
you have mentioned certain fields in LF then it will keep
on showing the old lenght inspite of the fact that in PF
the lenght is changed. This is because here the field
attributes are copied to LF from the PF when it is compiled
and it keeps on showing that length only.
Thanks
Abhishek Bajpai
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / ramaraju
By using CHGPF comaand we can change the pf attribute size.
And another way is
copy the physical file into another dummy file(for that
use Cpyf)
and change the physical file field length ,compile it
Then again copy the data from dummy file to original file
| Is This Answer Correct ? | 4 Yes | 4 No |
Answer / abhishek kumar
I agree that we can do this using the command CHGPF but
whether any one can tell which paramter we need to change
in CHGPF?
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / manu som
By using CHGPF comaand we can change the pf attribute size.
And another way is
copy the physical file into another dummy file(for that
use Cpyf)
and change the physical file field length ,compile it
Then again copy the data from dummy file to original file
| Is This Answer Correct ? | 2 Yes | 4 No |
Answer / swapnil sanghai
Hi All,
just wanted to check if it works for PF ( Flat Physiccal
File ). I do not see option for changing the length of
file. Can you please correct me if im wrong .
| Is This Answer Correct ? | 0 Yes | 2 No |
1.How can you search an entire source file for a particular field name? 2.How can you find the differences between two versions of the source for the same program? 3.What is a hidden field as it relates to a sub file? 4.How do you display a sub file that has no records in the sub file?
how to change the length of the field in a physicalfile?
what is post opcode do
How do you do indexing in a physical file?
write an RPG program to calculate the marks of 5 students (A,B, C, D, E)in 3 different subjects (eng, math, sci) an display on the screen
Suppose we have 10 records with same name and we are reading using READE,after 4 record i have to use CHAIN what is the output
To check the locks , we use cmd WRKOBJLCK , but how we confirm whether it's objeck lock / member lock. I confused with the Lock type and Status values...Can any body please tell me ...
Let?s consider a variable X of length 20. Move value ?ABC? to it.How to determine how many characters does X have?
Can we used ovrdbf command after the opnqry file if yes then What will be out put of your program?
Suppose my file has 10 fields and I want to make the 2nd field zeros in all records. And assume I have millions of records and I dont want to read each record and update the desired field with 0. Any other way to do this in one step operation?
How to write record if no field or the field are different in physical file in rpgle ?
HI, 1: WHAT IS THE FUNCTION OF %KDS?WITH PROGRAMMING CODES EXAMPLE 2: WHAT IS THE FUNCTION OF Z-ADD AND Z-SUB ? WITH PROGRAMMING CODES EXAMPLE