how to generate a dynamic file name
Moderators: chulett, rschirm, roy
how to generate a dynamic file name
Hi,
I want to create a file name during run time. There is the DSJobStartDate macro, but probably I not used it correctly. How can I use it?.
I am writing this one in the Sequential file stage:
File Name: /var/opt/aat/p/sl/shr/carga_fz_SLDIOMQ:'_':DSJobStartDate
but the file name result is carga_fz_SLDIOMQ:'_':DSJobStartDate and not carga_fx_SLDIOMQ_2003_09_03.
Thanks,
Angel
I want to create a file name during run time. There is the DSJobStartDate macro, but probably I not used it correctly. How can I use it?.
I am writing this one in the Sequential file stage:
File Name: /var/opt/aat/p/sl/shr/carga_fz_SLDIOMQ:'_':DSJobStartDate
but the file name result is carga_fz_SLDIOMQ:'_':DSJobStartDate and not carga_fx_SLDIOMQ_2003_09_03.
Thanks,
Angel
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The syntax looks OK, provided that the references to job parameters or macros are properly spelled and cased.
The parameter type can be String or Pathname. I'd recommend Pathname, because (a) you can then locate the text file anywhere in the file system, and (b) the operator gets a browser when being prompted for the file name.
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
The parameter type can be String or Pathname. I'd recommend Pathname, because (a) you can then locate the text file anywhere in the file system, and (b) the operator gets a browser when being prompted for the file name.
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
I have done it using Pathname and the problem still persists.
the filename that is being generated is:
TestDate_#DSJobStartDate#_#DSJobStartTime#.txt
the macros are not being evaluated into values, and also i am not enclosing the above in any quotes.
Can Ray.Wurlod or ariear comment on this, please ?
thanks
the filename that is being generated is:
TestDate_#DSJobStartDate#_#DSJobStartTime#.txt
the macros are not being evaluated into values, and also i am not enclosing the above in any quotes.
Can Ray.Wurlod or ariear comment on this, please ?
thanks
I don't know if there will be any other comments that you can use, but using the DSJobStartDate encompassed by '#' in the filename works perfectly on a 5.1 installation running on W2K.
Unfortunately you cannot browse the file from the Designer afterwards but you can from the explorer.
B. Sorensen,
Optico IT ApS
Unfortunately you cannot browse the file from the Designer afterwards but you can from the explorer.
B. Sorensen,
Optico IT ApS
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
In general, no. The Sequential File stage works with files. However, if you need to create a directory you can set up ExecSH (or ExecDOS on a Windows platform) as a before-stage subroutine with an appropriate mkdir command in the InputArg field. You can use job parameters and macros here too.
You might want to include a test for existence before trying to mkdir because, if ExecSH fails, the job aborts. For example:[-d #pathname#] !! mkdir #pathname# && chmod 664 #pathname#
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
You might want to include a test for existence before trying to mkdir because, if ExecSH fails, the job aborts. For example:[-d #pathname#] !! mkdir #pathname# && chmod 664 #pathname#
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518