HIT LIST example

The following shows an example of a COBOL call routine to execute a HIT LIST request.
Figure 1. Example of a COBOL call routine to execute a HIT LIST request
Hit-List-Routine.                                                     
*                                                                     
* The set of fields in the following lines must be populated for      
* each call to perform a HIT LIST request.                            
*                                                                     
    Set CS-RequestHitList                to True                      
*
* The set of fields in the following lines must be populated for each 
* criteria field you want to use to specify selection values, for any 
* critera N its appropriate search value(s), search operand and sort  
* option.  Field SC-Count will communicate how many criteria are      
* being passed to the OnDemand system.                                
*
    Set address of FC-FolderCriteriaStructure                         
        to CS-pFolderCriteria                                         
                                                                      
    Move 0                               to SC-Count                  
    Perform varying FC-Ndx from 1 by 1 until FC-Ndx > FC-Count        
     If FC-CriteriaName(FC-Ndx)   =  criterianameN                    
       Add 1                            to SC-Count                   
       Set SC-Ndx                       to SC-Count                   
       Move FC-CriteriaName(FC-Ndx)     to SC-CriteriaName(SC-Ndx)    
       Move FC-CritMaxEntry(FC-Ndx)     to SC-ValueLen(SC-Ndx)        
       Move searchvalue1N               to SC-SearchValue1(SC-Ndx)    
       Move searchvalue2N               to SC-SearchValue2(SC-Ndx)    
       Move searchcountN                to SC-SearchValueCount(SC-Ndx)
       Move opcodeN                     to SC-OP(SC-Ndx)              
       Move FC-SortDefault(FC-Ndx)      to SC-SortOption(SC-Ndx)      
     End-if                                                           
    End-Perform                                                       
*
* Limiting the number of hits returned by overriding the default      
* number of max hits is optional                                      
*
    Move hitlistmaxoverride to CS-HitListMax                          
    Move Spaces             to CS-Message                             

    Move length of SC-CriteriaStructure  to SC-Length                 
    Call Structured-API-Program                                       
         using                                                        
               CS-CommonStructure                                     
               SC-CriteriaStructure                                   
    If CS-Message > spaces                                            
       Move CS-Message to Report-error-message                        
       Write Report-out                                               
     End-if                                                           
                                                                      
     If     CS-ReturnCode =     zero                                  
       and CS-pHitList   not = null                                   
       Perform Hit-List-Successful                                    
     Else                                                             
       Perform Hit-List-Errors                                        
     End-If.