Page 1 of 1

Current date to Sequential file name

Posted: Thu Jan 29, 2009 5:06 pm
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.

Posted: Thu Jan 29, 2009 5:38 pm
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.

Posted: Thu Jan 29, 2009 6:01 pm
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.