|
a macro which comes from a macro which was formerly a macro and comes from
a file or another macro to call a macro with must be with or without
quotes from a file to get the lasrun of a job...?
Sorry, too much macros and files for me! I need 1 hour to read the text
and 5 hours to understand it aproximately! Unfortunately (or fortunately)
I have also another job which I am paid for...
Gerhard
On Wed, 27 May 2009 19:34:11 +0530, mahesh kumar peesari
<peesari.mahesh@GMAIL.COM> wrote:
>Hi all,
>Any Inputs Please....
>
>Thanks
>
>On Wed, May 27, 2009 at 5:20 PM, SUBSCRIBE SAS-L Joe H. Smith <
>peesari.mahesh@gmail.com> wrote:
>
>> hi all;
>>
>> %get_job_dttm(jobnm=,manual_flag=,manual_run_dttm=);
>>
>> so in the above macro i am passing values for the macro variables when
i am
>> invoking it.
>>
>> my task is i have to store the above macro variables
>> manual_flag,manual_run_dttm in other macro or store in other file.
>> how should i call that manual_flag,manual_run_dttm variables into
>> %get_job_dttm(jobnm='update').
>>
>> purpose for storing this macro variables in other macro or file is that
>> they will be frequently changed and moreover i dont want to pass this
>> values directly at the macro ,instead i want to call it from other
macro or
>> file where it is stored.
>>
>> macro is this way;
>>
>> %GLOBAL CURRENT_JOB_LASTRUNDTTM_DDS;
>> %GLOBAL RUN_CONTROL_DTTM_DDS;
>> /*
>> get_job_last_rundttm: To fetch the last successfull run dttm (start
dttm)
>> for the job
>>
>> 1) job status table name will always be job_status
>> 2) Library for job status will always be control & is defined in
>> autoexec.sas file
>> 3) Parameters list
>> 4) jobnm (Compulsory parameter), takes the job name. Should be enclosed
>> with
>> single quotes. E.g. 'POPULATE_FSC_PARTY_DIM'
>> 5) manual_flag (Compulsory parameter), 'Y' if the manual datetime have
been
>> specified,
>> 'N' if the datetime has to be picked from job_status
>> 6) manual_run_dttm (Optional), for initial loads this variable should
>> be set a value in the format ('01sep2004:00:00:00'dt)
>> */
>>
>> /*libname control "Data/misdata/control";*/
>> LIBNAME dds ORACLE PATH=ORASPO SCHEMA=spodds USER=spodds
>> PASSWORD='spodds' ;
>>
>> %macro get_job_last_rundttm_dds (jobnm=,manual_run_dttm=,manual_flag=);
>>
>> /*Initialize temporary variable start_time with large date*/
>> %let start_time = '01JAN5999:00:00:00'dt;
>>
>> /*If statement starts here to check whether manual data is assigned or
has
>> to
>> be taken from the job status */
>> %if %upcase(&manual_flag) = 'N' %then
>> /*%if %str(&manual_run_dttm) = %str() %then */
>> %do;
>> proc sql;
>> /*Select the maximum(job last start dttm) when the job was
>> successfull */
>> select catx("", "'", put(sttime, datetime21.), "'dt") into
>> :start_time from dds.dds_job_status
>> where left(trim(jobname)) = &jobnm
>> and (left(trim(jobstat)) = 'Job Successful' or left(trim(jobstat))
>> = 'Job Ended with Warnings')
>> group by jobname
>> having sttime = max(sttime);
>> quit;
>> %end;
>> %else
>> /*When the manual run data is supplied, assign the manual run data
>> to the
>> temporary variable start_time*/
>> %let start_time = &manual_run_dttm;
>>
>> /*If statement ends here */
>>
>> /*Assign the start time to CURRENT_JOB_LASTRUNDTTM macro variable*/
>> %let CURRENT_JOB_LASTRUNDTTM_DDS = &start_time;
>>
>> %let RUN_CONTROL_DTTM_DDS = TODAY();
>>
>>
>> %mend get_job_last_rundttm_dds;
>>
>> Thanks In advance
>>
>
>
>
>--
>Jack Of All Trades....But Master Of NONE....
|