IBM Sterling Transformation Extender

Sterling Transformation Extender

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


#Sterling
#Supplychain
 View Only
Expand all | Collapse all

Resource Registry question

  • 1.  Resource Registry question

    Posted 02/16/05 10:58 AM

    Originally posted by: SystemAdmin


    Defined a resource, 'R1'. The resource value resolves fine when used as an input/output card and executed via event server or command server.

    But problem is trying to use it as a text value in a rule.... ie...

    This seems to work... put("file", "%R1%filename.txt", ....())

    Used as part of an email (for example)

    "Data moved to %R1%filename.txt"

    doesn't resolve.... the text body is produced exactly as shown.

    Any thoughts?
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 2.  Re: Resource Registry question

    Posted 02/16/05 01:53 PM

    Originally posted by: SystemAdmin


    Funny you should ask this question. I came out to post the very same question and saw your post. I guess I would further the question by asking anyone if they know how to resolve the variable for use in those functions you mentioned. Maybe it's an enhancement request to Ascential. Something like a new function such as VARRES for variable resolution would be nice.

    Another issue I have noticed in using the Resource Registry is paths that have spaces in their names.

    For example: \\some server\some share\some file.txt.

    The above value in your variable would cause your map not to function properly.

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


  • 3.  Re: Resource Registry question

    Posted 02/16/05 07:27 PM

    Originally posted by: SystemAdmin


    From the Resource Registry Reference Manual Chapter 1:

    A resource name is an alias that has different values defined for multiple
    deployment environments. A resource value can be either a command card setting for a map, an adapter command override setting for a map or system component, or an argument to environment functions within a map rule (RUN, PUT, GET, DBLOOKUP, DBQUERY, and EXIT). In addition, other resources that can be aliased include:

    • backup files
    • audit files and locations
    • trace files and locations
    • work space locations
    • external parser location (defined in the Type Designer)


    If you try to use a resource name in an output rule that is not covered by one of the above it will not map. For the email example, if this is part of a PUT to the email adapter it may just be the syntax of the command.

    Try something like PUT..... " -TEXT " + SYMBOL(39) + "Data moved to " + "%R1%" + "filename.txt" + SYMBOL(39)

    (Note: SYMBOL(39) = single quote)
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 4.  Re: Resource Registry question

    Posted 02/17/05 06:06 AM

    Originally posted by: SystemAdmin


    Thanks, looked through resource manual but missed that. It's also what I assumed. I have some options, to look at.
    So, what you are saying is Where %dblookup1% = "-mdq path\name.mdq -DN dnname" this should work? Cause I tried that the other day and it didn't work either.

    dblookup ("select ALTID where ID = MEMID", "%dblookup1%")
    mtlincol: Try using quotes around your paths containing spaces. Depending on how you get the path try something like....

    "\\some server\some share\some file.txt"

    or

    "'" + path:name + "'"
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 5.  Re: Resource Registry question

    Posted 02/18/05 05:50 AM

    Originally posted by: SystemAdmin


    I think I tried using quotes and that didn't work. I will try again though just to be sure. Your suggestion definitely makes sense though.

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


  • 6.  Re: Resource Registry question

    Posted 04/12/05 09:11 AM

    Originally posted by: SystemAdmin


    I discovered a way to use a Resource Registry value in a formula. It is not the most efficient use of resources, but it does work. I only use it in exception cases, or when I am handling errors. Not during normal processing. That said, it isn't that big a hit on performance if it is not done too much.

    i:4ee6761d16I should note that I have only done this on Windows, but I know it can be done on *nix. I'm not a *nix shell script guru.[/i:4ee6761d16]

    I created a batch file that does nothing but echo what it was passed. Here is the file:

    code:1:4ee6761d16@echo off
    if NOT "%1"=="" (
    echo %1
    )[/code:1:4ee6761d16]

    Then in my formula I use a GET function to resolve the Resouce Alias:

    code:1:4ee6761d16=get(
    "bat"
    ,"-cmd 'echothis.bat " + "%RESOURCE_ALIAS%" + "'"
    )[/code:1:4ee6761d16]

    What comes back will be the value in the Resource.

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


  • 7.  Re: Resource Registry question

    Posted 05/04/05 08:00 AM

    Originally posted by: SystemAdmin


    I finally got the documentation on the BAT & SHL resource adapters. I don't know what it is, but sometimes I just cannot get what they are trying to say. I finally figured out how do the ECHO cmd on both Windows & Unix the same way and get the value back without using a batch file. It still requires switching between the BAT adapter for Windows and the SHL adapter for UNIX, but I solved that with another Resource Registry value. Here's what I do:

    code:1:d4842282a5WORD(
    GET(
    "%SHELL_TYPE%"
    ,"-cmd 'echo %RESOURCE_ALIAS%" + "' -CLI "
    )
    ,"<NL>"
    ,1
    )[/code:1:d4842282a5]

    The "-CLI" after the command is what I couldn't understand from the documentation, but I get it now. It does come back with a trailing <NL> but that is easily removed via the WORD function. And the "%SHELL_TYPE%" RR alias picks the correct adapter "SHL" or "BAT" based on the system I am running on.

    Then I started thinking about how to use this method to get the values from the RR loaded into a file that could be used as input for maps, taking advantage of the WorkArea i:d4842282a5Reuse[/i:d4842282a5] option. However, I'm not as familiar with the IFD and don't know if my idea will work as expected. What I was thinking is having a map that would be triggered off a time event that would happen just once when the EventServer is started. It would build the file for other maps to use. Those maps would have the input card's WorkArea set to Reuse.

    Sounds like it might work, but I don't have the cycles to test it right now.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 8.  Re: Resource Registry question

    Posted 05/04/05 09:09 AM

    Originally posted by: SystemAdmin


    Easy alternate solution for functions or uses the RR does not support: use a lookup file. If the file does not change, you can set the work area to re-use and it will help performance slightly.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 9.  Re: Resource Registry question

    Posted 05/04/05 09:28 AM

    Originally posted by: SystemAdmin


    I understand what you are saying. We use both the RR and a lookup file that duplicates the entries in both. What drove me to wanting to use RR values in formulas was our first map was loading this lookup file along with others and if there was an input error with one of those files, we didn't know it and the trigger data file was deleted. Maybe it was the way we were set up, but I couldn't find any way to get notification when that map errored with an input validation problem. So we went to, what we called, a launcher map whose only input was the trigger data file and it called the other map that loaded the various lookup files. If there was an input validation problem and the map errored, the launcher map would email and log it.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 10.  Re: Resource Registry question

    Posted 05/05/05 03:17 AM

    Originally posted by: SystemAdmin


    If there was an input error, and the trigger file was deleted, this is either a bug or the trees for those other files were not designed properly. If you get a validation error and the trigger input is set to delete on success, if there is a validation error, that is a map failure and the input should not be deleted.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 11.  Re: Resource Registry question

    Posted 05/05/05 05:25 AM

    Originally posted by: SystemAdmin


    You're right about the delete, my apologies on that. I was mistaken. But I stand by the fact that we had no way of knowing that the map failed because of an input validation error. It would seem to me, a nice enhancement would be to augment the TX to provide an onMapError Target Action so that we could either put out a file, db action, email, etc.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 12.  Re: Resource Registry question

    Posted 05/05/05 05:43 AM

    Originally posted by: SystemAdmin


    quote:bf1ca0af26It would seem to me, a nice enhancement would be to augment the TX to provide an onMapError Target Action so that we could either put out a file, db action, email, etc.[/quote:bf1ca0af26]

    You do this by having a map to check the log file and if it has an error take the appropriate action - send email etc.
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 13.  Re: Resource Registry question

    Posted 05/05/05 05:48 AM

    Originally posted by: SystemAdmin


    Well, you already have that. sort of. You can turn on input backup, and unique audit logs. Have a map that reads the audit logs and based on the return code, sends out an e-mail, moves the original or backup file etc.
    I have seen several customers develop elaborate error handling systems with IBM WebSphere MQ. TX's -eqn and -refresh options. Basically if the incoming data fails a map, the audit log is parsed and depending on the error, it might resubmit the data (target not available) or if invalid send the data to another (validation) map that has input trace turned on, sends an e-mail or MQ messgae that the data is located on the error queue, the trace file is located in another place, etc.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 14.  Re: Resource Registry question

    Posted 05/05/05 05:54 AM

    Originally posted by: SystemAdmin


    But it would help if the format of the log file didn't change for each new version of the software.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender