LOGON example

Figure 1 shows an example of a COBOL call routine to execute a LOGON request.
Figure 1. Example of a COBOL call routine to execute a LOGON request
*                                                                    
* The set of fields in the following lines must be populated for each
* call to perform a LOGON.                                           
*                                                                    
     Set  CS-RequestLogon               to True                      
     Move midtieraddressorname          to CS-MidTierIPAddr          
     Move midtierportnumber             to CS-MidTierPort            
     Move libraryserveraddressorname    to CS-LibServIPAddr          
     Move libraryserverportnumber       to CS-LibServPort            
     Move foldernamesearcharguement     to CS-FolderName             
     Move userid                        to LO-UserID                 
     Move password                      to LO-Password               
*                                                                    
*  Values for  Fields CS-Eyeball, CS-APILevel, CS-Length, LO-Eyeball,
*  and LO-Length are defined in sample copybook ARSZDCWS.  For       
*  re-entrant code, they must be populated dynamically.              
*                                                                    
     Move 'ARSLSCCO'                       to CS-Eyeball             
     Move length of CS-CommonStructure     to CS-Length              
     Move current-level                    to CS-APILevel            
     Move 'ARSZSCLO'                       to LO-Eyeball             
     Move length of LO-LogonStructure      to LO-Length              
*                                                                    
* The set of fields in the following lines are defined in sample     
* copybook ARSZDCWS.  For re-entrant code, they must be populated    
* dynamically. Also, if you want to override any of the default     
* values, you may add code to do so.                                 
*                                                                    
     Move overridecodepage                 to CS-CodePage            
     Move overridefoldermax                to CS-FolderListMax       
     Move overridetracelevel               to CS-APITraceLevel       
     Move Spaces                           to CS-Message             
*                                                         
* A TCP/IP persistent socket may be requested by using a socket 
* type value of 1. The default value for CS-SocketType is 0, 
* requesting a "short socket" that is active only for REQUEST.        
*                                                         
     Move sockettypevalue                  to CS-SocketType
                                                                      
     Call Structured-API-Program                                     
        using                                                        
              CS-CommonStructure                                     
              LO-LogonStructure                                      

     If CS-Message > spaces                                          
       Move CS-Message to Report-error-message                       
       Write Report-out                                              
     End-if                                                          
                                                                     
     If      CS-ReturnCode   =     zero                              
         and CS-pFolderList  not = Null                              
         and CS-ConnectionID not = low-values                        
                                                                     
         Perform Logon-successful                                    
     Else                                                            
         Perform Logon-errors                                        
     End-If.