home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 568a.lha / RexxRMF_v1.1 / readonly.rexx < prev    next >
OS/2 REXX Batch file  |  1991-09-13  |  2KB  |  56 lines

  1. /* --------------------------------------------------------------- 
  2.    Example of just reading a file, without the clutter
  3.  * --------------------------------------------------------------- */
  4.  
  5. /* ------------------- Record Layout String --------------------- */
  6.  
  7. videorecord    = " videonum videotitle videocopy videorating videopudate,
  8.                    videopuprice videosaleprice videoavail videohold videocust"
  9.  
  10. x = addlib("RexxRMF.library",0,-30,0) /* --- make library available --- */
  11.  
  12. rmfvideos = open_rmf("videofile")     /* open file                      */
  13.  
  14. vidnode   = find_pos(rmfvideos,0,1)   /* get first video record         */
  15.  
  16. videonum  = key_value(vidnode)        /* get key value to use in read   */
  17.  
  18. /* read the first record, looking for unique keys only */
  19. /* variable names in all caps are from videorecord     */
  20.  
  21. x = read_rmf_record(rmfvideos,0,videorecord,videonum,'U',1)
  22.  
  23. do while x = 1      /* read rcords */
  24.  
  25.    /* how many videos we got with this key */
  26.    count = key_count(rmfvideos,0,VIDEONUM,'K')
  27.  
  28.    /* display record contents */
  29.  
  30.    call writech(stdout,'0c'x)
  31.    call writeln(stdout,'0a'x" Video#:" VIDEONUM " Copies:" count)
  32.    title = substr(VIDEOTITLE,1,32,' ')
  33.    call writech(stdout," Title           :")
  34.    call writeln(stdout,title "Copy#:"VIDEOCOPY "Rating:" VIDEORATING)
  35.    call writeln(stdout,"   Date Purchased:"VIDEOPUDATE)
  36.    call writeln(stdout,"   Purchase Price:"VIDEOPUPRICE)
  37.    call writeln(stdout,"   Sale Price    :"VIDEOSALEPRICE)
  38.    call writeln(stdout,"   Available     :"VIDEOAVAIL)
  39.    call writeln(stdout,"   Hold For      :"VIDEOHOLD)
  40.    call writeln(stdout,"   Current Renter:"VIDEOCUST)
  41.    
  42.    call writech(stdout, '0a'x "More... ([Y]/N) ?")
  43.    z = readln(stdin)
  44.    if upper(substr(z,1,1)) = 'N' then leave
  45.    
  46.    /* read the next record, will terminate loop if not found */
  47.    /* variable names in videorecord are set                  */
  48.  
  49.    x = next_rmf_record(rmfvideos,0,videorecord)
  50.  
  51. end
  52.  
  53. x = close_rmf(rmfvideos,1)  /* the '1' says do not save the data/index files */
  54.  
  55. exit
  56.