Call (subroutines)

The Call control statement is used to call subroutines. Call also accepts parameters that are sent to the subroutines. The Call syntax is shown as follows:

Call subroutineName(Parameter 1, Parameter 2, Parameter n);

The following script shows the complete example of a subroutine and the call of it:

Sub LoadYear(UserYear)

Table:
LOAD
*
Inline
[
Year
2015
2016
2017
]
where Year = $(UserYear);

END Sub

Call LoadYear(2017);

In the preceding example, the code within the subroutine will only populate the Year field with 2017 data.

As of way of organizing our script, we can have one section per main subroutine—for instance, the load of the fact tableand then one last section where we call all the different subroutines. Within the main subroutines we can call supportive subroutines such us a subrouting that stores and drops a table.

The following image shows a sample script with three different sections and a fourth section calling the different subroutines:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.107.31