Page tree
Skip to end of metadata
Go to start of metadata

Many Global Variables are set when executing the Job and do have default values.

However, some checks are done in the first Script of the Job do simplify life.

if ($G_LOAD_TYPE <> 'FIRST' and $G_EDATE is null)
 $G_EDATE = sysdate();

if (isweekend(sysdate()) = 1 and $G_REBUILD_INDEXES is null)
   $G_REBUILD_INDEXES = 'Y';
else
   $G_REBUILD_INDEXES = 'N';

#
# $G_LOAD_DATE is used to generate consistent result
# of sysdate() function call (midnight date change
# case)
$G_LOAD_DATE = sysdate();

#
# $G_LOAD_TIME is used to generate consistent result
# of systime() function call (midnight date change
# case) in conjunction with $LOAD_DATE
$G_LOAD_TIME = to_char(systime(), 'HH24:MI:SS');

#
# Call function to check ExecutionStatus Table for this job
# After the first execution, to force a new run using $SDATE
# and $EDATE as the extraction interval,
AW_StartJob('Cost_Center_Load',NULL,$G_LOAD_TYPE, $G_SDATE, $G_EDATE);

print('[$G_LOAD_TYPE]-Load started taking data from [$G_SDATE] to [$G_EDATE]');

The first thing is, what if somebody would have forgotten to set the end date? So if it is null, set the end date to todays date. This way the load will run and it is a good guess anyway.

With the global variable $G_REBUILD_INDEXES one can force to execute additional maintenance operations in the database (see PreLoad Stored Procedure for Oracle). By default, this should happen on weekends only.

The most important function call here is the custom function AW_StartJob. Here, the information about the job parameters are saved into a data warehouse status table AW_JOBEXECUTION and at the end of the Job using another custom function called AW_EndJob marked as successfully loaded. So in case of a delta load this function can read the end date of the previous run and use this to the the $G_SDATE global variable.

and this is the Script at the end of the Job, just calling the AW_EndJob function and thus updating the current run as "done" in the AW_JOBEXECUTION table.

#
# Updates job status with a value of done
#
AW_EndJob('Cost_Center_Load');



  • No labels