IBM Sterling Transformation Extender

Sterling Transformation Extender

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


#Sterling
#Supplychain
 View Only
  • 1.  FTP - Directory Listing

    Posted 06/18/10 09:39 AM

    Originally posted by: jadamski


    Greetings - I have a requirement to use a variety of files located on an FTP as input to my map however I need to preserve the original file names. I would like to have a map that has an input card to do a directory listing out on the FTP and then use that listing to FTP each individual file preserving the file names via a map call to another FTP map over riding the input/outputs. I just can't seem to figure out the correct syntax to use on the input card FTP adapter parameters to yield a directory listing. Any help would be appreciated.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 2.  Re: FTP - Directory Listing

    Posted 06/18/10 09:49 AM

    Originally posted by: SystemAdmin


    Here's an input adapter string to list the files on an FTP server (this would be used with the RUN function):
    
    -IAFTP1 
    '-URL "ftp://user:password@server/directory/*.txt;type=D" -T tracefile.txt -TIMEOUT 20'
    


    replace the *.txt with a suitable string or just use *

    to then pick up the files, iterate through them using:
    
    -IAFTP1 
    '-URL "ftp://user:password@server/directory/filename;type=I" -T tracefile.txt -TIMEOUT 20'
    


    and replacing filename with the file names you retrieved in your directory listing.

    If you want to improve performance, do the directory listing in one thread and retrieve the files back in multiple threads (you'd need some locking across the 2 processes though).
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 3.  Re: FTP - Directory Listing

    Posted 06/23/10 11:39 AM

    Originally posted by: winlix


    Thanks Oliver.
    I just need to run my ftp map using command server.
    I have used the following command,but I'm getting error as "Invalid Command Line."

    dstx Blob_ftp.mmc -IAFTP1 '-URL "ftp://user:password@server/directory/filename;type=I" -T tracefile.txt -TIMEOUT 20'

    Blob_ftp.mmc ,this is just a blob map contains FTP input adaptor and FILE output adaptor.
    Its running fine using Event server.
    How should I need to run it using command server ?

    Your help would be deeply appreciated.

    Thanks,
    Dinesh
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 4.  Re: FTP - Directory Listing

    Posted 06/23/10 02:34 PM

    Originally posted by: SystemAdmin


    Hi - I always have to play around with the command line single and double quotes and to get it to work but something like this should work:

    
    dstx 
    "Blob_ftp.mmc -IAFTP1 '-URL ftp://user:password@server/directory/filename;type=I -T tracefile.txt -TIMEOUT 20'"
    


    if your filename has spaces in it, try using 2 sets of double quotes:

    
    dstx 
    "Blob_ftp.mmc -IAFTP1 '-URL "
    "ftp://user:password@server/directory/filename;type=I"
    " -T tracefile.txt -TIMEOUT 20'"
    

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


  • 5.  Re: FTP - Directory Listing

    Posted 06/23/10 04:11 PM
      |   view attached

    Originally posted by: paul.brett


    Please review the enclosed ready-made example for doing exactly what you require.

    The map to execute is Master.mmc and it takes all the parameters required from config.txt

    Hope that helps.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender

    Attachment(s)



  • 6.  Re: FTP - Directory Listing

    Posted 06/24/10 04:30 PM

    Originally posted by: winlix


    Thanks a lot Oliver and Brett for your prompt response.
    Its working fine.

    Warm Regards,
    Dinesh
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 7.  Re: FTP - Directory Listing

    Posted 10/10/10 07:26 PM

    Originally posted by: Malcolm.Cetera


    paul.brett wrote:
    {$content}

    Would you pls offer the related documentation? Could you give more detailed description? Thank you!
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 8.  Re: FTP - Directory Listing

    Posted 10/15/10 07:17 AM

    Originally posted by: paul.brett


    The example itself is pretty self explanatory, but here are some additional notes:

    • The config file contents:
    Server=brettp
    Path=/Temp/
    Username=anonymous
    Password=password
    Filespec=*.*

    • The Master.mmc map uses the RUN() function to call two sub maps:

    1. GetDir.mmc - Uses the deprecated FTP adapter to retrieve a directory listing from the FTP server, and returns that list.

    2. GetFiles.mmc - Takes the list from the previous sub map and processes each filename in turn in functional map F_EachFile. F_EachFile uses a RUN() function to call GetFile.mmc for each file in the list. F_EachFile then uses the PUT() function with the FILE adapter to place each retrieved file into a local file.

    2.1 GetFile.mmc - Uses the deprecated FTP adapter to retrieve the file from the FTP server.

    Let me know if I have not answered your specific questions.

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


  • 9.  Re: FTP - Directory Listing

    Posted 10/25/10 05:19 PM

    Originally posted by: jdavee


    Paul, the FTP example map is great to see, but I'm having problems with a needed enhancement. I don't want the FTP files to drop to the working dir of the maps but to a different dir.

    I'm still beating it up, but wondered if you had some insight on how to add this missing element to the map logic.

    Thanks,
    Jim
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 10.  Re: FTP - Directory Listing

    Posted 10/26/10 04:10 PM

    Originally posted by: paul.brett


    You would change the rule in the functional map F_EachFile from:

    =VALID(PUT("FILE",FileToGet,TextItem [1]:Out),FAIL(""))

    to

    =VALID(PUT("FILE","C:\HardCoded\Path\"+FileToGet,TextItem [1]:Out),FAIL(""))

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


  • 11.  Re: FTP - Directory Listing

    Posted 10/26/10 04:57 PM

    Originally posted by: jdavee


    I suspected that was the correct point, but I was getting inconsistent results. I'm probably moving too quickly on this - when I used a hard-coded value it seemed to be stable, but when I tried to introduce a variable it caused problems.

    Working backwards, if I added an input card to F_EachFile called Outdir, which is a new field in the Config.txt file (with modified tree), I should be able to change the output dir without having to rebuild the map.

    In a similar vein, is there anything besides the Resource Registry that would allow for changing the compiled map extension from .mmc to user-controlled? I don't think the config file would work in this case since it's called too late in the logic (or maybe I include it as an input and pull that field in each map that issues a run() command?). I'm building this for a Unix test bed and don't use .mmc file names.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender