H DFTACTGRP(*NO) BNDDIR('ERPGSDK')                                                             
      **********************************************************************                        
     FCATUSER1  IF   E           K DISK    USROPN                                                   
      **********************************************************************                        
      * Prototypes                                                                                  
      **********************************************************************                        
      /COPY QCOPYSRC,P.ERPGSDK                                                                      
      **********************************************************************                        
     D DftPath         S             64    INZ('/www/erpgsdk/catalog+                               
     D                                          /templates/')                                       
      *                                                                                             
      * Data read in from Web Page                                                                  
     D user            S             30                                                             
     D password        S             30                                                             
      *                                                                                             
      * Work Variables                                                                              
     D UserCookie      S           5000                                                             
     D LoginOK         S               N   INZ(*OFF)                                                
      **********************************************************************                        
     C                   callp     #startup                                                         
      *                                                                                             
     C                   Exsr      $Input                                                           
      *                                                                                             
     C                   callp     #setPath(DftPath)                                                
     C                   callp     #loadTemplate('signon.erpg')                                     
      *                                                                                             
     C                   OPEN      CATUSER1                                                         
      *                                                                                             
     C                   EXSR      $Signon                                                          
      *                                                                                             
     C                   callp     #cleanup                                                         
      *                                                                                             
     C                   CLOSE     CATUSER1                                                         
      *                                                                                             
     C                   Eval      *InLR = *On                                                      
      ****************************************************************                              
      * Process Signon Screen                                        *                              
      ****************************************************************                              
     C     $Signon       BEGSR                                                                      
      *                                                                                             
     C     user          CHAIN     CATUSER1                                                         
      *                                                                                             
     C                   if        (%found(CATUSER1)) and (password = CUPWD)                        
     C                   eval      LoginOk = *ON                                                    
     C                   endif                                                                      
      *                                                                                             
     C                   if        (LoginOK)                                                        
     C                   EXSR      $Success                                                         
     C                   else                                                                       
     C                   EXSR      $Fail                                                            
     C                   endif                                                                      
      *                                                                                             
     C                   ENDSR                                                                      
      ****************************************************************                              
      * Login Succeeded                                              *                              
      ****************************************************************                              
     C     $Success      BEGSR                                                                      
      *                                                                                             
     C                   callp     #loadSection('success')                                          
     C                   eval      UserCookie = #buildCookie('user':user)                           
     C                   callp     #replaceData('/%usercookie%/':UserCookie)                        
     C                   callp     #writeSection                                                    
      *                                                                                             
     C                   ENDSR                                                                      
      ****************************************************************                              
      * Login Failed                                                 *                              
      ****************************************************************                              
     C     $Fail         BEGSR                                                                      
      *                                                                                             
     C                   callp     #loadSection('fail')                                             
      *                                                                                             
     C                   if        (user <> ' ')                                                    
     C                   callp     #replaceData('/%message%/':                                      
     C                                          'You entered an invalid User ' +                    
     C                                          'ID or Password.')                                  
     C                   else                                                                       
     C                   callp     #replaceData('/%message%/':' ')                             
     C                   endif                                                                      
      *                                                                                             
     C                   callp     #writeSection                                                    
      *                                                                                             
     C                   ENDSR                                                                      
      **********************************************************************                        
      * Read Input                                                                                  
      **********************************************************************                        
     C     $Input        BEGSR                                                                      
      *                                                                                             
     C                   eval      user = #getData('user')                                          
     C                   eval      password = #getData('password')                                  
      *                                                                                             
     C                   ENDSR