TXT file naming using CL

pts.
Tags:
CL
CL/400
Copy To Import File
CPYTOIMPF
Hi I hve created a txt file from a pf using cpytoimpf.The name of the txt file should have ccyymmddhhmmss in its name.I can retreive the date and time parameters from qdate and qtime.How do i name the txt file using a CL.

Answer Wiki

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

Hi,

You’re limited to 10 positions on the AS400 database, so if you need such a long name you’ll need to use the IFS. You can do this by using the TOSTMF parameter on the CPYTOIMPF command – so you can do this in one step.

Alternatively you could create a file or member with a unique (one-up) name and put your ccyymmddhhmmss in the text description of your file or member.

Regards,

Martin Gilbert.

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
  • do you mean to say that i can give the file name in stmf parameter (CPYTOIMPF) as xxxccyymmddhhmmss.I need to code this using cl and still not sure how to do it?Please suggest.
    0 pointsBadges:
    report
  • philpl1jb
    Yes Something like this DCL &TEXTFILENM *CHAR 40 dcl &curdt *char 6 dcl &curtm *char 6 /* build your CL file name as */ RTVSYSVAL SYSVAL(QDATE) RTNVAR(&CURDT) RTVSYSVAL SYSVAL(QTime) RTNVAR(&CURTM) ChgVar &TextFileNm (QDATE *TCAT QTIME *TCAT '.TXT' CPYTOIMPF ... To stream file . . . . . . . . . TOSTMF &TextFileNm
    49,540 pointsBadges:
    report
  • Gilly400
    Hi, You'll also need to specify the location in the IFS within the TOSTMF parameter and I'd suggest some sort of character reference before the date and time to indicate what sort of file it is. So your TOSTMF parameter should be something like :- '/EXPORT/My_Text_File_ccyymmddhhmmss.TXT' Where EXPORT is an existing directory in the IFS and My_Text_File_ is a description of what the file is. You may have to experiment with some of the other parameters on the command for character conversion, delimiters, etc. Regards, Martin Gilbert.
    23,730 pointsBadges:
    report
  • Thanks a million for all your suggestion.
    0 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