<< Click to Display Table of Contents >> SCAN ... END-SCAN |
![]() ![]() ![]() |
Scans the current or specified result set line by line. Inside of the SCAN block you can call IF statements to check values of fields you are interested in and continue with computation only when the line contains specific information. You can use LNCMD_EXEC_SCAN statement to call a line command for each scanned line. You can combine IF and LNCMD_EXEC_SCAN statements inside of the scan block to create reports containing only information you are interested in.
set_title='automic JobPlans base'
logon="logon.lgn"
selection_file='test.sel'
create_htm_file='output\report.htm'
lncmd_exec='Automic - Task Properties'
create_htm_file=''
close
lncmd_exec='Automic - Objects in Plan'
create_htm_file=''
close='automic JobPlans base'
scan=''
if Obj-Type = 'JOBP'
lncmd_exec_scan='Automic - JobPlans'
create_htm_file=''
lncmd_exec='GRAPH - Aut.Workflow'
create_PNG_file=''
close
close
end-if
end-scan
Explanation:
1.Selection criteria specified in 'test.sel' file is executed.
2.Data returned from the selection are identified by 'automic JobPlans base' and they are written as HTML table to 'output\report.htm' file.
3.'Automic - Task Properties' line command is executed for every line of the data and the result becomes the current result set.
4.The task properties are appended to the opened HTML file and this result set is closed. As a result 'automic JobPlans base' result set becomes the current one.
5.'Automic - Objects in Plan' line command is executed for all lines of 'automic JobPlans base' result set and the result becomes the current result set.
6.Objects in the plan are appended to HTML file.
7.'automic JobPlan base' result set is closed. At this moment only one result set exists (Automic - Objects in Plan).
8.Scanning of 'Automic - Objects in Plan' line by line starts.
9.IF statement is executed for every line
10. If the value in column 'Obj-Type' doesn't equal 'JOBP' then the iteration continues, otherwise:
i.'Automic - JobPlans' line command is executed for the current scanned line and the result becomes the current result set.
ii.The result is appended to HTML file.
iii.'GRAPH - Aut. Workflow' line command is executed for all lines of the current result set (Automic - JobPlans) and the result becomes the current one.
iv.PNG file of the workflow is created and a link to it is appended to HTML file.
v.The current result set ('Automic - Workflow') is closed.
vi.The current result set ('Automic - JobPlans') is closed.
Sometimes it is handy to call another selection_file command from within a scan block and with variables in its values.
Sample script:
logon="D:\Test\logon.lgn"
selection_file="D:\Test\selection.sel"
create_htm_file="D:\Test\report.htm"
use_runtime_variables=Y
scan=''
create_htm_file="D:\Test\chart-%Jobname%-%Stepname%.htm"
selection_file="D:\Test\selection_chart.sel"
line_chart="SMF_TEST"
create_png_file="D:\Test\chart-%Jobname%-%Stepname%.png"
close
end-scan
Here the first selection is done be selection.sel file where are fixed search criteria.
Then the support of runtime variables is activated by use_runtime_variables command. This is necessary, otherwise the parser handles % in the second selection file like a wildcard instead of a variable.
The scan block iterates through all lines returned by the first selection.
The selection_chart.sel file can now use variables referencing values in Jobname and Stepname columns of the current row:
SMFSTEPINFORMATION
SMFSTEPINFORMATION_Jobname=EQ%Jobname%
SMFSTEPINFORMATION_Stepname=EQ%Stepname%
The variables are substituted before the selection is executed, so the server receives already valid Jobname and Stepname.
Variables can also be used in file names.