IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  how to extract files in certain directory

    Posted Wed April 15, 2015 12:56 PM

    Originally posted by: ediX12HIPAA


    I am stuck in the way to code this scenario.

    I have files in one directory, I would like to zip up only files matching the set of dates to a different directory.

    the leading input file is:

    fromdirectory (c:\from_inbound\)

    to directory (c:\to_archive)

    zipfrom_and_thru_date (like 2015-03-01 thru 2015-03-31)

    The source directory has varied file sizes, file names that I need to select only the ones between zipfrom_and_thru_date.  After done zip up the selected  file, the file should be deleted.

    the files that don't match the condition will remain in the c:\from_inbound

    Please help me to code this.

    Thanks

    ediX12hipaa


    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 2.  Re: how to extract files in certain directory

    Posted Fri April 17, 2015 12:22 PM
      |   view attached

    Originally posted by: paul.brett


    I enclose an example of manipulating the input file name to extract a date from it, and then testing that date against two other dates, which form a valid range.

    The input file in my example is File-2015-03-01.txt.  The output process is logged as:

    Y:\from_inbound\File-2015-03-01.txt
    Y:\from_inbound\
    File-2015-03-01.txt
    File-2015-03-01
    2015-03-01
    File date found : 2015-03-01
    ZIP from date is 2015-01-01
    ZIP to date is 2015-12-31
    OK to ZIP and Delete

    Let us know if this suits your purposes.

    Thank-you.

    Paul.

    Follow me on Twitter


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange

    Attachment(s)

    zip
    from_inbound.zip   2 KB 1 version


  • 3.  Re: how to extract files in certain directory

    Posted Fri April 17, 2015 12:32 PM

    Originally posted by: ediX12HIPAA


    thanks Paul.

    I will digest your code and let you know.

    ediX12HIPAA


    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 4.  Re: how to extract files in certain directory

    Posted Fri April 17, 2015 01:17 PM

    Originally posted by: ediX12HIPAA


    Hi Paul,

    I  know how to code all the "group1" in your map.  Also "TextItem[1], textitem[2]".  What I don't know how to code is:

    ,"OK to ZIP and Delete","Do not process"

    I have a directory full of files with different dates.  I only want to zip the ones that fall on date range that I determine.  What I don't know how to code is the "zip" adapter which involve with "delete" the file when it's successfully done the zip.

    zippingfile = PUT("ZIP",....this is the part that I don't know how to add the "delete" option in)

    when files don't match with the date range I am looking, then I just want to leave them where they are, untouch.

    Thank you.


    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 5.  Re: how to extract files in certain directory

    Posted Mon April 20, 2015 02:59 AM

    Originally posted by: paul.brett


    In my example map, I showed how to do the decision making process.

    To ZIP the file, you would either use the ZIP adapter or the BATCH adapter with a command line ZIP program.

    As a final step, you could send the input file reference to a dummy RUN() map, with the OnSuccess setting for the input card set to delete, to ensure the file is deleted if everything is successful up to that point.

    If you need further help with your design, perhaps you could open a PMR?  I can also recommend one of the excellent training courses available through IBM Education.

    Thank-you.

    Paul.

    Follow me on Twitter


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange