Page 2 of 2

Re: Fetch records for a particular quarter using date

PostPosted: Tue May 13, 2014 7:31 pm
by Healy
I had a talk with my analyst.

I do not have to select the record as a three month prior date. It is now as i originally stated on a Quarterly basis.

That is the Job will be run on the first Business day of the month. i have fetch the records wherein the date corresponds to that particular Quarter.

Example:
The first Business day in the month of July is : 1st July 2014

Then i have to fetch the records for the quarter 1st April 2014 - 30th June 2014

I mean to say even if the first business day of the month falls on say the 5th of a particular month, i need to fetch the records only for the previous quarter starting from the 1st to the last day of the month for that quarter end.

Example 5th April 2014 is the run-date and also the first business day of the month(assuming)

Records that Qualify
1st-Jan-2014 - 31st Mar-2014

The calendar days basically correspond to the days that are falling in that particular quarter and for which there are records present on file.

The use of Run-date depends on the format we use it in our sort card. I mean to say if we use functions like DATE1 to fetch the current date then the format in which it returns is what we will have to work with. The run-date will basically correspond to the current date that the job will run on.

Healy

Re: Fetch records for a particular quarter using date

PostPosted: Tue May 13, 2014 8:37 pm
by BillyBoyo
OK, you have your "run date". Look at the month. If month is 04-06, then reporting-period month is 01-03 with year the same, if 07-09, 04-06, same year, if 10-12, 07-09, same year, if 01-03, the tricky one, it is 10-12 and year minus one.

Re: Fetch records for a particular quarter using date

PostPosted: Tue May 13, 2014 9:47 pm
by Healy
OK, i understand your logic. However, how do i achieve this through a sort card because my jobs will be run after a particular quarter is over at any point throughout the year. It should be applicable for any date after a quarter is over(Jan,Apr,July,Oct->Jan).

For example if my job is run on 1st July 2014 right, then how using my sort card will i compare for values between 04-06 for month without harcoding the same. I cannot use any variables kind of thing.

My job should be compatible to run on any date after a particular is over. It should be applicable for the entire year. I will not be modifying it after a particular quarter is over.

Moreover, i don't know how i will be able to handle the case of 01-03 which is for 10-12 and year minus one which is the trickiest bit.

Please if you could provide a reference sort card that i can refer to which uses the method you are describing as i am unable to do so.

Thank You,
Healy

Re: Fetch records for a particular quarter using date

PostPosted: Tue May 13, 2014 10:34 pm
by BillyBoyo
To find out if your SyncSort supports values from the PARM, can you run this and see what happens please.

//STEP0100 EXEC PGM=SORT,PARM='JP1"TEST"'         
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                     
DOES NOT MATTER                 
//SORTOUT  DD SYSOUT=*                 
//SYSIN    DD *                                       
  OPTION COPY,STOPAFT=1                                         
  INREC BUILD=(JP1)
//*


It should either fail pointing at JP1, or it should produce TEST on the sysout for SORTOUT.

If it works, you would be able to provide a parameter to your SORT Control Cards. If it doesn't work, we'll do something else :-)

Basically, we'll have, in some way, a SORT symbol that you can use in INCLUDE/OMIT COND= to select the records which are required.

Generating the symbols from the "current date" will also be possible, but we may be able to suggest something which is more flexible.

Re: Fetch records for a particular quarter using date

PostPosted: Wed May 14, 2014 8:09 am
by Healy
I ran the Step that you gave me, sadly it abended pointing at JP1. Here's the SYSOUT for the same

SYSIN :                                       
  OPTION COPY,STOPAFT=1                       
  INREC BUILD=(JP1)                           
                        *                               
 PARM FIELD ERROR - JP1"TEST           
ALTERNATE PARM USED                   
INREC STATEMENT   : SYNTAX ERROR     
SYNCSMF  CALLED BY SYNCSORT; RC=0000 


i have never used any sort symbols until now and don't know about them, however i will look that up. Please let me know if there is anything more flexible that i can use.

Thank you,
Healy