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.  reg filename validations

    Posted 08/01/08 03:48 PM

    Originally posted by: SystemAdmin


    Hi,
    I am working on a scenario where in I have got a control file (control.txt) whose contents are some filenames
    (say for eg file1.txt , file2.txt,file3.txt etc) .
    These text files are actually also present say in my map directory for example.

    Thus based on the control file contents , i want my map to validate whether these data files are actually available in the map directory.

    Any suggestions are welcome.

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


  • 2.  Re: reg filename validations

    Posted 08/01/08 04:03 PM

    Originally posted by: john.gibby


    This isn't too difficult, but I'll have to make some assumptions. For each filename in the control file, set up an output card to determine if the file exists in map directory, and if so, to read it in.

    Input Card# 1 text file w/ newline delim: Control_File (with 3 number of filenames)

    Output Card# 1 text file w/ newline delim: =VALID(GET("FILE",WORD(CONTROL_FILE,"<NL>",1)),"FileNotFound")

    Output Card# 2 text file w/ newline delim: =VALID(GET("FILE",WORD(CONTROL_FILE,"<NL>",2)),"FileNotFound")

    Output Card# 3 text file w/ newline delim: =VALID(GET("FILE",WORD(CONTROL_FILE,"<NL>",3)),"FileNotFound")

    If any of your output cards equal "FileNotFound", then the file does not exist in the map directory. However, the GET() function only reads in the file as a text object. It cannot be validated on-the-fly to some other type tree definition. Thus, you would have to pass those objects on to another map for the to be validated by their correct type trees. If all the files exist, run the map, otherwise handle accordingly.

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


  • 3.  Re: reg filename validations

    Posted 08/01/08 04:05 PM

    Originally posted by: john.gibby


    Sorry for the strike in the previous post, I used square brackets and it made them strike through.

    Input Card# {1 text file w/ newline delim}: Control_File (with 3 number of filenames)

    Output Card# 1 {text file w/ newline delim}: =VALID(GET("FILE",WORD(CONTROL_FILE,"<NL>",1)),"FileNotFound")

    Output Card# 2 {text file w/ newline delim}: =VALID(GET("FILE",WORD(CONTROL_FILE,"<NL>",2)),"FileNotFound")

    Output Card# 3 {text file w/ newline delim}: =VALID(GET("FILE",WORD(CONTROL_FILE,"<NL>",3)),"FileNotFound")
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 4.  Re: reg filename validations

    Posted 08/01/08 05:26 PM


  • 5.  Re: reg filename validations

    Posted 08/02/08 05:54 AM

    Originally posted by: janhess


    Or you could make it more generic by having an output card with an item that occurs S and use a functional map with the GET. Then you don't need to know how many input files you have.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 6.  Re: reg filename validations

    Posted 08/05/08 05:09 AM

    Originally posted by: janhess


    This might be a better solution as it does not load the file.
    In Windows use the rule

    =GET("BAT","-cli -cmd 'dir c:\dirlist.txt' /B") /*how to run a batch command in a rule

    If it finds the file it returns the file name. If the file is missing it returns nothing.
    For generic use substitute the hard coded file name with the input card file name.

    Or you could do this

    valid(GET("BAT","-cli -cmd 'dir c:\dirlist.txt /B'"),"missing")
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange