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


array ids {3} $ 8 _temporary_ ('USRABC' 'USRDEF' 'USRGHI'); 
                                                            
INIT:                                                       
     userid=symget('sysjobid');                             
     if userid ¬ in ids then do;                            
        dsid=open('sasuser.class','I');                     
        _msg_=userid||                                      
              ' not authorized for updates, you may browse';
     end;                                                   
     else dsid=open('sasuser.class','U');                   
     call setrow(0,0,'','y');                               
     call set(dsid);                                        
     delcount=0;                                            
return;


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


GETROW:                                                 
     if fetchobs(dsid,_currow_)¬=0 then call endtable();
     if userid ¬ in ids then protect action;            
return;

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


PUTROW:                                    
  select (action);                         
      when('C')                            
          delrow=_currow_ - delcount;      
          rc=fetchobs(dsid,delrow);        
          rc=append(dsid);                 
          call execcmd('bottom');          
       when('D')                           
          delrow=_currow_ - delcount;      
          rc=fetchobs(dsid,delrow,'noset');
          rc=delobs(dsid);                 
          delcount+1;                      
       when('U')                           
          delrow=_currow_ - delcount;      
          rc=fetchobs(dsid,delrow,'noset');
          rc=update(dsid);                 
       when('A')                           
          rc=append(dsid,'noset');         
          call execcmd('bottom');          
      otherwise;                           
      end;                                 
      action=' ';                          
return;                                    


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


MAIN:                               
      if num¬=_blank_ then          
         rc=where(dsid,'age='||num);
         delcount=0;                
return;                             


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


TERM:               
     rc=close(dsid);
return;             


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


INIT:                                                             
  userid=symget('sysjobid');                                      
  if userid ¬ in ids then do;                                     
     dsid=open('sasuser.class','I');                              
     _msg_=userid|| ' not authorized for updates, you may browse';
  end;                                                            
  else dsid=open('sasuser.class','U');                            
  call setrow(0,0,'','y');                                        
  call set(dsid);                                                 
  delcount=0;                                                     
return;                                                           
                                                                  
MAIN:                                                             
  if num¬=_blank_ then                                            
  rc=where(dsid,'age='||num);                                     
  delcount=0;                                                     
return;                                                           
                                                                  
TERM:                                                             
  rc=close(dsid);                                                 
return;                                                           
                                                                  
GETROW:                                                           
  if fetchobs(dsid,_currow_)¬=0 then call endtable();             
  if userid ¬ in ids then protect action;                         
return;                                                           
                                                                  
PUTROW:                                                           
  select (action);                                                
   when('C')                                                      
       delrow=_currow_ - delcount;        
       rc=fetchobs(dsid,delrow,);         
       rc=append(dsid);                   
       call execcmd('bottom');            
   when('D')                              
       delrow=_currow_ - delcount;        
       rc=fetchobs(dsid,delrow  ,'noset');
       rc=delobs(dsid);                   
       delcount+1;                        
   when('U')                              
       delrow=_currow_ - delcount;        
       rc=fetchobs(dsid,delrow,'noset');  
       rc=update(dsid);                   
   when('A')                              
       rc=append(dsid,'noset');           
       call execcmd('bottom');            
   otherwise;                             
   end;                                   
   action=' ';                            


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


INIT:                                         
    bb=makelist(0,'G');                       
    id=curlist(bb);                           
    dsid=open('sasuser.class');               
    list=datalistc(dsid,'NAME AGE SEX',       
                   'Make 5 Selections','n',5);
    n=getnitemn(bb,'COUNT');                  
    call setrow(n);                           
return;                                       


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


TERM:              
    rc=close(dsid);
return;            


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


GETROW:                               
   name=getnitemc(bb,'NAME',_currow_);
   age=getnitemn(bb,'AGE',_currow_);  
   sex=getnitemc(bb,'SEX',_currow_);  
return;                               


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


PUTROW:                                 
  rc=setnitemc(bb,name,'name',_currow_);
  rc=setnitemn(bb,age,'age',_currow_);  
  rc=setnitemc(bb,sex,'sex',_currow_);  
return;                                 


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


INIT:                                                           
  bb=makelist(0,'G');                                           
  id=curlist(bb);                                               
  dsid=open('sasuser.class');                                   
  list=datalistc(dsid,'NAME AGE SEX','Make 5 Selections','n',5);
  n=getnitemn(bb,'COUNT');                                      
  call setrow(n);                                               
return;                                                         
                                                                
MAIN:                                                           
return;                                                         
                                                                
TERM:                                                           
  rc=close(dsid);                                               
return;                                 
                                        
GETROW:                                 
   name=getnitemc(bb,'NAME',_currow_);  
   age=getnitemn(bb,'AGE',_currow_);    
   sex=getnitemc(bb,'SEX',_currow_);    
return;                                 
                                        
PUTROW:                                 
  rc=setnitemc(bb,name,'name',_currow_);
  rc=setnitemn(bb,age,'age',_currow_);  
  rc=setnitemc(bb,sex,'sex',_currow_);  
return;                                 


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


INIT:                                                    
    control enter;                                       
    lname=makelist(0,'l');                               
    lage=makelist(0,'l');                                
    lsex=makelist(0,'l');                                
    bb=makelist();                                       
    rc=fillist('catalog','sasuser.lists.class.slist',bb);
    if rc=0 then do;                                     
       lname=getniteml(bb,'lname');                      
       lage=getniteml(bb,'lage');                        
       lsex=getniteml(bb,'lsex');                        
    end;                                                 
    else do;                                             
       bb=setniteml(bb,lname,'lname');                   
       bb=setniteml(bb,lage,'lage');                     
       bb=setniteml(bb,lsex,'lsex');                     
       rc=setlattr(lage,'NUMONLY');                      
    end;                                                 
    call setrow(listlen(lname));                         
return;                                                  


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


MAIN:                                         
    if word(1,'u')='ADD' then do;             
       name=_blank_; age=_blank_; sex=_blank_;
       rc=insertc(lname,name,-1);             
       rc=insertn(lage,age,-1);               
       rc=insertc(lsex,sex,-1);               
    end;                                      
    call setrow(listlen(lname));              
return;                                       


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


TERM:                                                     
    rc=savelist('catalog','sasuser.lists.class.slist',bb);
    call putlist(bb,'BB IS AS FOLLOWS:',0);               
    rc=dellist(lname);                                    
    rc=dellist(lage);                                     
    rc=dellist(lsex);                                     
    rc=dellist(bb);                                       
return;                                                   


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


GETROW:                         
  name=getitemc(lname,_currow_);
  age=getitemn(lage,_currow_);  
  sex=getitemc(lsex,_currow_);  
return;                         


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


PUTROW:                         
    if action='A' then do;      
      name=_blank_;             
      age=_blank_ ;             
      sex=_blank_ ;             
      rc=insertc(lname,name,-1);
      rc=insertn(lage,age ,-1); 
      rc=insertc(lsex,sex ,-1);            
    end;                                   
    if action='U' then do;                 
      rc=setitemc(lname,name,_currow_,'y');
      rc=setitemn(lage,age,_currow_,'y');  
      rc=setitemc(lsex,sex,_currow_,'y');  
    end;                                   
    if action='D' then do;                 
      rc=delitem(lname,_currow_);          
      rc=delitem(lage,_currow_);           
      rc=delitem(lsex,_currow_);           
    end;                                   
    action=_blank_;                        
return;                                    


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


INIT:                                                  
  control enter;                                       
  lname=makelist(0,'l');                               
  lage=makelist(0,'l');                                
  lsex=makelist(0,'l');                                
  bb=makelist();                                       
  rc=fillist('catalog','sasuser.lists.class.slist',bb);
  if rc=0  then do;                                    
     lname=getniteml(bb,'lname');                      
     lage=getniteml(bb,'lage');                        
     lsex=getniteml(bb,'lsex');                        
  end;                                                 
  else do;                                             
     bb=setniteml(bb,lname,'lname');                   
     bb=setniteml(bb,lage,'lage');                     
     bb=setniteml(bb,lsex,'lsex');                     
     rc=setlattr(lage,'NUMONLY');                      
  end;                                                 
  call setrow(listlen(lname));                         
return;                                                
                                                       
MAIN:                                                  
  if word(1,'u')='ADD' then do;                        
     name=_blank_;                                     
     age=_blank_ ;                                      
     sex=_blank_ ;                                      
     rc=insertc(lname,name,-1);                         
     rc=insertn(lage,age,-1);                           
     rc=insertc(lsex,sex,-1);                           
  end;                                                  
  call setrow(listlen(lname));                          
return;                                                 
                                                        
TERM:                                                   
  rc=savelist('catalog','sasuser.lists.class.slist',bb);
  rc=dellist(lname);                                    
  rc=dellist(lage);                                     
  rc=dellist(lsex);                                     
  rc=dellist(bb);                                       
return;                                                 
                                                        
GETROW:                                                 
  name=getitemc(lname,_currow_);                        
  age=getitemn(lage,_currow_);                          
  sex=getitemc(lsex,_currow_);                          
return;                                                 
                                                        
PUTROW:                                                 
  if action='A' then do;                                
     name=_blank_;                                      
     age=_blank_ ;                                      
     sex=_blank_ ;                                      
     rc=insertc(lname,name,-1);                         
     rc=insertn(lage,age ,-1);                          
     rc=insertc(lsex,sex ,-1);           
  end;                                   
  if action='U' then do;                 
    rc=setitemc(lname,name,_currow_,'y');
    rc=setitemn(lage,age,_currow_,'y');  
    rc=setitemc(lsex,sex,_currow_,'y');  
  end;                                   
  if action='D' then do;                 
    rc=delitem(lname,_currow_);          
    rc=delitem(lage,_currow_);           
    rc=delitem(lsex,_currow_);           
  end;                                   
  action=_blank_;                        
return;

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