home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / makeimg.zip / FIXPKG.CMD next >
OS/2 REXX Batch file  |  1996-02-07  |  1KB  |  53 lines

  1. /* REXX */
  2. call rxfuncadd 'sysfiletree','rexxutil','sysfiletree'
  3. call rxfuncadd 'sysfiledelete','rexxutil','sysfiledelete'
  4. call sysfiletree '*.PKG','pkgfile.'
  5.  
  6. TRUE = 1
  7. FALSE= 0
  8.  
  9. do n = 1 to pkgfile.0
  10.   pkgfile.n = word(pkgfile.n,5)
  11.   recnum = 0
  12.   change_pending = FALSE
  13.   say 'Reading 'pkgfile.n
  14.   do while (lines(pkgfile.n) > 0)
  15.     rec = linein(pkgfile.n)
  16.     recnum = recnum + 1
  17.     pkgrec.recnum = rec
  18.     pkgrec.0 = recnum
  19.     if substr(rec,1,7) = 'SOURCE=' then
  20.     do
  21.       srcline = recnum
  22.       change_pending = TRUE
  23.     end
  24.     if substr(rec,1,7) = 'VOLUME=' then
  25.     do
  26.       if change_pending = TRUE then
  27.       do
  28.          volnum = substr(rec,14)
  29.          if datatype(volnum) = 'NUM' then
  30.          do
  31.             if volnum < 10 then volnum = '0'volnum
  32.             pkgrec.srcline = left(pkgrec.srcline,15) || '../DISK'volnum'/' || ,
  33.                              substr(pkgrec.srcline,16)
  34.          end
  35.       end
  36.       change_pending = FALSE
  37.     end
  38.   end
  39.   call stream pkgfile.n, 'COMMAND', 'CLOSE'
  40.   rc = SysFileDelete(pkgfile.n)
  41.   if rc <> 0 then
  42.   do
  43.     say 'Could not delete file: 'pkgfile.n', Code = 'rc
  44.     exit
  45.   end
  46.   say 'Rewriting' pkgfile.n
  47.   do y = 1 to pkgrec.0
  48.     call lineout pkgfile.n, pkgrec.y
  49.   end
  50.   call stream pkgfile.n, 'COMMAND', 'CLOSE'
  51. end
  52. say 'Done !'
  53.