Flat file to PF conversion

1150 pts.
Tags:
DB2/400
Flat files
Physical File
Hi, can anybody tell me how to transfer the entire flat files contents to a new Physical file in regular fields format?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Use Cpyf with fmtOpt *NOCHK
Phil

/////////////////////
Assuming that the flat file is
1. In a library on your AS/400
2. Fixed length fields

then
1. Create and compile the DDS which represents the data as fields
if first 30 are address, next 20 are city, next 10 are zip create those fields
at this point the fields probably are all text.
2. Use the CPYF command to copy the flat file to the fielded file.

Once you have it in a fielded file you may want to use RPG or SQL to convert some of the text fields to decimal.

Phil

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • ten2008
    Hi thanks for your response, but the flat file in my question has no fields defined, with only data in side it.Pl tell me how to create the PF with the data inside the flat file and to move the data to respective fields.Shall i need to write a CLP and a RPG program? pl clarify further...thanks
    1,150 pointsBadges:
    report
  • Sofar
    Phil's answer is just what you need. You must create a physical file with the fields defined that make up the data in the flat file. So, for instance, your flat file has the 1st 30 characters which is an address and then the next 20 city, and so on and so forth. Each field must be defined in the order that it is in the flat file. Next, using the cpyf command you would tell it to copy from the flat file into the new file which you have created and use the parameter for fmtopt to be *nochk. This will bring the data from the flat file into the new field-defined file. That's all you need. You could write a program to do the same thing but why waste your time when the copy file command will do it for you unless there are certain pieces of the flat file data that you don't want in the new file.
    120 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following