Example of Splitting Output Print Streams into Multiple Files

For example, if you wanted to split the documents in the input file into two files, one for documents whose page count is more than three pages (output named MORE3PAGE) and one for documents whose page count is three pages or less (output named 3ORLESSPAGE), you would create the following control file.

<input>
   <name> Sortout                     <! Identifiable name.         >
   <file> DD:INPUT1                    <! Input file.                >
   <type> AFPL A                       <! File is AFP line data.     >
   <document> TOP %%Customer_Number CHANGE  <! First page of a doc.  >
   <field> %%Customer_Number KA        <! Find the customer number.  >
      <location> 15 60 10              <! Print line 15, column 60   >
   </field>                            <!   for 10 bytes.            >
</input>

<rule>
   <content>
   DOCUMENT:
    if %%TOTAL_PAGES > 3 then
       <output> MORE3PAGE
    else
       <output> 3ORLESSPAGE
    endif
   </content>
</rule>

<output>                               <! Output for 3 or fewer pgs. >
   <name> 3ORLESSPAGE                  <! Identifiable name          >
   <file> DD:OUTPUT1                   <! File name                  >
</output>
<output>                               <! Output for 3 and up pages. >
   <name> MORE3PAGE                    <! Identifiable name          >
   <file> DD:OUTPUT2                   <! File name                  >
</output>