Previous Next        Current Page: NeXtMidas Training / Working with Files / Lab 2 / Solution
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
Working with Files   
   - File Basics   
   + The AUX List   
   + Basic File Commands   
   + Lab 1   
   + File Names   
   + File Types   
   - Lab 2   
      - Instructions   
      - Solution   
   + Listing Files   
   + Lab 3   
   + Plotting Files   
   + Lab 4   
Option Trees   
Macros - Part 1 (Basics)   
Macros - Part 2 (Graphics)   
NetBeans - Part 1 (Setup)   
NetBeans - Part 2 (GUIs)   
NetBeans - Part 3 (Profiler)   
Eclipse - Part 1 (Setup)   
Eclipse - Part 2 (GUIs)   
Primitives   
Applets & WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • Lab 2 (solution):
    • Here is what you should have done:
      1. Dump the lines in the source code for the STATUS command ($NMROOT/nxm/sys/intr/Status.java) using the package syntax.
        nM> stat nxm.sys.intr.Status.java /d=60
      2. Form the path for apenny.prm in AREA=DAT, OPT=SYS in a platform independent way. Then use the if command to check for its existence from the shell.
        nM> fname filename NAME=apenny EXT=prm OPT=SYS AREA=DAT
        nM> if filename FEXISTS
            or
        nM> if nxm.sys.dat.apenny.prm FEXISTS
            or
        nM> file name fullname (^env.nmroot,nxm,sys,dat) apenny prm
        nM> if fullname FEXISTS
      3. Can you list the files in http://nextmidas.techma.com/nm/nxm/sys/dat/? Why or why not?
        Yes. The nextmidas.techma.com web server is configured
        to provide a directory listing, but this may not
        be the case with all web servers.
      4. Can you status the file http://nextmidas.techma.com/nm/nxm/sys/dat/apenny.prm? Why or why not?
        Yes. The nextmidas.techma.com web server, like most web
        servers, is configured to allow access to this file.
      5. Use the NOOP command to copy the first half of the elements from http://nextmidas.techma.com/nm/nxm/sys/dat/apenny.prm to a file halfpenny.prm in your WRITE aux.
        nM> noop http://nextmidas.techma.com/nm/nxm/sys/dat/apenny.prm(0:64) halfpenny.prm
        (Note that the 64 is exclusive and it will copy elements 0 through 63 to the new file.)