Page 2 of 2

Posted: Fri Feb 09, 2007 12:28 pm
by chulett
just4geeks wrote:
chulett wrote:No. What Tony described is one of the many things Sequence jobs bring to the table - automation of parameter assigned being one such.

What are you using for 'job control'? You'll need to find a methodology that is compatible with that.
If I get what you mean my job control...then I run the jobs using a UNIX script.
Yes, that's what I mean. So, unless you are willing to totally re-engineer your process then $PROJDEF will be a good option for you. Well, except for the fact that every job's associated parameter values default would need to change. :wink:

Export, edit, import could handle that.

Posted: Fri Feb 09, 2007 12:31 pm
by just4geeks
chulett wrote:
just4geeks wrote:
chulett wrote:No. What Tony described is one of the many things Sequence jobs bring to the table - automation of parameter assigned being one such.

What are you using for 'job control'? You'll need to find a methodology that is compatible with that.
If I get what you mean my job control...then I run the jobs using a UNIX script.
Yes, that's what I mean. So, unless you are willing to totally re-engineer your process then $PROJDEF will be a good option for you. Well, except for the fact that every job's associated parameter values default would need to change. :wink:

Export, edit, import could handle that.
Could you please elaborate on "every job's associated parameter values default would need to change"?

If I switch from PROJDEF to Tony's method, why would the default values need to change?

Thanks chulett...

Posted: Fri Feb 09, 2007 12:34 pm
by chulett
No, I meant that was something you would have to do if you took the $PROJDEF route. For a Sequence job solution, your jobs would be unchanged but your entire job control methodology would need to be rewritten.

Posted: Fri Feb 09, 2007 12:36 pm
by just4geeks
chulett wrote:No, I meant that was something you would have to do if you took the $PROJDEF route. For a Sequence job solution, your jobs would be unchanged but your entire job control methodology would need to be rewritten.
I get it now....thanks chulett..

Posted: Fri Feb 09, 2007 1:15 pm
by tonystark622
Here you go...

There are probably "better" ways to do this, but this is how I did it :)

Parameters are listed under Arguments: in the header comments.

Code: Select all

********************************************************************************
*
* Name:      GetParameterFromFile
* 
* Arguments: ConfigFileName   - The path and filename of the config file
*            ParamName        - The parameter within the file to retrieve
*
* Expects file with the contents in the form: ParamName=ParamValue
*
* Open file passed in 'ConfigFileName'. Read until finding the line
* where ParamName equals the 'ParamName' argument value passed in.
* Return the ParamValue found.
*
* If the 'ParamName' value passed in was not found in the file
* return @Null
********************************************************************************
Equate TransformName To "GetParameterFromFile"


   * Trim input args and assign to local vars
   ConfigFile = Trim(ConfigFileName, ' ', 'B')
   ParameterName = Trim(ParamName, ' ', 'B')
      

   ParamFound = @False

   * Try to open the file...
   OpenSeq ConfigFile To ConfigFileVar
   On Error
      Msg = 'Error opening parameters file, ' : SQuote(ConfigFile): ', status = ' : Status()
      Call DSLogFatal(Msg, TransformName )
      Abort
   End
   Else
      Msg = 'Cannot open parameters file, ' : SQuote(ConfigFile): ', status = ' : Status() : ' for Parameter ' : SQuote(ParameterName)
      Call DSLogFatal(Msg, TransformName )
      Abort
   End

   * We have successfully opened the file
   * Now read the parameter list from the file.
   If FileInfo(ConfigFileVar, 0)
   Then
      Loop
      While ReadSeq Line From ConfigFileVar
         ParName = Trim(Field(Line,"=",1,1))
         ParamValue = Trim(Field(Line,"=",2,1))

         If UpCase(ParName) = UpCase(ParameterName) Then
            ParamFound = @True
            Exit
         End
         
      Repeat
      CloseSeq ConfigFileVar
   End

   If ParamFound Then
      Ans = ParamValue
   End Else
      Ans = @Null
      Msg = 'Cannot find parameter ' : SQuote(ParamName): ', status = ' : Status()
      Call DSLogFatal(Msg, TransformName )


   End

Posted: Fri Feb 09, 2007 2:17 pm
by just4geeks
Thanks Tony....