User Tools

Site Tools


[ Return to Table of Contents]

Smart Routing


Smart Routing is a set of features in iDocs that permits the automatic routing of merged documents to Email, Fax or Print. It is implemented in two basic ways:

  1. The routing information can be retrieved from a database using spool file information as the database key, or
  2. The routing information can be scraped directly from the spool file.

Smart Routing Using a Database

The first step is to create a mapped field that contains the database key value. This for example might be a customer number if you are using a customer database file. From the main InFORM Decisions menu, take option one, Define a form or Check Application. Locate the form application and place a two next to the application. Next locate a sample spool file and select this spool file with an option one and press enter twice.

At this point, the left column of the screen should display the corresponding lines numbers of the spool file. Additionally the key value, such as the customer number, should be in full view. If the value is not in full view, the display screen may be shifted right by using the shift F8 key.

With the key value in full view, position the cursor in the leftmost position of the value and press the F8 key. Next, place the cursor in the rightmost position of the key value and press the F8 key again. This will display the Map Field Maintenance screen.

  5/11/07                     iDocs Form Suite                        FM2540S2  
 10:26:08                    Map Field Maintenance                    QSECOFR   
  Form Name. . . . . . DEMOINV       Field Name . . . MYSMARTKEY F4=List        
                                     Description. . . Smart Routing Key         
Spooled File Source                                                             
  From Row . . . . . . 1             To Row . . . . . . .  1                   
  From Column  . . . . 1             To Column  . . . . .  10                   
Overlay Target                                                                  
  Horizontal Position. 9998  300dpi  Vertical Position. .  9998   300dpi        
  Map Field  . . . . .       F4=List Map Type . . . . . .  2 F4=List  XY Mapping
  Font . . . . . . . .       F4=List Courier 11cpi Regular                      
  Line Spacing . . . .       300dpi  Font Rotation. . . .       90° 180° 270°   
  Form Side. . . . . .       F4=List Non duplex field                           

Complete the field prompt by entering a field name and description. Choose any meaningful name for the mapped field – do not use a keyword from the F4 prompt. Enter 9998 for both horizontal and vertical positions so the data does not print on the output page – those coordinates are off the pcl page.

Conditionally map                                                              
  If the value in column       to column                                       
  Map next field end                 Bursting. . . . . .   Y  (Y/N)            
  of this field . . .   N  (Y/N)                                               
  Sort Sequence . . . .  1 F4=List                                             

Secondly, specify a sort sequence. You should specify a sort sequence if you wish to group pages to one target into one transmission. For example, if you are emailing based on customer number you probably want to group all pages to a particular customer into one attachment and send the customer one email. Odd sort sequences sort in ascending order, even sequences sort in descending order.

Bursting should be set to Y. This will create a new document and thus a separate transmission, email fax or print, to the target. If you do not burst then each input spool file will generate one output transmission to the target found on the first page only of the document.

The normal procedure is to sort and burst on this field.

Database Definition for Email

Smart Routing considers output targets in this order: Email, Fax, Print. Any output method not defined will be skipped. The first method defined that successfully resolves a target destination such as an email address or fax number will be selected. If you need to handle customer preference as to delivery method use logical files to present to the Smart Routing application only one deliver method.

From the Form definition maintenance screen navigate back to the form application and place an option 14 next to the entry. Option 14 will be labeled External Database on versions older than 3.69d and Smart Routing on younger versions.

 5/11/07                     iDocs Form Suite                        FM1200S1  
10:32:03                    iMail Document Routing                   QSECOFR   
Type information, press Enter.                                                 
  Application: DEMOINV    DEMO. INVOICE FORM                                   
  File Name . . . : ROUTINGDB                                                  
    Library . . . :   CUSTOMER                                                 
  Member Name . . : *FIRST                                                     
  Prefix to key (if necessary) . . . . . :                                     
  Map field data to use as key . . . . . : MYSMARTKEY                          
  String to return as *TOADDRESS . . . . : From Col: 10    To Col: 137         
  Outq to receive file if *TOADDRESS not valid . . :  BADOUTQ               

At this screen specify the file name and library of the database file containing the Smart Routing address information, such as email addresses and fax number. In the field specifying the Map field data to use as key, enter the name of the mapped field defined to contain the database key earlier in this document. In this example, MYSMARTKEY contains a value from the spool file to look up into CUSTOMER/ROUTINGDB.

The next prompt identifies the location of the email address within the customer record. In the example above, the email address within the customer record begins in position 10 and ends in position 137 for a size of 128 characters. Please note that this is in bytes and is considered from the beginning of the record. It does not refer to fields in the database.

The last field specifies the location where the output spool files should be placed if the email address can not be retrieved, i.e. the lookup on the database using the specified key fails. If the lookup succeeds but the address is not deliverable, the email is sent to the email server which handles it separately - examine the inbox of the sender's email address on the email server. Email undeliverable at the server is not returned to iMail/iDocs. If the address lookup succeeds but the email server rejects the send, examine the iMail log.

Please note that in iDocs 5.0 and subsequent versions the address failure outqueue must be specified separately using option 18 from the main form list.

  9/22/20                                                             SRSPLCS1  
 14:38:53              Smart Routing Spool Configuration              KKRAMER   
 Type information, press Enter.                                                 
   Application:   ADELWACK Adel Wiggins Acknowledge                             
   Resolve to alternate printer:                                                
     Out Queue  . . . . . . . . . . . . . .                F4=List              
       Library  . . . . . . . . . . . . . .                                     
   Resolve to invalid email address:                                            
     Out Queue  . . . . . . . . . . . . . .                F4=List              
       Library  . . . . . . . . . . . . . .                                     
   Resolve to invalid FAX number:                                               
     Out Queue  . . . . . . . . . . . . . .                F4=List              
       Library  . . . . . . . . . . . . . .                                     
 F3=Exit   F6=Email Default Values   F7=Fax   F10=Update   F12=Cancel           

Email Defaults

From the iMAIL external routing screen the delivery parameters were specified for the recipient, but not the sender, subject and message body. These values can be specified by pressing the F6 key to specify the email default values.

  9/22/20                                                             SRSPLCS2 
 14:42:59              Smart Routing Spool Configuration              KKRAMER  
                            iMail Interface Defaults                           
   Application:   ADELWACK                                                     
  Request Delivery Receipt:    (Y/N)        Request Read Receipt:    (Y/N)     
 F3=Exit   F10=Update   F12=Cancel   F13=Attachment Path                       

From this screen, enter the default from address, subject and associated text. Press the F10 key to save the values and return back to the form definition maintenance.

Note that one does not have to specify a default to address – that is determined as part of the Smart Routing processing. If you do not specify a default from address then the default contained in the iMail configuration will be used.

Database Definition for Fax

Navigate back to the form application and reselect it with an option 14. Press the F7 key to define the FAX directives. The screen below should be displayed.

  5/11/07                     iDocs Form Suite                        FM1200S2  
 10:41:27                    iFAX Document Routing                    QSECOFR   
 Type information, press Enter.                                                 
   Application: DEMOINV    DEMO. INVOICE FORM                                   
   File Name . . . : ROUTINGDB                                                  
     Library . . . :   CUSTOMER                                                 
   Member Name . . : *FIRST                                                     
   Prefix to key (if necessary) . . . . . :                                     
   Map field data to use as key . . . . . : MYSMARTKEY                          
   String to return as Company Name . . . : From Col: 129   To Col: 158         
   String to return as Contact  . . . . . : From Col: 212   To Col: 231            
   String to return as Fax# . . . . . . . : From Col: 159   To Col: 168         
   Outq to receive file if Fax# not valid . . . . . :  BADFAX                  
 F3=Exit   F6=Fax Default Values   F7=Email   F10=Update   F11=Print  F12=Cancel

The first five prompts for faxing should contain the same values for emailing. However if the fax number and email addresses are contained in different databases, these databases can be defined separately.

As specified previously for email, define the beginning and ending columns for the fax recipient’s company name, contact and fax number.

Finally in the last prompt on the screen specify the name of the out queue that will be used to collect spool files intended to be faxed, but resulted in not being faxed due to an invalid fax number.

If doing only Fax Smart Routing and not also email, use *FAX for the distribution outqueue in the form definition and *FORMDEF in the engine or manual merge.

Fax Defaults

Once all the values have been identified, press the F6 key to define the fax default values.

 5/11/07                     iDocs Form Suite                        FM1200S4  
10:39:19                    iFAX Document Routing                    QSECOFR   
Type information, press Enter.                                                 
  Application: DEMOINV    DEMO. INVOICE FORM                                   
       Cover Page  : *DEFAULT                                                  
       Fax Line  . : *DEFAULT                                                  
  From Company . . : inFORM Decisions                                          
       Contact . . : Davis Yokana                                              
       Phone#  . . : 949.709.5838                                              
       Fax#  . . . : 949.709.5839                                              
       Subject . . : Company Newsletter                                        
       Message . . : Thank you for subscribing to our company newslette        
    To Company . . :                                                           
       Contact . . :                                                           
       Fax#  . . . :                                                           
F3=Exit   F10=Update   F12=Cancel                                              

From this screen specify the default cover page from within iFAX fax or override the default value.

The prompt for the Fax line specifies the default fax telephone line with that will be used to send the fax transmissions.

The remaining entries for the from and to prompts will be used to populate the cover page with the correct inFORM Decisions of the sender and the recipient.

Press the F10 key to save this inFORM Decisions, and return to the Form Definition Maintenance Screen.

Specifying the Out Queue

From the Work With Form Applications subfile (list), scroll to the form application and place a 1 next to the entry.

  5/11/07                     iDocs Form Suite                        FM0465C3  
 10:43:18                Define a Form Application                    QSECOFR   
 Form  Application. . . . . .  DEMOINV    DEMO. INVOICE FORM                    
 Form  Size . . . . . . . . .      2  Letter(8 1/2 x 11 in.)             F4=List
 Collate(Y/N). . . . . . . . . . . N     Use Mapped Fields Only (Y/N). . . Y    
 Orient (P)ortrait or (L)andscape. P     Pages per Overlay (1-9) . . . . . 1    
 Front Map File. :               F4=List Back Map File . . :             F4=List
 X adjustment value. . . . . . . .   0   Y adjustment value. . . . . . . .   0  
 Front Side                     Back Side               Form       Destination  
 Overlay   Seq  Drawer  Merge   Overlay           Merge Prompt     Out Queue    
 F4=List    #   F4=List Data    F4=List   Tumble  Data  F4=List    F4=List      
 DEMOINV     1      1     Y                             *STD       *EMAILPDF    
 F1=Help  F2=Data Map   F3=Exit  F7=Footer      F8=Work with Mapped  Fields     
 F9=Advanced Functions  F12=Cancel   F15=Global Offset   F17=Import Map         

In the prompt for the Distribution Out Queue enter the key word value of either *EMAILPDF to process the distribution of the spool files in a PDF format, *EMAILPCL to process the distribution of the spool files in a PCL format.

Note that despite the keyword value being misleading and contrary to the alternative delivery methods, that if emailing is not an available option for the spool file, the alternate methods will be used.

Engine Definition

From the InFORM Decisions main menu, select option 4, Work with Engines. Select an existing engine, or create a new one dedicated to Smart Routing.

 5/11/07                      iDocs Form Suite                       FM0450C3  
10:45:35                Engine Definition Maintenance                QSECOFR   
Engine Name. . . . . . : DQENGINE   Description. . : A Dataqueue Engine        
Archive Out Queue. . . : ARCHIVE    Archive Library: QUSRSYS       F4=List     
Data Queue . . . . . . : DQENGINE   Dataque Library: QGPL                      
Engine Status. . . . . :                                                       
       Originating        Spool     Spool      Form       Resulting  Resulting 
Prc Out Queue  Library    Attribute Attribute  App        SpoolFile  Out Queue 
Grp      F4=List          F4=List   Value      F4=List    Name        F4=List  
    QPRINT     *LIBL      *FORM    INVOICE    JCAINVOICE            *FORMDEF   
F3=Exit   F4=Prompt  F7=Server View                  F12=Previous  F21=Command 
Press Enter to confirm                                                         

Changing the Destination Out Queue value to *FORMDEF specifies that the resulting spool file will be directed as it is defined in the form application.

In this example the form application named, JCAINV, has defined within it *EMAILPDF in the distribution override out queue.

After changing this value within the engine definition, the engine is ready to be submitted to batch and to process smart routing accordingly.

Smart Routing Using Spool File Information

The other way to use Smart Routing is to scrape the destination information directly from the spool file. Of course the information has to be in the spool file to scraped. Email addresses and fax numbers usually are not included in end user documents, but if they are this might be the simplest way to setup Smart Routing.

The procedure is to create a form application as one normally would, and then in addition to the mapping for the output create additional mapped fields as discussed below. Please note that using this method one should not define databases uses option 14. One merely creates specific mapped fields to contain the necessary information from the spool file.


For email routing, create mapped fields named using the following keywords containing the specified information.

*FRADDRESS – iMail from address.

*TOADDRESS – iMail recipient address

*CCADDRESS – iMail recipient address to copy

*BCADDRESS – iMail recipient address to blind copy

*SUBJECT - iMail Subject

*SUB0120 - iMail Subject 1 through 20

*SUB2140 - iMail Subject 21 through 40

*MESSAGE - iMail Message

*MSG01 - 09 - iMail Message lines 1 through 9

You can prompt the field name in the greenscreen mapped field screen, scroll through the possible keyword values, and select one of the above.

To successfully define a Smart Routing email application from the above keywords as mapped fields you must define at a minimum *TOADDRESS.

In the form application definition the destination outqueue is *EMAILPDF. The destination outqueue in the engine is *FORMDEF.

Note on Subject Line:

You can create a “dynamic” subject line in your EMAIL that will contain information mapped from your spoolfile. The extracted data can be the entire subject line or appended to a literal value that was typed into the default Subject Line. Use keywords *SUB0120 and *SUB2140 as the field names for the mapped fields that reference the data to be extracted. Both keywords allow for a maximum 20 Alpha mapped value. The value in *SUB0120 will be trimmed and appended to the subject literal value with a blank space prefix. If *SUB2140 is used, the trimmed value will be appended to the trimmed value of *SUB0120 with a blank space prefix.

  • The *SUBJECT keyword replaces the default subject line defined in Smart Routing.
  • The *SUB0120 and *SUB2140 keywords append to the default Smart Routing subject.
  • Each allows up to 20 characters and can be used together, but *SUB0120 must be defined before using *SUB2140.


                                        From     To       Map                       
Fld Name      Description            Row Col Row Col  Type  Fld    Xloc    Yloc 
*SUB0120   Subject cols 1 - 20         3  30   3  49   2           9999    9998 
*SUB2140   Subject cols 21 - 40        4  30   4  49   2           9998    9998 
Subject: Default Message +First mapped field+ +Second field+

                Email subject default = 'Default Message'  
                First mapped field (*SUB0120) = '+First mapped field+' (20 character max)
                Second mapped field (*SUB2140) = '+Second field+' (20 character max) 


The iFax interface to mapped field Smart Routing is identical to that of iMail. The keywords used to name the mapped fields are different. They are:


*FAXDESC - iFAX FAX Description

*FAXNBRUSR - iFAX FAX Number User Data

*FAXTO - iFAX FAX Recipient

To define an iFax Smart Routing application using this method one must define at a minimum *FAXNBR.

In the form application the destination outqueue is *FAX; in the engine it is *FORMDEF.


To define print as the Smart Routing destination define a mapped field with field name:

*OUTQ - iDocs Out Queue

The contents of the mapped field will be evaluated and its contents used to specify the destination outqueue of the resulting merged document. The captured value used as an outqueue will override the destination outqueue specified in the form and/or engine.

The output outqueue in the form definition is specified as *PRINT.

You can also define mapped fields to capture:

*TRAY - iDocs Input Tray

*BIN - iDocs Output Bin

[ Return to Table of Contents]

pub/smartrouting.txt · Last modified: 2022/06/25 17:02 by