Hi All,
This topic might have been discussed previously, but i didn't get them.
please have a look and provide your suggestion.
My requirement is to create text flle from a table and output text file name should be xyz_yyyymmdd.txt where yyyymmdd is the last day of the previous month.
the job is a monthly run. please give your inputs.
Thanks,
Deepak
Last day of the month as file name
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 47
- Joined: Wed Apr 18, 2007 4:49 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Did you not get them because you didn't search for them or did you not "get" them meaning that you did not understand them?
The easiest solution, where the job is run monthly (presumably on the last day of the month) is to generate the base file name (xyz.txt) then use an after-job subroutine such as ExecSH to rename (mv) the file. Within the mv command you can capture the output of the date command (specifying the exact date format that your require) by enclosing the same in backquotes.
The easiest solution, where the job is run monthly (presumably on the last day of the month) is to generate the base file name (xyz.txt) then use an after-job subroutine such as ExecSH to rename (mv) the file. Within the mv command you can capture the output of the date command (specifying the exact date format that your require) by enclosing the same in backquotes.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 47
- Joined: Wed Apr 18, 2007 4:49 am
Last day of the month as file name
Hi ray,ray.wurlod wrote:Did you not get them because you didn't search for them or did you not "get" them meaning that you did not understand them?
The easiest solution, where the job is run monthly (presumably on the las ...
Thanks for your suggestion.
The job is running on 8th business day of the month. i have a oracle function which gets the last buisness day of the previous month, i will save the date in some file. i have to take the date which is stored in the file to append it to the name of the base file xyz.txt.
Thanks,
Deepak
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
So instead of using the date command, you use the cat command and tr any newline characters from it. Something like
Code: Select all
mv basename.txt basename_`cat theotherfile | tr -d \n`.txt
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.