Copy data from .txt file to physical file

15 pts.
Tags:
AS/400
CL
CPYFRMIMPF
I am trying to copy data from a .txt file to a physical file and I keep receiving an error code 7. My text file is not delimited at all, but my physical file is composed of about 20 separate fields. Does my 'from file' have to be delimited to use this command? Is that why I'm getting an error? It sees the entire 'from file' record as one big field of data that contains alpha characters and it wants to put it into the first field of my physical file which happens to be zoned numeric? Any help is much appreciated.

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: 4  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
  • RayDutil
    Here is the command I'm using: CPYFRMIMPF FROMSTMF('/home/rdutil/prj36up1.txt') TOFILE(NEWPAY/PRJ36) MBROPT(*REPLACE) STMFLEN(135) RCDDLM(*CRLF) STRDLM(*NONE) RMVBLANK(*NONE) RPLNULLVAL(*NO)
    15 pointsBadges:
    report
  • TomLiotta
    I can't tell what the right way to do it is. From your description, your command apparently needs to look more like this:
    CPYFRMIMPF FROMSTMF('/home/rdutil/prj36up1.txt')
               TOFILE(NEWPAY/PRJ36)
               MBROPT(*REPLACE)
               RCDDLM(*CRLF)
               DTAFMT(*FIXED)
               STRDLM(*NONE)
               RMVBLANK(*NONE)
               RPLNULLVAL(*NO)
    You said your streamfile isn't delimited, so the DTAFMT(*FIXED) parameter needs to be specified. I don't know if you need STMFLEN(135). Without seeing what lines in the streamfile contain and what your database file is like, that's about as far as it can go. It won't run, though. The error message will explain why, and the <help> for the command will explain what to do about it. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    fixed requires that each "column" of the input data be spaced according to the database file that you're putting the data into. Easy enogh for Character fields, A bit an issue with other types of fields.
    49,730 pointsBadges:
    report
  • TomLiotta
    fixed requires that each “column” of the input data be spaced according to the database file that you’re putting the data into. I haven't needed to use *FIXED, so I don't know. Examples in the Info Center seem to show that matching the spacing/positioning is not required. As near as I can tell, that's one main point of the FDF -- to provide a conversion map. Tom
    125,585 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