Command Line arguments for a Command Stage

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

Post Reply
mickboland
Participant
Posts: 27
Joined: Sun Mar 20, 2005 4:23 am
Location: Brisbane, Australia

Command Line arguments for a Command Stage

Post by mickboland »

I have a command stage with an input of a seq file.

My question:
I know how to use job parameters in the command line (#PARAM#), but how do i use the row values from the input seq file as a value in the command line?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hello Mick,

I think that if you have a sequential file with a column such as "MyParamValue" then you could use a Transform stage with a before or after stage routine call to which you can pass the value of the column, then from the routine use DSAttach and DSCallJob to pass this on to another job.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

Consider using the new Set Variables stage in your sequence job to retrieve your parameters from the file. Write a routine that opens a file and retrieves a named parameter. Call this routine from your Variables stage for each parameter you need to retrieve. Insert these Variables into your Command stage with the syntax VariablesStageName.VariableName.

With version 7.5 you can retrieve parameters from files from within a Job Activity stage or a Variables stage.[/i]
mickboland
Participant
Posts: 27
Joined: Sun Mar 20, 2005 4:23 am
Location: Brisbane, Australia

Post by mickboland »

Sorry, I am new to DS (2 weeks). So i must admit this is all 'gobeldy-gook' to me.

is the Variables stage the User Variables Activity? I do not have a Variable Stage in my DSJob pallette!

Any chance of stating all the items I would need and their joins - I can work on the detail!!!

Do I need?:
1. start loop activity
2. set variable from a routine??
3. 'Execute Command stage' using the variable from variable stage??
4. end loop activity



****************
Consider using the new Set Variables stage in your sequence job to retrieve your parameters from the file. Write a routine that opens a file and retrieves a named parameter. Call this routine from your Variables stage for each parameter you need to retrieve. Insert these Variables into your Command stage with the syntax VariablesStageName.VariableName .

With version 7.5 you can retrieve parameters from files from within a Job
Activity stage or a Variables stage.[/i]
mickboland
Participant
Posts: 27
Joined: Sun Mar 20, 2005 4:23 am
Location: Brisbane, Australia

Post by mickboland »

My last post was a little unclear:

What I want to do is:

1. Populate a text file with some values (eg: List of all the projects on the server
#PROG_DIR#\DsJob.exe -server #HOST# -user #UID# -password #PWD# -lprojects > #EXPORT_DIR#\PL.txt
)

2. Loop through each of the values in the text file and call a command (eg: for each project on the server - create file with a list of job in each project
#PROG_DIR#\DsJob.exe -server #HOST# -user #UID# -password #PWD# -ljobs #Project# > #EXPORT_DIR#\#Project#\JL.txt
)

3. Open each file with the job list in it and export the bitmaps for each job into a separate directory using cmd DsDesign.exe /H=#HOST# /U=#UID# /P=#PWD# /SaveAsBmp=#EXPORT_DIR#\#Job#\#Job#_bmp.bmp #Project# #Job#

Can anyone give me guidance on the bast way to achive this using DS stages and not Basic?
davidnemirovsky
Participant
Posts: 85
Joined: Fri Jun 04, 2004 2:30 am
Location: Melbourne, Australia
Contact:

Post by davidnemirovsky »

Welcome aboard!

I think what you are trying to do is export some information about your existing jobs in a certain project?

If so, <a href="http://www.kennethbland.com">Kenneth Bland</a> has some great utilities for this. No point re-inventing the wheel. Register on his site and have a look around. Even if it's not what you need since you do not have a lot of experience in Datastage it might give you some insight as to how to extract the information that you need.
Cheers,
Dave Nemirovsky
mickboland
Participant
Posts: 27
Joined: Sun Mar 20, 2005 4:23 am
Location: Brisbane, Australia

Post by mickboland »

Yes that is correct - and - i have looked at KB's site.

The question is more is more conceptual/arcitectural. This specific example is covered at KB's site, but, the requirements i have detailed will be needed for other applications.

KB has hidden all the code for the utilities he has written?!
davidnemirovsky
Participant
Posts: 85
Joined: Fri Jun 04, 2004 2:30 am
Location: Melbourne, Australia
Contact:

Post by davidnemirovsky »

Wouldn't you hide the code? No good giving away your hard earned experience to just anybody.

Back to your conceptual question:

I am almost certain that points 1 & 2 can be designed through a datastage job.

1) This job might look like this:

Code: Select all

 UV stage --> Xfer --> Seq 
In the UV stage you will need to figure out the UV SQL statement that will retrieve list of projects.

2) This job might look like this:

Code: Select all

 Seq --> Xfer --> Seq 
Inside this transformer you will need to write a routine that accepts a 'Project' name and returns a delimited list of jobs. These jobs will be listed in the 2nd Seq file (job name file).

3) I think you should be able to write another routine that accepts a valid Job name and a path and then outputs the BMP to that path.
Cheers,
Dave Nemirovsky
JeanPierreHaddad
Participant
Posts: 18
Joined: Mon Nov 25, 2002 3:23 am
Location: Switzerland

Post by JeanPierreHaddad »

Hello

Did you consider using the Environment Variables? There is a file called DSParams in each project. The DS Administrator defines user variables available to each job in the project. Variables will typically have the same names but different values depending on the project. Dynamic retrieval of the environment variable is done through a routine. (in version 7 GetEnvironment(variablename) ).


mickboland wrote:My last post was a little unclear:

What I want to do is:

1. Populate a text file with some values (eg: List of all the projects on the server
#PROG_DIR#\DsJob.exe -server #HOST# -user #UID# -password #PWD# -lprojects > #EXPORT_DIR#\PL.txt
)

2. Loop through each of the values in the text file and call a command (eg: for each project on the server - create file with a list of job in each project
#PROG_DIR#\DsJob.exe -server #HOST# -user #UID# -password #PWD# -ljobs #Project# > #EXPORT_DIR#\#Project#\JL.txt
)

3. Open each file with the job list in it and export the bitmaps for each job into a separate directory using cmd DsDesign.exe /H=#HOST# /U=#UID# /P=#PWD# /SaveAsBmp=#EXPORT_DIR#\#Job#\#Job#_bmp.bmp #Project# #Job#

Can anyone give me guidance on the bast way to achive this using DS stages and not Basic?
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

On 3. you can download DSaveAsBmp.bat on my tips page. It will run the command on every job in a project. It is a DOS batch file. It runs dsjob to get a list of jobs then runs the Designer.exe on each job in the project. Saves lots of time. This files can be used by the GenHtml jobs also on my tips page to generate a html document on each job. It runs JobReport on each job.
Mamu Kim
mkiru23
Premium Member
Premium Member
Posts: 33
Joined: Thu Nov 20, 2003 4:33 pm
Location: SFL

need some more idea on Routine in PX

Post by mkiru23 »

I was looking to solve same kind of situation....

I need more specific information on the (write a routine) is that a UNIX or DS routine...
Plz tell me more about that routine.. that will is helpful..

My question is to get the receipts mailids from a flat file to notification activity.

ENV:7.5.1 in PX

Thanks in adv



vmcburney wrote:Consider using the new Set Variables stage in your sequence job to retrieve your parameters from the file. Write a routine that opens a file and retrieves a named parameter. Call this routine from your Variables stage for each parameter you need to retrieve. Insert these Variables into your Command stage with the syntax VariablesStageName.VariableName.

With version 7.5 you can retrieve parameters from files from within a Job Activity stage or a Variables stage.[/i]
Post Reply