Parameters from File Routine. Password Encrytion Issues

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
NEO
Premium Member
Premium Member
Posts: 163
Joined: Mon Mar 22, 2004 5:49 pm

Parameters from File Routine. Password Encrytion Issues

Post by NEO »

Hi all,

I have been using this routine to set parameters from a file. This was passed along from another team (Apparently given to them by Ascential itself). I have seen a strikingly similar routine at this post

viewtopic.php?t=89625&start=0&postdays= ... tagecom%2A

so am assuming this person works for Ascential. As the above post shows, the routine uses run time variables , reads from RT_STATUS file and writes parameter values back to the same file.

But I am facing problems with Encrypted parameters(Passwords) when routine used in a job sequencer. I have about 10 parameters, 5 of which I would like to set from a file. These are empty in my Parameters box. the rest of the 5 are DSN Names, User names and Passwords (encrypted) which are the default values. These parameters are passed down to the jobs in the sequencer. I have a job sequencer which calls this routine and jobs after the routine stage. At this point the routine sets the parameters from file, but the encrypted version of the password(The default value) goes into the jobs in the sequencer. If I dont use the routine, DataStage obviously decrypts the password and sends the actual password to the Jobs. What would be the work around to use this routine and still have the right password go into the jobs instead of the encrypted string?
Thanks.
NEO
Premium Member
Premium Member
Posts: 163
Joined: Mon Mar 22, 2004 5:49 pm

Post by NEO »

Just a follow up to the above message. Somehow the Sequencer job doesnt seem to be decrypting the Password before sending it to the underlying job. Could be that decryption happens before the job starts. So a routine called after the job starts to change parameters, the encrypted parameters dont get decrypted. I could be wrong, but my thoughts on it. If thats the case is there a work around ?
One I can think of is to call this routine in a before job routine at the server job level rather than at the sequencer level. That seems to be working for me. That means the decryption takes place somewhere between the Before job routine and the start of the job.
Thanks.
yannish
Charter Member
Charter Member
Posts: 23
Joined: Mon Dec 29, 2003 7:38 am
Location: Finland, Northern Europe

Post by yannish »

Hi NEO,

I came across the same problem recently and I found out that routines just pass the parameter values as they are. I found two ways to get around that:
1. Use encrypted string as input to the routine. This can be found for example from the Director log or when scheduling a job. I.e. if you set encrypted parameter value using already encrypted value (like @ADVU1 or something like that) it works.
2. Another way around is to use job control code instead of routine. This passes also encrypted parameters through as they should be passed.

I hope this helps,

Janne
NEO
Premium Member
Premium Member
Posts: 163
Joined: Mon Mar 22, 2004 5:49 pm

Post by NEO »

yannish wrote:Hi NEO,

I came across the same problem recently and I found out that routines just pass the parameter values as they are. I found two ways to get around that:
1. Use encrypted string as input to the routine. This can be found for example from the Director log or when scheduling a job. I.e. if you set encrypted parameter value using already encrypted value (like @ADVU1 or something like that) it works.
2. Another way around is to use job control code instead of routine. This passes also encrypted parameters through as they should be passed.

I hope this helps,

Janne
Hi Janne, I understand what you are saying. But we would Ideally like to have the same Before Job routine modified to be able to handle encrypted parameters when passed to underlying jobs. This routine has been deployed across projects with various functionality. I am looking at making a fix in the routine so that it does what its been doing, but also takes care of Encrypted Parameters. I was curious if thats possible. Like I said a work around would be to call the routine at the server job level rather than sequncer job level. If someone can explain the code in the above link, it would be more clear.
Thanks,
neo
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Post by ogmios »

If you want to do it like that you would have to encrypt passwords which is currently not an official API in DataStage, so if you would write something like that it may break on next releases.

Personally I still like the old BASIC own written control jobs.

Ogmios
In theory there's no difference between theory and practice. In practice there is.
NEO
Premium Member
Premium Member
Posts: 163
Joined: Mon Mar 22, 2004 5:49 pm

Post by NEO »

I could finally solve the problem , but still have some doubts though.
The routine I was using had code something in this fashion.

Code: Select all

STAGECOM.JOB.STATUS<JOB.PARAM.VALUES> = ParamValues
This was setting all the parameter values including the encrypted values something like a string.

I changed my code to something like this

Code: Select all

STAGECOM.JOB.STATUS<JOB.PARAM.VALUES,JobParamPos> = ParamValue<JobParamPos>
Here I am just setting the values of parameters to the variable, that are in the file. So all passwords etc, that are set as default will not be re written back to the variable. Only the values that are in the file will be set. This seems to work. Hope that helps anyone who has the same problem. But I am still not satisfied why this is happening though.
Thanks.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I have seen a strikingly similar routine at this post
I checked this out and Peter Lai wrote these routines. If Ascential is giving out routines written by Peter then they should give him credit.

I am not sure what you are looking at but the parameter name is stored in

STAGECOM.JOB.CONFIG<CONTAINER.PARAM.NAMES>

Once you located the parameter name then you set it in

STAGECOM.JOB.STATUS<JOB.PARAM.VALUES,JobParamPos>

They should at least give you code the works.

So in this means that

STAGECOM.JOB.CONFIG<CONTAINER.PARAM.NAMES,JobParamPos>

should equal the parameter name being set. These are all multivalued fields and not easily understood. I really do not know how to explain them on this site. It is much easier in person to explain multivalues.
Mamu Kim
Post Reply