Fast/Unload with Model 204 file groups: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
 
m (more conversion cleanup)
Line 9: Line 9:
<var class="product">Fast/Unload</var> automatically determines when a found set has a group context,
<var class="product">Fast/Unload</var> automatically determines when a found set has a group context,
and treats the group as a single database for the duration of the unload.
and treats the group as a single database for the duration of the unload.
This means that a single output dataset is produced for the entire group
This means that a single output data set is produced for the entire group unload.
unload.
 
<p></p>
All FUEL statements are supported with the use of groups, except the
All FUEL statements are supported with the use of groups, except the
SORT and HASH options of UAI.
<var>SORT</var> and <var>HASH</var> options of <var>UAI</var>.
<p></p>
 
You should be aware of the following special considerations:
You should be aware of the following special considerations:
<ul>
<ul>
<li>If a field referenced on a PUT statement does not exist in some of the
<li>If a field referenced on a <var>PUT</var> statement does not exist in some of the
databases in the group,
databases in the group, the reference will be treated as a missing occurrence for each record in
the reference will be treated as a missing occurrence for each record in
those files.
those files.
This means that the PUT statement's MISSING
This means that the <var>PUT</var> statement's <var>MISSING</var>
clause will be executed for each record in those files
clause will be executed for each record in those files
in which the field is not defined.
in which the field is not defined.</li>
<li>The #RECIN variable will always be set to the current record number for
 
<li>The <var>#RECIN</var> variable will always be set to the current record number for
the current file.
the current file.
The #RECIN variable is reset at the completion of each file in the group.
The <var>#RECIN</var> variable is reset at the completion of each file in the group.
So, for groups, there can be multiple records unloaded with the
So, for groups, there can be multiple records unloaded with the
same #RECIN value.
same <var>#RECIN</var> value.</li>
<li>The #RECOUT variable is not reset for the duration of a group unload.
 
<li>The <var>#RECOUT</var> variable is not reset for the duration of a group unload.
It always contains a running total of the number output records
It always contains a running total of the number output records
produced for the entire unload.
produced for the entire unload.</li>
<li>The #GRPSIZ variable contains the number of files in the group.
 
<li>The #GRPMEM variable contains the number of the current file within
<li>The <var>#GRPSIZ</var> variable contains the number of files in the group.</li>
the group (1 for the first file, etc.).
 
<li>If you have any FUEL statements before the FOR EACH
<li>The <var>#GRPMEM</var> variable contains the number of the current file within
RECORD loop, those statements are executed once at the start of the job;
the group (1 for the first file, etc.).</li>
 
<li>If you have any FUEL statements before the <var>FOR EACH
RECORD</var> loop, those statements are executed once at the start of the job;
they are <b>not</b> executed before each member
they are <b>not</b> executed before each member
in the group.
in the group.</li>
<li>If you have any FUEL statements following the end of the FOR EACH
 
RECORD loop, those statements are executed once at the end of the job;
<li>If you have any FUEL statements following the end of the <var>FOR EACH
they are <b>not</b> executed at the end of each member
RECORD</var> loop, those statements are executed once at the end of the job;
in the group.
they are <b>not</b> executed at the end of each member in the group.</li>
<li>Field statistics are produced separately for each file in a group.
 
<li>Date statistics are produced separately for each file in a group.
<li>Field statistics are produced separately for each file in a group.</li>
<li>
 
The FRECORD parameter only applies to the first file, if a group unload
<li>Date statistics are produced separately for each file in a group.</li>
is being performed.
 
<li>The <var>FRECORD</var> parameter only applies to the first file, if a group unload
is being performed.</li>
</ul>
</ul>
<p></p>
 
For example, the following FUEL program prints the number of records
For example, the following FUEL program prints the number of records
in each file and the total number of records in the group (the latter
in each file and the total number of records in the group (the latter
is somewhat silly, since the total number of
is somewhat silly, since the total number of
records is available from the standard <var class="product">Fast/Unload</var> summary messages):
records is available from the standard <var class="product">Fast/Unload</var> summary messages):
<p class="code"><nowiki>OPEN INFILES
<p class="code">OPEN INFILES
%GTOT = 0    /* Initialize counters
%GTOT = 0    /* Initialize counters
%FTOT = 0
%FTOT = 0
Line 68: Line 73:
REPORT %GTOT AND 'records in group'
REPORT %GTOT AND 'records in group'
REPORT #GRPSIZ AND 'files in group'
REPORT #GRPSIZ AND 'files in group'
</nowiki></p>
</p>
 
==See also==
==See also==
[[Fast/Unload overview#WIKFUN$$topics|Fast/Unload topics]]
[[Fast/Unload overview#WIKFUN$$topics|Fast/Unload topics]]

Revision as of 16:23, 23 February 2015

If you have purchased the Fast/Unload SOUL Interface, you can directly unload groups with Fast/Unload. You can unload permanent groups, temporary groups, or ad hoc groups with this feature. No User Language changes are necessary to use groups with Fast/Unload. Fast/Unload automatically determines when a found set has a group context, and treats the group as a single database for the duration of the unload. This means that a single output data set is produced for the entire group unload.

All FUEL statements are supported with the use of groups, except the SORT and HASH options of UAI.

You should be aware of the following special considerations:

  • If a field referenced on a PUT statement does not exist in some of the databases in the group, the reference will be treated as a missing occurrence for each record in those files. This means that the PUT statement's MISSING clause will be executed for each record in those files in which the field is not defined.
  • The #RECIN variable will always be set to the current record number for the current file. The #RECIN variable is reset at the completion of each file in the group. So, for groups, there can be multiple records unloaded with the same #RECIN value.
  • The #RECOUT variable is not reset for the duration of a group unload. It always contains a running total of the number output records produced for the entire unload.
  • The #GRPSIZ variable contains the number of files in the group.
  • The #GRPMEM variable contains the number of the current file within the group (1 for the first file, etc.).
  • If you have any FUEL statements before the FOR EACH RECORD loop, those statements are executed once at the start of the job; they are not executed before each member in the group.
  • If you have any FUEL statements following the end of the FOR EACH RECORD loop, those statements are executed once at the end of the job; they are not executed at the end of each member in the group.
  • Field statistics are produced separately for each file in a group.
  • Date statistics are produced separately for each file in a group.
  • The FRECORD parameter only applies to the first file, if a group unload is being performed.

For example, the following FUEL program prints the number of records in each file and the total number of records in the group (the latter is somewhat silly, since the total number of records is available from the standard Fast/Unload summary messages):

OPEN INFILES %GTOT = 0 /* Initialize counters %FTOT = 0 FOR EACH RECORD IF %GRP NE #GRPMEM THEN /* New group member? %GTOT = %GTOT + %FTOT %FTOT = 0 %GRP = #GRPMEM END IF %FTOT = %FTOT + 1 END FOR %GTOT = %GTOT + %FTOT /* Include last file REPORT %GTOT AND 'records in group' REPORT #GRPSIZ AND 'files in group'

See also

Fast/Unload topics