H DFTACTGRP(*NO) BNDDIR('ERPGSDK')                                                             
      ****************************************************************                              
      * Prototypes                                                   *                              
      ****************************************************************                              
      /COPY QCOPYSRC,P.ERPGSDK                                                                      
      /COPY QCOPYSRC,P.STRING                                                                       
      ****************************************************************                              
     D DftPath         S             64    INZ('/www/erpgsdk/catalog+                               
     D                                          /templates/')                                       
      *                                                                                             
      * Data read in from Web Page                                                                  
     D cat             S              5  0                                                          
     D user            S             30                                                             
      *                                                                                             
      * Work variables                                                                              
     D CatArr          S              5  0 DIM(9999)                                                
      *                                                                                             
     D CatPath         S           1024                                                             
     D CatCount        S             10i 0                                                          
     D i               S             10i 0                                                          
      **********************************************************************                        
     C                   callp     #startup                                                         
      *                                                                                             
     C                   EXSR      $Input                                                           
     C                   callp     #setPath(DftPath)                                                
      *                                                                                             
     C                   if        (user <> ' ')                                                    
     C                   EXSR      $Main                                                            
     C                   else                                                                       
     C                   EXSR      $Signon                                                          
     C                   endif                                                                      
      *                                                                                             
     C                   callp     #cleanup                                                         
      *                                                                                             
     C                   SETON                                        LR                            
      ****************************************************************                              
      * Main Display                                                 *                              
      ****************************************************************                              
     C     $Main         BEGSR                                                                      
      *                                                                                             
     C                   callp     #loadTemplate('catmain.erpg':'first')                            
      *                                                                                             
     C                   if        (CatCount <= 0)                                                  
     C                   eval      CatPath = ' '                                                    
     C                   else                                                                       
      *                                                                                             
     C                   do        CatCount      i                                                  
     C                   eval      CatPath = %trim(CatPath) +                                       
     C                                       'cat=' +                                               
     C                                       %trim(%editc(CatArr(i):'Z')) +                         
     C                                       '&'                                                    
     C                   enddo                                                                      
      *                                                                                             
     C                   endif                                                                      
      *                                                                                             
     C                   callp     #replaceData('/%catpath%/':CatPath)                              
     C                   callp     #writeSection                                                    
      *                                                                                             
     C                   ENDSR                                                                      
      ****************************************************************                              
      * Redirect to Signon                                           *                              
      ****************************************************************                              
     C     $Signon       BEGSR                                                                      
      *                                                                                             
     C                   callp     #loadTemplate('redsignon.erpg')                                  
     C                   callp     #writeThisSec('first')                                           
      *                                                                                             
     C                   ENDSR                                                                      
      ****************************************************************                              
      * Read Input from web page                                     *                              
      ****************************************************************                              
     C     $Input        BEGSR                                                                      
      *                                                                                             
     C                   eval      i = 1                                                            
     C                   eval      cat = #CtoN(#getData('cat':i))                                   
      *                                                                                             
     C                   dow       (cat <> 0)                                                       
     C                   eval      CatCount = (CatCount + 1)                                        
     C                   eval      CatArr(CatCount) = cat                                           
     C                   eval      i = (i + 1)                                                      
     C                   eval      cat = #CtoN(#getData('cat':i))                                   
     C                   enddo                                                                      
      *                                                                                             
     C                   eval      user = #getCookie('user')                                        
      *                                                                                             
     C                   ENDSR