CPYF

105 pts.
Tags:
AS400 Command
CPYF
IBM DB2
Is there any way to create a new physical file(say PF2) with same structure/fields as in a logical file(say LF1, whose physical file is PF1). One way is to use CPYF to create PF2 from LF1 but I dont wan't any data to be copied from LF1 to PF2 (dont want to use clrpfm after copying data) Is there any option in cpyf like *nodata as in crtdupobj ? OR Any other option other than CPYF?

Software/Hardware used:
AS400

Answer Wiki

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

Discuss This Question: 5  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
  • TomLiotta
    You should be able to use CPYF though it's not really designed for that purpose. For example, you specify an impossible condition such as INCCHAR(*RCD 1 *GT X'FF') so that no records will be copied. (There will never be a character with a hex value greater than x'FF'.) You can also use the SQL CREATE TABLE ... LIKE statement. -- Tom
    125,585 pointsBadges:
    report
  • anuppdas
    Thanks Tom
    105 pointsBadges:
    report
  • Sai4AS400
    Hi anup, Please note LF will never contain any data. So even if you use CPYF command here, it will not copy any data from LF1 to PF2, Since LF1 dosen't contain any data of PF1. It will only have a view to PF1.
    1,420 pointsBadges:
    report
  • TomLiotta
    Although a LF doesn't contain data, it will reference dat in the PF. The CPYF command will copy data from the PF, but it will format data according to the LF definition. . The data will be copied even though it's not contained inside the LF. A LF is just like a SQL VIEW. It doesn't contain, but it does define the access to the data. . Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Sai4AS400, good that you're adding to the knowledge base. As Tom said, if you copy a logical file you will be coping all the rows that are available to use through that logical. Since this request was to create a pf like the logical but without the data, Tom had recommended using the CPYF with a record selection rule that wouldn't succeed in finding any records. Tom's recommendations from Nov 17, 2012 are accurate and complete.
    51,355 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