OPEN:
   method custlistid 8;

      /*  Create a list.  */
   custlistid=makelist();

      /*  Open the dataset and store the dataset  */
      /*  identifier in the returned list.        */
   dsid=open('company.customer','U');
   rc = setnitemn(custlistid,dsid,'DSID');
   endmethod;

FIND:
   method custlistid 8 findname $50 sysrc 8;

      /*  Get the dataset identifier from the list.  */
   dsid = getnitemn(custlistid,'DSID');

      /*  Find the observation with the value entered  */
      /*  in NAME.                                     */
   sysrc=where(dsid,'NAME='||quote(findname));

      /*  Read the observation into the SCL data vector.  */
   call set(dsid);
   sysrc=fetch(dsid);

       /*  Check to make sure that an observation matches  */
       /*  the WHERE clause.                               */
   if (sysrc = %sysrc(_sweof)) or (sysrc > 0) then
      do;
         custnum = ' ';
         state = ' ';
         zipcode = ' ';
         city = ' ';
         phone = ' ';
         ord1dte = .;
      end;

   rc = setnitemc(custlistid,custnum,'CUSTNUM');
   rc = setnitemc(custlistid,city,'CITY');
   rc = setnitemc(custlistid,state,'STATE');
   rc = setnitemc(custlistid,zipcode,'ZIPCODE');
   rc = setnitemc(custlistid,phone,'PHONE');
   rc = setnitemn(custlistid,ord1dte,'ORD1DTE');
   rc = setnitemc(custlistid,findname,'NAME');
   endmethod;

RENAME:
    method custlistid 8 newname $50 sysrc 8;

       /* Get the data set identifier from the list. */
    dsid = getnitemn(custlistid,'DSID');

       /* Display the values of the list items in the */
       /* window fields.                              */
    name = newname;
    custnum = getnitemc(custlistid,'CUSTNUM');
    city    = getnitemc(custlistid,'CITY');
    state   = getnitemc(custlistid,'STATE');
    zipcode = getnitemc(custlistid,'ZIPCODE');
    phone   = getnitemc(custlistid,'PHONE');
    ord1dte = getnitemn(custlistid,'ORD1DTE');

       /* Attempt to update the observation. */
    call set(dsid);
    sysrc = update(dsid);
    if not sysrc then
       rc=setnitemc(custlistid,name,'NAME');
    endmethod;


CLOSE:
   method custlistid 8;
      /*  Get the dataset identifier from the list.  */
   dsid = getnitemn(custlistid,'DSID');

      /*  Close the data set.  */
   sysrc=close(dsid);

      /*  Delete the SCL list.  */
   rc = dellist(custlistid);
   endmethod;