H DFTACTGRP(*NO) BNDDIR('ERPGSDK')                                                             
      **********************************************************************                        
     FCATUSER1  UF A 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 name            S             50                                                             
     D email           S            100                                                             
     D add1            S             30                                                             
     D city            S             30                                                             
     D state           S              2                                                             
     D zip             S              9                                                             
     D user            S             30                                                             
     D password        S             30                                                             
      *                                                                                             
      * Work Variables                                                                              
     D UserCookie      S           5000                                                             
     D ErrorText       S           1024                                                             
     D SignupOk        S               N   INZ(*OFF)                                                
      **********************************************************************                        
     C                   callp     #startup                                                         
      *                                                                                             
     C                   Exsr      $Input                                                           
      *                                                                                             
     C                   callp     #setPath(DftPath)                                                
     C                   callp     #loadTemplate('signup.erpg')                                     
      *                                                                                             
     C                   OPEN      CATUSER1                                                         
      *                                                                                             
     C                   EXSR      $Signup                                                          
      *                                                                                             
     C                   callp     #cleanup                                                         
      *                                                                                             
     C                   CLOSE     CATUSER1                                                         
      *                                                                                             
     C                   Eval      *InLR = *On                                                      
      ****************************************************************                              
      * Process Signup Screen                                        *                              
      ****************************************************************                              
     C     $Signup       BEGSR                                                                      
      *                                                                                             
     C                   if        (user = ' ')                                                     
     C                   eval      ErrorText = 'User name is blank.'                                
     C                   else                                                                       
     C     user          CHAIN     CATUSER1                                                         
      *                                                                                             
     C                   if        (%found(CATUSER1))                                               
     C                   eval      ErrorText = 'User ID already in use.'                            
     C                   else                                                                       
     C                   eval      CUUSER = user                                                    
     C                   eval      CUPWD = password                                                 
     C                   eval      CUACT = 'Y'                                                      
     C                   TIME                    CUSIGND                                            
     C                   eval      CUNAME = name                                                    
     C                   eval      CUEMAIL = email                                                  
     C                   eval      CUADD = add1                                                     
     C                   eval      CUCITY = city                                                    
     C                   eval      CUSTATE = state                                                  
     C                   eval      CUZIP = zip                                                      
     C                   WRITE     RCATUSER                                                         
      *                                                                                             
     C                   eval      SignUpOk = *ON                                                   
     C                   endif                                                                      
      *                                                                                             
     C                   endif                                                                      
      *                                                                                             
     C                   if        (SignUpOk)                                                       
     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                   callp     #replaceData('/%errortext%/':ErrorText)                          
     C                   callp     #writeSection                                                    
      *                                                                                             
     C                   ENDSR                                                                      
      **********************************************************************                        
      * Read Input                                                                                  
      **********************************************************************                        
     C     $Input        BEGSR                                                                      
      *                                                                                             
     C                   eval      name = #getData('name')                                          
     C                   eval      email = #getData('email')                                        
     C                   eval      add1 = #getData('add1')                                          
     C                   eval      city = #getData('city')                                          
     C                   eval      state = #getData('state')                                        
     C                   eval      zip = #getData('zip')                                            
     C                   eval      user = #getData('user')                                          
     C                   eval      password = #getData('password')                                  
      *                                                                                             
     C                   ENDSR