Export DB2 file with correct date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hathewj
    New Member
    • Jan 2008
    • 3

    Export DB2 file with correct date

    My export line looks like this:

    EXPORT DATA TO C:\IMPORT\ASSET S.CSV (DATAFORMAT = CSV

    This works OK, but this file is eventually sent automatically via FTP to another location and the file has to be in this format:

    ASSETS-YYYY-MM-DD.CSV where the yyyy,mm,and dd are todays date.
    Rather than rename each after the proc has run, is there a way to allow DB2 to add that date?

    Thanks
  • MindBender77
    New Member
    • Jul 2007
    • 233

    #2
    Originally posted by hathewj
    My export line looks like this:

    EXPORT DATA TO C:\IMPORT\ASSET S.CSV (DATAFORMAT = CSV

    This works OK, but this file is eventually sent automatically via FTP to another location and the file has to be in this format:

    ASSETS-YYYY-MM-DD.CSV where the yyyy,mm,and dd are todays date.
    Rather than rename each after the proc has run, is there a way to allow DB2 to add that date?

    Thanks
    I hope this might help you. I perform a similar task but, use a .BATCH file. The batch names the export using Dos commands.

    Here's an example:
    Code:
    db2 connect to DB 
    del C:\Folder1\Filename1_%Date:~10%%Date:~4,2%%Date:~7,2%.CSV
    db2 export to C:\Folder1\Filename1_%Date:~10%%Date:~4,2%%Date:~7,2%.CSV of del
    Select......
    exit
    The result is:
    Code:
    Filename1_yyyymmdd.CSV
    Hope this might assist you,
    JS

    Comment

    • hathewj
      New Member
      • Jan 2008
      • 3

      #3
      Thanks, but I have to run the export in QMF for windows. I know QMF pretty well, but that is about it.
      I tried but no go in QMF

      Comment

      Working...