filename - Filename_yyyymmdd.txt

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
newkid
Participant
Posts: 4
Joined: Sat May 01, 2004 12:40 am

filename - Filename_yyyymmdd.txt

Post by newkid »

Hi, I need to pass or get from system to create a filename
called "filename"_yyyymmdd.txt

However, I have problem passing in the paramter from jobs
and also triming the "-" or "/" based on the Oconv or Iconv.
Any extract(position,xxx) or Trim(xxx) function in DS.

I also have problem putting a leading zero fields on trailer record otherwise my first DS job is done.

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

Post by ray.wurlod »

You can use a job parameter set in a controlling job. The controlling job (or job sequence) would generate the file name, perhaps using a Routine, then set a parameter containing that file name that the real job could use. If you were writing your own controlling job, it would look something like this:

Code: Select all

TheFileName = "/usr/data/myfile" : Oconv(@DATE,"DYMD[4,2,2]":@VM:"MCN")

hJob1 = DSAttachJob("MyJob", DSJ.ERRNONE)
ErrCode = DSSetParam(hJob1, "FileName", TheFileName)
If Not(ErrCode Matches "'-'1N")
Then
   RunReqCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
   WaitCode = DSWaitForJob(hJob1)
   JobStatus = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
   Call DSLogInfo("Exit status of controlled job is " : JobStatus, "Control")
End
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
thirupri
Premium Member
Premium Member
Posts: 40
Joined: Wed Sep 17, 2003 3:41 am
Location: Saudi Arabia
Contact:

Post by thirupri »

Here is the another solution if you create the server job.

If you use the DataStage Seq File control in the File Path area you can specify like this “C:\Test\File_NAME#BUSDATE#.TXT”

Where BUSDATE is a Job Parameter with type String.

Regards,
Thiruma Valavan
Best Regards,
Thiruma Valavan
Post Reply