/**********************************************************************/


      /* Create an array of commands used with letters.   */
   array letcmds {*} $6 ('LETTER','SEND','EDIT');           

      /* Name the location of the letters and forms       */         
      /* using the form libref.catalog.                   */
   letcat='pubtklet.letter';                                         


/**********************************************************************/

                                                            
   cmd=upcase(word(1));                                     
   if cmd in letcmds then do;                               
                                                            
         /* Push the current values into the temporary    */
         /* data set.                                     */
      pubskel=open('work.pubskel','U');                     
      call set(pubskel);                                    
      rc=fetchobs(pubskel,1,'NOSET');                       
      rc=update(pubskel);                                   
      rc=close(pubskel);                                    

         /* Call the LETTER routine, specifying a         */
         /* letter if necessary.                          */
      if cmd ne 'LETTER' then do;                           
         let=upcase(word(2));                               
         if let ne ' ' then                                 
            call letter(letcat || '.' || let,cmd,           
                       'WORK.PUBSKEL');                     
         else                                               
            _msg_='No letter specified for the              
                  ' || cmd || ' command.';                  
      end;                                                  
      else 
         call letter(letcat,'EDIT','WORK.PUBSKEL');
   end; 


/**********************************************************************/