Example

The following example includes several different pieces of customer correspondence from a number of inputs in the same envelope to the customer. The example control file reads three print streams that contain multiple documents of varying page count, sorts and matches the documents by customer identification number, and adds a cover letter that includes the customer’s address to each document package. Since every customer will not get every piece of correspondence, we should list the contents of the package in the cover letter. If a document package doesn't include the first input (a provider letter from which we’ll extract the customer’s address), Enrichment outsorts it to a separate output.

<input>                         <! Begin input tag group, 1st input. >
   <name> PL                    <! Name of file.                     >
   <file> DD:INPUT1             <! DD name in JCL.                   >
   <type> AFPL A                <! Linedata w/ ANSI carriage control.>
   <copygroup> F2LDATA0         <! Copygroup for standard output.    >
   <pageformat> P2LINE35        <! Pageformat for standard output.   >
   <doc> T %%ID_number C        <! Change in ID number field denotes >
                                <!    new document.                  >
   <field> %%ID_number KA       <! ID number field, referenced by    >
      <reference> ' ' 'Number:' 17 <!  literal in column 17.         >
      <location> 0 3 10         <!    Actual data is 3 positions to  >
   </field>                     <!    right of the : and is 10 bytes.>
   <field> %%PL_Addr1 K         <! The following 3 fields are the    >
      <loc> 10  2  40           <!    address found on page 1 of the >
   </field>                     <!    document.  They are on lines   >
   <field> %%PL_Addr2 K         <!    10, 11, and 12, beginning in   >
      <loc> 11  2  40           <!    the 2nd position for 40 chars. >
   </field>                     <!    These fields are used in the   >
   <field> %%PL_Addr3 K         <!    cover letter.                  >
      <loc> 12  2  40
   </field>
</input>
<input>                         <! Begin input tag group, 2nd input. >
   <name> PR                    <! Name of file.                     >
   <file> DD:INPUT2             <! DD name in JCL.                   >
   <type> AFPL A                <! Linedata w/ ANSI carriage control.>
   <copygroup> F2LDATA0         <! Copygroup for standard output.    >
   <pageformat> P2LINE35        <! Pageformat for standard output.   >
   <doc> T %%ID_number C        <! Change in id number field denotes >
                                <!    new document.                  >
   <field> %%ID_number KA       <! ID number field on line 9, column >
      <location> 9 26 10        <!   26, for a length of 10.         >
   </field>
</input>
<input>                         <! Begin input tag group, 3rd input. >
   <name> BenS                  <! Name of file.                     >
   <file> DD:INPUT3             <! DD name in JCL.                   >
   <type> AFPL A                <! Linedata w/ ANSI carriage control.>
   <copygroup> F2LDATA0         <! Copygroup for standard output.    >
   <pageformat> P2LINE35        <! Pageformat for standard output.   >
   <doc> T %%ID_number C        <! Change in ID number field denotes >
                                <!    new document.                  >
   <field> %%ID_number KA       <! ID number field on line 5, column >
      <loc> 5 26 10             <!   26, for a length of 10.         >
   </field>
</input>
<input>                         <! Begin input tag group, cover page.>
   <name> CoverLetter           <! Name of file.                     >
   <file> DD:INPUT4             <! DD name in JCL.                   >
   <type> AFPL A                <! Line data w/ANSI carriage control.>
   <copygroup> F2COVLT0         <! Copygroup for cover letter.       >
   <pageformat> P2COVER5        <! Pageformat for cover letter.      >
   <doc> *                      <! Only one document.                >
   <substitute> YES             <! Substitute variable names in the  >
                                <!    cover letter with values from  >
                                <!    the control or rule file.      >
</input>
<sortmatch>                     <! Begin sortmatch tag group.        >
   <inputname> CoverLetter      A Y <! Cover letter always included. >
   <inputname> PL               M Y <! Other files are included only >
   <inputname> PR               M Y <!   if they match.              >
   <inputname> BenS             M Y
   <sort> %%ID_number A         <! Sorted and matched on ID number in> 
                                <!   in ascending order.             >
</sortmatch>
<rule>                                 <! Begin rule file.           >
   <content>                           <! Content tag allows rules   >
   DOCUMENT:                           <!    in the control file.    >
     if WORDPOS('PL',%%INPUT) then     <! This block of code checks  > 
        %%PL = 'Provider Letter'       <!    for the existence of the>
        %%ADDR1 = %%PL_Addr1           <!    Provider Letter to list >
        %%ADDR2 = %%PL_Addr2           <!    in the cover letter.    >
        %%ADDR3 = %%PL_Addr3
        <output> Output                <! Set the output file.       >
     else
        %%PL = ' '
        %%ADDR1 = '*******************'
        %%ADDR2 = '* ADDRESS UNKNOWN *'
        %%ADDR3 = '*******************'
        <output> NoAddress             <! Set the output file.       >
     endif
     if WORDPOS('PR',%%INPUT) then     <! This block of code checks  >
        %%PBR = 'Plan Book Revisions'  <!    for the existence of the>
     else                              <!    Plan Book input and adds>
        %%PBR = ' '                    <!    it to the cover letter. >
     endif
     if WORDPOS('BenS',%%INPUT) then    <! This block of code checks >
        %%BS = 'Benefits Summary'      <!    for the existence of the>
     else                              <!    Benefit input and adds  >
        %%BS = ' '                     <!    it to the cover letter. >
     endif
   </content>
</rule>
<output>                         <! Begin output tag group.          >
   <name> Output                 <! Name of file.                    >
   <file> DD:OUTPUT1             <! DD name in JCL.                  >
</output>
<output>                         <! Begin output tag group.          >
   <name> NoAddress              <! Name of file.                    >
   <file> DD:OUTPUT2             <! DD name in JCL.                  >
</output>