home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxlb.zip / SAMPLES / ANOTE.CMD next >
OS/2 REXX Batch file  |  1993-01-08  |  2KB  |  45 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /* ANOTE: annotate a disk file using extended attributes. This program calls */
  4. /* a text editor in order to allow creation of notes that can be attached to */
  5. /* a file. The information is stored in the extended attributes of the file. */
  6. /* If annotations already exist, they are displayed in the editor.           */
  7. /*                                                                           */
  8. /* Requires Personal REXX or REXXLIB (dosenv, dosdir, dosdel functions).     */
  9. /*                                                                           */
  10. /* A text editor is also required. As coded, ANOTE uses KEDIT. Any other     */
  11. /* editor name could be substituted.                                         */
  12. /*                                                                           */
  13. /* Command format: ANOTE <filename>                                          */
  14. /*                                                                           */
  15. /*****************************************************************************/
  16.  
  17. temp = dosenv('temp')'\$anote.tmp'
  18. parse arg fname .
  19. if fname = '' then do
  20.     say 'Format is:'
  21.     say '  ANOTE filename'
  22.     exit
  23.     end
  24. if dosdir(fname) = '' then do
  25.     say fname 'not found.'
  26.     exit 1
  27.     end
  28. call dosdel temp
  29. call sysgetea fname, 'anote', 'notes'
  30. if notes \= '' then
  31.     call charout temp, notes
  32. call charout temp
  33. timestamp = dosdir(temp,'dt')
  34. '@kedit' temp
  35. if dosdir(temp) = '' then do
  36.     say 'Note not created.'
  37.     exit 2
  38.     end
  39. parse value dosdir(temp, 'sdt') with size timestamp1
  40. if timestamp1 = timestamp then
  41.     exit 0
  42. notes = charin(temp, , size)
  43. call charout temp
  44. call sysputea fname, 'anote', notes
  45.