pass a parametersthrough file

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

dr.murthy
Participant
Posts: 224
Joined: Sun Dec 07, 2008 8:47 am
Location: delhi

pass a parametersthrough file

Post by dr.murthy »

Hi,

in job sequence while running 100 jobs together, one way to give default value in parameter ok.....

the other way??????????????

is there any way like....................

enter all the parameter and its value that we using in the project written in a txt file

then call the txt file in the job seq......

when ever the parameter occur in J.Seq then the vaue of the parameter is taken from the file

is there any way in this format....

and how to implement this logic....

ie how to call the txt file in job seq..
D.N .MURTHY
hamzaqk
Participant
Posts: 249
Joined: Tue Apr 17, 2007 5:50 am
Location: islamabad

Post by hamzaqk »

yup. write the name of all the jobs in a delimited text file and use the command stage to read the text file and then loop through it and pass the values to the job.
Teradata Certified Master V2R5
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Upgrade to version 8 and use a parameter set, which includes the ability to read parameter values from file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dr.murthy
Participant
Posts: 224
Joined: Sun Dec 07, 2008 8:47 am
Location: delhi

Post by dr.murthy »

Thanks for responding,

but iam using ver:7.5.1(A) is there any possibility in this version to read the parametere values through a text file.
D.N .MURTHY
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Of course, but you'll need to write your own 'job control' for this. Read the list of parameters into memory, interogate the job for the parameters it needs and set any you have that match.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dr.murthy
Participant
Posts: 224
Joined: Sun Dec 07, 2008 8:47 am
Location: delhi

Post by dr.murthy »

could you please let me know briefly how to write job controls.
D.N .MURTHY
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

1. Learn DataStage BASIC programming language.
2. Create new server job, open job properties, enter job control code on Job Control tab. Save and compile.

Easy.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
saikir
Participant
Posts: 92
Joined: Wed Nov 08, 2006 12:25 am
Location: Minneapolis
Contact:

Post by saikir »

Hi,

I hope the code below can help you.

Reading Parameters from a Parameter File

The Below mentioned code illustrates how to read the following parameters from a parameter hashed file and log information about the directory paths in the log:

- DIM_DSN
- DIM_UID
- DIM_PWD
- STG_DSN
- STG_UID
- STG_PWD
- EDW_DSN
- EDW_UID
- EDW_PWD

Code:

OPEN "STG_Parameters_Hash_File" TO PARAMFILE
ELSE
Call DSLogFatal("Job Failed: Unable To Open Hashed File", "JobControl")
END

READ PARAMREC FROM PARAMFILE , "DIM_DSN"
ELSE
Call DSLogFatal("Job Failed: Unable To read Record From Hashed File", "JobControl")
END
DIM_DSN = PARAMREC<1>

READ PARAMREC FROM PARAMFILE , "DIM_UID"
ELSE
Call DSLogFatal("Job Failed: Unable To read Record From Hashed File", "JobControl")
END
DIM_UID = PARAMREC<1>

READ PARAMREC FROM PARAMFILE , "DIM_PWD"
ELSE
Call DSLogFatal("Job Failed: Unable To read Record From Hashed File", "JobControl")
END
DIM_PWD = PARAMREC<1>

READ PARAMREC FROM PARAMFILE , "STG_DSN"
ELSE
Call DSLogFatal("Job Failed: Unable To read Record From Hashed File", "JobControl")
END
STG_DSN = PARAMREC<1>

READ PARAMREC FROM PARAMFILE , "STG_UID"
ELSE
Call DSLogFatal("Job Failed: Unable To read Record From Hashed File", "JobControl")
END
STG_UID = PARAMREC<1>

READ PARAMREC FROM PARAMFILE , "STG_PWD"
ELSE
Call DSLogFatal("Job Failed: Unable To read Record From Hashed File", "JobControl")
END
STG_PWD = PARAMREC<1>

READ PARAMREC FROM PARAMFILE , "EDW_DSN"
ELSE
Call DSLogFatal("Job Failed: Unable To read Record From Hashed File", "JobControl")
END
EDW_DSN = PARAMREC<1>

READ PARAMREC FROM PARAMFILE , "EDW_UID"
ELSE
Call DSLogFatal ("Job Failed: Unable To read Record from Hashed File", "JobControl")
END
EDW_UID = PARAMREC<1>

READ PARAMREC FROM PARAMFILE , "EDW_PWD"
ELSE
Call DSLogFatal("Job Failed: Unable To read Record From Hashed File", "JobControl")
END
EDW_PWD = PARAMREC<1>

READ PARAMREC FROM PARAMFILE , "ROOT_DIR"
ELSE
Call DSLogFatal("Job Failed: Unable To read Record From Hashed File", "JobControl")
END
ROOTDIR = PARAMREC<1>

CLOSE PARAMFILE


-- Assigning Values to Directories

InputDirectory = ROOTDIR: "\Input\PrimarySales\"
InProcessDirectory = ROOTDIR: "\Inprocess\PrimarySales\"
ErrorDirectory = ROOTDIR: "\Error\PrimarySales\"
ReProcessDirectory = ROOTDIR: "\Reprocess\PrimarySales\"
ProcessedDirectory = ROOTDIR: "\Processed\PrimarySales\"
ControlFilesDirectory = ROOTDIR: "\ControlFiles\PrimarySales\"

-- Logging the Directory Path

Call DSLogInfo("Input Dir: ": InputDirectory,"JobParameter")

Call DSLogInfo("Inprocess Dir: ": InProcessDirectory,"JobParameter")

Call DSLogInfo("Error Dir: ": ErrorDirectory,"JobParameter")

Call DSLogInfo("ReProcess Dir: ": ReProcessDirectory,"JobParameter")

Call DSLogInfo("Processed Dir: ": ProcessedDirectory,"JobParameter")
Call DSLogInfo("ControlFiles Dir: ": ControlFilesDirectory,"JobParameter")

Note: You need to write parameters to a hashed file before you start this excercise.

Sai
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Or use dsjob to get list of parameters and fetch their values from db table (holding the values). The job run string call be prepared in shell and initiated.

All outside DS Basic.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Or use dsjob to get list of parameters and fetch their values from db table (holding the values). The job run string call be prepared in shell and initiated.

All outside DS Basic.
dr.murthy
Participant
Posts: 224
Joined: Sun Dec 07, 2008 8:47 am
Location: delhi

Post by dr.murthy »

[quote="Sainath.Srinivasan"]Or use dsjob to get list of parameters and fetch their values from db table (holding the values). The job run string call be prepared in shell and initiated.

hi srinivasan,

i did n't understand,could you explain me briefly.
D.N .MURTHY
ravij
Premium Member
Premium Member
Posts: 170
Joined: Mon Oct 10, 2005 7:04 am
Location: India

Post by ravij »

Hi saikir,
The Below mentioned code illustrates how to read the following parameters from a parameter hashed file and log information about the directory paths in the log:
I have written the query given by you in Job control and added one job in the same job control of batchjob at the end of the code.

And I created one hashed file with the parameters. When I run the Batch job, it is giving the error like,
"BATCH_CALL_PARAMS_FROM_HASH..JobControl (fatal error from JobControl): Job Failed: Unable To Open Hashed File"

Can you please give some brief description about the code. How to use it and how to call the hashed file into the job control and how to pass these parameters to a job?

Thanks in advance.
Ravi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Do you have a hashed file called STG_Parameters_Hash_File?

Do you have a VOC pointer to it?

You will need both for the OPEN statement to work.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
tonystark622
Premium Member
Premium Member
Posts: 483
Joined: Thu Jun 12, 2003 4:47 pm
Location: St. Louis, Missouri USA

Post by tonystark622 »

Enter GetParameterFromFile into the search. I think it's the 2nd item returned. Here's a linkviewtopic.php?t=107451&highlight=GetParameterFromFile

This addresses one method to pass Job Parameters through a flat file.

Another way is, of course, to upgrade to v8 :D

Good Luck,
Tony
ravij
Premium Member
Premium Member
Posts: 170
Joined: Mon Oct 10, 2005 7:04 am
Location: India

Post by ravij »

Hi Ray,

Thanks for your reply.

I already created a hashed file STG_Parameters_Hash_File with all the reqired parameters, but

I don't understand the other thing you have mentioned that we need to have a VOC pointer to it.

Can you please tell me how to get or define that VOC ponter?

Thanks in advance

Tony,

Thanks for your reply, and I will go through your comments and let you know the result.
Ravi
Post Reply