Current date to Sequential file name

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
sujaoschin
Premium Member
Premium Member
Posts: 102
Joined: Tue Jan 31, 2006 4:13 am

Current date to Sequential file name

Post by sujaoschin »

I need to generate a file with filename of
MAXIMO_GLACCOUNT_23_20090130.dat

where MAXIMO_GLACCOUNT is a constant.
23- batch number
20090130-current system date when the file is generated( If I am generating the file tommorrow, it should be like
MAXIMO_GLACCOUNT_23_20090131.dat
.dat - constant


I have passed the below as parameters

parameter name Default Value
------------------- ---------------
OUTPUT_FILE MAXIMO_GLACCOUNT
BATCH_NUM 23

In the sequential file -> general tab--> I have given the path
#sct_eswm_mig.$PROJECT_PATH#/#sct_eswm_mig.$STAGE_DIR#/#OUTPUT_FILE#_#BATCH_NUM#.dat

For above, the result I got is MAXIMO_GLACCOUNT_23.dat

I don't know how to append the current system date to this file name and how and where to use the '$(date +"%Y%m%d") to get current system date.

Please advise.
Sujatha K
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Create an after-job subroutine call to ExecSH to execute a mv command to change #sct_eswm_mig.$PROJECT_PATH#/#sct_eswm_mig.$STAGE_DIR#/#OUTPUT_FILE#_#BATCH_NUM#.dat to #sct_eswm_mig.$PROJECT_PATH#/#sct_eswm_mig.$STAGE_DIR#/#OUTPUT_FILE#_#BATCH_NUM#_`date +%Y%m%d`.dat

Note the use of back-quotes to capture the output of the date command.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sujaoschin
Premium Member
Premium Member
Posts: 102
Joined: Tue Jan 31, 2006 4:13 am

Post by sujaoschin »

As mentioned by you, this problem got resolved when gave the command in Job Properties-Input value
mv #sct_eswm_mig.$PROJECT_PATH#/#sct_eswm_mig.$OUTPUT_DIR#/#OUTPUT_FILE#_#BATCH_NUM#.dat #sct_eswm_mig.$PROJECT_PATH#/#sct_eswm_mig.$OUTPUT_DIR#/#OUTPUT_FILE#_#BATCH_NUM#_`date +%Y%m%d`.dat

for the afterjob subroutine- ExecSH.

Thanks a lot, Ray.
Sujatha K
Post Reply