home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv2.zip / VACPP / IBMCPP / BIN / MIGRATE.CMD < prev    next >
OS/2 REXX Batch file  |  1995-05-11  |  2KB  |  75 lines

  1. /******************************************************************************
  2. *
  3. *  Program Number 5763-CD1 (C) Copyright IBM Corp. 1992, 1994.
  4. *  Program Number 5688-194 (C) Copyright IBM Corp. 1992, 1994.
  5. *  All rights reserved.
  6. *
  7. ******************************************************************************/
  8.  
  9. parse arg oldlxl newlxl
  10. if newlxl = '' then exit
  11.  
  12. /* if newlxl not found, then nothing to migrate */
  13. new = stream(newlxl, 'c', 'query exists')
  14. if new = '' then exit
  15.  
  16. /* if oldlxl not found, then just copy newlxl to oldlxl, and done */
  17. old = stream(oldlxl, 'c', 'query exists')
  18. if old = '' then do
  19.    'copy' newlxl oldlxl
  20.    exit
  21.    end
  22.  
  23. /* search through the old lxl file */
  24. i = 0
  25. tabs = ''
  26. do until lines(oldlxl) = 0
  27.    l = linein(oldlxl)
  28.    parse value l with start'.'f col '"'
  29.    if start = '''SET FONT' then do
  30.       font.i = f
  31.       color.i = col
  32.       i = i + 1
  33.    end
  34.    parse value l with '''SET TABS' rest
  35.    if rest <> '' then do
  36.       tabs = l
  37.    end
  38. end
  39. state = stream(oldlxl,'c','close')
  40.  
  41. /* merge new file into old file */
  42. '@del' oldlxl
  43. rc = lineout(oldlxl,,1)
  44. if rc <> 0 then do
  45.    say 'Unable to write to' oldlxl
  46.    exit 1
  47. end
  48. do until lines(newlxl) = 0
  49.    l = linein(newlxl)
  50.    parse value l with start'.'f' 'col'"'rest
  51.    if start = '''SET FONT' then do
  52.       do j = 0 to i - 1 until font.j = f
  53.       end
  54.       if font.j = f then do
  55.          l = start'.'f color.j||'"'rest
  56.       end
  57.    end
  58.    parse value l with '''SET TABS' rest
  59.    if (rest <> '') & (tabs <> '') then do
  60.       l = tabs
  61.       tabs = ''
  62.    end
  63.    rc = lineout(oldlxl,l)
  64.    if rc <> 0 then do
  65.       say 'Unable to write to' oldlxl
  66.       exit 1
  67.    end
  68. end
  69. if tabs <> '' then
  70.    rc = lineout(oldlxl, tabs)
  71. state = stream(newlxl,'c','close')
  72. state = stream(oldlxl,'c','close')
  73.  
  74. exit
  75.