code to identify the New Quarter


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers code to identify the New Quarter
# 1  
Old 09-30-2008
code to identify the New Quarter

I am a sql programmer, I don't know much about UNIX. I want to modify the existing unix script

-----------------------------------------------------------------
............
cd /home/location/file
set timing on
sqlplus user/$IDPW <<!
prompt RUNNING NEW QUARTER PROCESSING. PLEASE WAIT.
@/home/location/file/new_period.sql
prompt LOADING NEXT TABLES. PLEASE WAIT.
@/home/location/file/file_next.sql
!
echo "TABLES HAVE FINISHED LOADING."
echo "Check output listings: files.lst"

----------------------------------------------------------------
With the following logic:

Get the system date
If system date month = February, May, August, November
prompt RUNNING NEW QUARTER PROCESSING. PLEASE WAIT.
@/home/location/file/new_period.sql
Else
prompt LOADING NEXT TABLES. PLEASE WAIT.
@/home/location/file/file_next.sql
!
echo "TABLES HAVE FINISHED LOADING."
echo "Check output listings: files.lst"

Any help will be really appreciated.

Thank you.
# 2  
Old 09-30-2008
Hammer & Screwdriver Here is a start

I modified you request a little, so you could see results.

Code:
> month=$(date '+%m')
> echo $month
09

> if [ $month -eq 3 ] || [ $month -eq 6 ] || [ $month -eq 9 ] || [ $month -eq 12 ] ; then echo "end of quarter"; fi
end of quarter
>

Modify for the month numbers you want, and instead of an echo command substitute what you want to run.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Linux

How to calculate the quarter end date according to the current date in shell script?

Hi, My question is how to calculate the quarter end date according to the current date in shell script? (2 Replies)
Discussion started by: Divya_1234
2 Replies

2. Shell Programming and Scripting

Shell Script to Loop through Quarter dates

Hi, Trying to automate a Postgres query using Shell script Every month 1st week has to run a Monthly Queries to generate delimited files. July 1st start of fiscal yr which has 4 Quarters until next June 30th Example If I'm running on Sept 5th it has to generate one file(Becuase it... (12 Replies)
Discussion started by: krux_rap
12 Replies

3. Shell Programming and Scripting

Get 1st date of month, week , quarter

Hi , I need to trigger few jobs based on the system date ( in case user is not passing any date to the script. In case passing then need to take the user date). Here is the requirement 1. Everyday call daily script 2. On 1st day of week call weekly script 3. On 1st day of month call... (4 Replies)
Discussion started by: Anupam_Halder
4 Replies

4. UNIX for Dummies Questions & Answers

Find Quarter Start and End Dates

Dear Members, Depending on the current date i should find out the start and end dates of the quarter. ex: Today date is 14-Nov-2011 then Quarter start date should be Oct 1 2011 and Quarter End date should be Dec 31 2011. How can i do this? Thanks Sandeep (1 Reply)
Discussion started by: sandeep_1105
1 Replies

5. UNIX for Dummies Questions & Answers

Get Quarter Date

Hi I need to produce a report that the start date must be the first day of the current quarter. Therefore a repor that is run today the start date would be 01/10/2010 (ddmmyyyy). Obvioulsy I could hard code this date in but what happens when the report is run in January the start of the... (6 Replies)
Discussion started by: theref
6 Replies

6. Shell Programming and Scripting

Generate quarter dates with begin date and end date

Hi All, I am trying to generate quarter dates with user giving input as begin date and end date. Example: Input by user: begin_date = "2009-01-01" end_date = 2010-04-30" required output: 2009-01-01 2009-03-31 09Q01 2009-04-01 2009-06-30 09Q02 . . till 2010-01-01 2010-03-31 10Q01 ... (9 Replies)
Discussion started by: sol_nov
9 Replies

7. Shell Programming and Scripting

extract the relevant data files for a quarter

CTB_KT_OllyotLvos_20081204_164352_200811.txt CTB_KT_LN_utahfwd_20081204_164352_200811.txt CTB_KT_LN_utahfwd_Summ_20081204_164352_200811.txt CTB_KT_PML_astdt_prFr_20081204_210153_200811.txt CTB_KT_PML_astdt_prOt_20081204_210153_200811.txt CTB_KT_PML_astdt_Nopr_20081204_210153_200811.txt... (7 Replies)
Discussion started by: w020637
7 Replies

8. UNIX for Advanced & Expert Users

How can i calculate a Quarter of a Month

I im just a beginner here. I wanted to know how to calculate the Quarter of a Month, and i want to assign Number like if the month falls on 1st quarter then i have to assign to 1 then going on till the last Quarter!! Any help will be much use to me.. ~Renne (2 Replies)
Discussion started by: pidu_rak
2 Replies

9. UNIX for Dummies Questions & Answers

how does unix identify C and other language code!

Hello everyone, this question is probably simple for you ppl but i am jus a beginner and still learing. i was wondering if someone could tell me that how does unix identify different program codes in it's environment. for example, unix recognises this C code in the body of any script. how... (2 Replies)
Discussion started by: a25khan
2 Replies
Login or Register to Ask a Question