0 pts.
 TXT file naming using CL
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.

Software/Hardware used:
ASKED: November 25, 2008  11:16 AM
UPDATED: November 26, 2008  5:53 AM

Answer Wiki:
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.
Last Wiki Answer Submitted:  November 25, 2008  12:01 pm  by  Gilly400   23,625 pts.
All Answer Wiki Contributors:  Gilly400   23,625 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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 pts.

 

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

 44,090 pts.

 

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,625 pts.

 

Thanks a million for all your suggestion.

 0 pts.