Derived parameters
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 1044
- Joined: Wed Sep 29, 2004 3:30 am
- Location: Nottingham, UK
- Contact:
Derived parameters
Can a value be derived from a parameter and used in, say, a Sequential File stage path?
For instance, if the user enters a SITE parameter of ABC, I want to use ASDF in the file name. If they enter DEF, I want to use QWER. There will be about a dozen site codes, each of which has an associated code that I need to use in the file name.
Does the user have to enter the matching pair of parameters, or can the second parameter be derived from the first?
If not, here comes a feature suggestion.
Also, are there any job parameters that are not prompted to the user? I just want to store a value in one place and re-use it, and not have it changable at run time.
For instance, if the user enters a SITE parameter of ABC, I want to use ASDF in the file name. If they enter DEF, I want to use QWER. There will be about a dozen site codes, each of which has an associated code that I need to use in the file name.
Does the user have to enter the matching pair of parameters, or can the second parameter be derived from the first?
If not, here comes a feature suggestion.
Also, are there any job parameters that are not prompted to the user? I just want to store a value in one place and re-use it, and not have it changable at run time.
Phil Hibbs | Capgemini
Technical Consultant
Technical Consultant
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
You can set / modify the parameter values in the job sequencer / batch from where the jobs are called.
Alternatively, you can try using the DSSetParam with the DSJ.ME job handle in the job control section. I assume you will start using the sequential file even before setting these parameters internally in job control.
Thirdly, you can have Unix links to file with know names. For e.g. assume Site1 has file called file100, you can link this file100 as File_For_Site1 and open the file called File_For_#SITE# in your job.
Alternatively, you can try using the DSSetParam with the DSJ.ME job handle in the job control section. I assume you will start using the sequential file even before setting these parameters internally in job control.
Thirdly, you can have Unix links to file with know names. For e.g. assume Site1 has file called file100, you can link this file100 as File_For_Site1 and open the file called File_For_#SITE# in your job.
Hi,
sequence job getting first prameter, pasing it to a routine activty that you'll write to do manipulations on the user's parameter, passing the return value to a job activity as a parameter which is used as the file's directory value.
IHTH,
sequence job getting first prameter, pasing it to a routine activty that you'll write to do manipulations on the user's parameter, passing the return value to a job activity as a parameter which is used as the file's directory value.
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
![Image](http://www.worldcommunitygrid.org/images/logo.gif)
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
![Image](http://www.worldcommunitygrid.org/images/logo.gif)
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
you can try using the DSSetParam with the DSJ.ME job handle in the job control section
This does not work. A running job is not permitted to change its own parameter values.
This does not work. A running job is not permitted to change its own parameter values.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Conversion from one parameter to another can be done, for example, in a Routine invoked from a Routine Activity in a Job Sequence. That Job Sequence can then start the job with the resolved values supplied as values for its parameters.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Charter Member
- Posts: 199
- Joined: Tue Jan 18, 2005 2:50 am
- Location: India
An Alternative method, without using Job sequence. Say You server jobname is JOBA. I will create another server job JOBB, with all the parameters, that you have defined for JOBA. JOBB wont be having any mappings/stages. In the Job Control of JOBB, i will write a piece of code, like:
SITE,DBName,DBUser,DBPassword,FileName are the parameter of JOBB
------------------------------------------------------------------------------
GetFilePath=''
If SITE='ABC' Then
GetFIlePath='ASDF'
End Else
If SITE='DEF' Then
GetFIlePath='QWER'
End Else
If SITE='' Then
Call DSLogFatal("Path Of the File Is not specified")
Abort
End
*Setup Fact, run it, wait for it to finish, and test for success
hJob1 = DSAttachJob("JOBA", DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: Fact", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob1, "DBName", DBName)
ErrCode = DSSetParam(hJob1, "DBUser", DBUser)
ErrCode = DSSetParam(hJob1, "DBPassword", DBPassword)
ErrCode = DSSetParam(hJob1, "FilePath", GetFilePath)
ErrCode = DSSetParam(hJob1, "FileName", FileName)
ErrCode = DSSetDisableProjectHandler(hJob1, @FALSE)
ErrCode = DSSetDisableJobHandler(hJob1, @FALSE)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: JOBA", "JobControl")
End
---------------------------------------------------------------------------------
You can add few more error handling in it.
SITE,DBName,DBUser,DBPassword,FileName are the parameter of JOBB
------------------------------------------------------------------------------
GetFilePath=''
If SITE='ABC' Then
GetFIlePath='ASDF'
End Else
If SITE='DEF' Then
GetFIlePath='QWER'
End Else
If SITE='' Then
Call DSLogFatal("Path Of the File Is not specified")
Abort
End
*Setup Fact, run it, wait for it to finish, and test for success
hJob1 = DSAttachJob("JOBA", DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: Fact", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob1, "DBName", DBName)
ErrCode = DSSetParam(hJob1, "DBUser", DBUser)
ErrCode = DSSetParam(hJob1, "DBPassword", DBPassword)
ErrCode = DSSetParam(hJob1, "FilePath", GetFilePath)
ErrCode = DSSetParam(hJob1, "FileName", FileName)
ErrCode = DSSetDisableProjectHandler(hJob1, @FALSE)
ErrCode = DSSetDisableJobHandler(hJob1, @FALSE)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: JOBA", "JobControl")
End
---------------------------------------------------------------------------------
You can add few more error handling in it.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Your JobB is a job sequence lovingly hand-crafted. :D
You've created job control code. All a Job Sequence is is a graphical user interface to doing exactly the same. Obviously hand-coding allows for maximum flexibility and flair, while using a Job Sequence allows for maximum ease of use, particularly for those unfamiliar with the programming language.
You've created job control code. All a Job Sequence is is a graphical user interface to doing exactly the same. Obviously hand-coding allows for maximum flexibility and flair, while using a Job Sequence allows for maximum ease of use, particularly for those unfamiliar with the programming language.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Charter Member
- Posts: 199
- Joined: Tue Jan 18, 2005 2:50 am
- Location: India
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If you create a Job Sequence and compile it successfully, you can view the generated code on the Job Properties window Job Control tab.
It's a bit daunting because of all the name re-mappings and computer-generated variable names, but can be edifying nonetheless.
It's a bit daunting because of all the name re-mappings and computer-generated variable names, but can be edifying nonetheless.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Charter Member
- Posts: 199
- Joined: Tue Jan 18, 2005 2:50 am
- Location: India
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
A lot of the lines are comments, or declarations. There are relatively few lines of actual processing code, unless you have lots of job parameters (the job sequence actually checks to see that they were actually set, a common deficiency in human-written code).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.