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.  parsing a filename

    Posted 10/03/05 10:27 AM

    Originally posted by: SystemAdmin


    Hello,
    I'm trying to parse a filename.

    if the filename is:
    parta_partb_partc_partd.csv and I want to parse it and come up with everything to the right of the first underscore, how do I do that.

    The word function, seems to only allow one argument for the "field".

    word(in1, "_",2) would get my part_b
    word(in1) "_",3) would get me part_c
    etc...

    but I want, partb_partc_partd.csv.

    Thanks in advance.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 2.  Re: parsing a filename

    Posted 10/03/05 10:51 AM

    Originally posted by: SystemAdmin


    I would do the following:

    code:1:f6476687c6=RIGHT(
    In1
    ,SIZE(In1) - SIZE(WORD(In1,"_",1)) - 1
    )[/code:1:f6476687c6]
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 3.  Re: parsing a filename

    Posted 10/03/05 11:29 AM

    Originally posted by: SystemAdmin


    Thank you John, That worked. I appreciate that.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 4.  Re: parsing a filename

    Posted 10/03/05 12:06 PM

    Originally posted by: SystemAdmin


    Glad to help.

    The only caveat to that solution is the assumption that there is at least one underscore in the filename. Otherwise, you would end up with something like "arta_partb_partc_partd.csv". If that isn't the case, then you might want to test for it first.

    John M Gibby
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 5.  Re: parsing a filename

    Posted 10/03/05 12:32 PM

    Originally posted by: SystemAdmin


    You could also try:

    = TRIMLEFT(filename, WORD(filename, "", 1) + "")
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 6.  Re: parsing a filename

    Posted 10/03/05 12:35 PM

    Originally posted by: SystemAdmin


    Kudos Jennifer. A much more intelligient solution. It doesn't require there to be an underscore.

    I like it...I just wish I had thought of it.

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