Store User Names, Passwords, DataSource Names

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post 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...
Attitude is everything....
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post 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..
Attitude is everything....
tonystark622
Premium Member
Premium Member
Posts: 483
Joined: Thu Jun 12, 2003 4:47 pm
Location: St. Louis, Missouri USA

Post 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
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post by just4geeks »

Thanks Tony....
Attitude is everything....
Post Reply