Assign value to a variable in a parameter file

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
gopskrish
Participant
Posts: 37
Joined: Thu Mar 31, 2005 7:42 am

Assign value to a variable in a parameter file

Post by gopskrish »

Hi DS users,

I want to get max value from my last run sequential file for a field and i would like to assign the same to a variable in a parameter file so that when i run the job the nexttime, i will use that value in the source query where clause

eg) where batch_id > #batchid#
Assume i have loaded batchid 1,2,3 and nexttime when i run the job it should pick up 3 and i will extract records >3.

If any Datastage and Unix gurus are there let me know how to assign the same to a variable in a parameter file and use the same.

(The operating system is UNIX)

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

Post by Sainath.Srinivasan »

There are many ways.... all depend on the nature of your output file and the way you extract fresh rows.

One way is to do a 'sort -r | head -1' to obtain the max value row. You may need to add extra option to sort and cut the date portion from the result.
gopskrish
Participant
Posts: 37
Joined: Thu Mar 31, 2005 7:42 am

Post by gopskrish »

Hi Sainath,

Thanks a lot.
If there are other ways of doing let me know.
I mean without parameter file and all.
I tried aggregator in parallel and I feel aggregator in parallel is very much confusing.
Let me know the other ways too.

Thanks for your info.

cheers,
gops
gopskrish
Participant
Posts: 37
Joined: Thu Mar 31, 2005 7:42 am

Post by gopskrish »

Sainath,

How to assign the output to a variable in a parameter file.
a= sort -r testfile |head -1
it is throwing the error.
I want to use the output in a parameter file.

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

Post by Sainath.Srinivasan »

Can you explain the following
1.) how is the date stored in your target file
2.) where did you include the mentioned command
3.) what error message did it return
4.) what do you mean by 'How to assign the output to a variable in a parameter file.'? Do you want to store the result as 'MaxDate = 20050513' in some parameter file? If yes, then what will this parameter file contain apart from this date?
Post Reply