home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 15a / convdb2.zip / CONGEN.CMD < prev    next >
OS/2 REXX Batch file  |  1987-02-14  |  3KB  |  80 lines

  1. ************************************************************
  2. ************************************************************
  3. *****              File Converter  (c) COPYRIGHT 1983  *****
  4. *****  congen.cmd                  Data Based Advisor  *****
  5. *****                                                  *****
  6. *****  AUTHOR: Larry Eitel                             *****
  7. *****  DATE: October 29, 1983                          *****
  8. *****                                                  *****
  9. *****  called from con.cmd                             *****
  10. *****                                                  *****
  11. *****  PURPOSE:                                        *****
  12. *****  Generate a command file with REPLACE            *****
  13. *****  statements to convert the contents in the       *****
  14. *****  (SECONDARY) "from" file and APPEND it to the    *****
  15. *****  (PRIMARY) "to" file.  The command file          *****
  16. *****  generated is named CONVERT.CMD.                 *****
  17. *****                                                  *****
  18. *****  DISCLAIMER:                                     *****
  19. *****  The author makes or implies no warranties       *****
  20. *****  regarding the operation or usefulness of this   *****
  21. *****  program.  It is recommended the user make       *****
  22. *****  backups of any valuable files.                  *****
  23. ************************************************************
  24. ************************************************************
  25. ***** If there are no REPLACE statements available, RETURN.
  26. IF 0=test(line&lnumber)
  27.   RETURN
  28. ENDIF 0=test(line&lnumber) 
  29. @ 8,0 SAY ' ' 
  30. ***** Open a text file that will become a command file to
  31. ***** convert the contents in the from file (secondary)
  32. ***** and add them to the to file (primary).  The name of 
  33. ***** command file generated can be changed by replacing
  34. ***** convert.cmd with the new name.  Make sure that if
  35. ***** you want to run the results, the name has the 
  36. ***** extention .CMD for 8-bit users or .PRG for 16-bit
  37. ***** users.
  38. SET ALTERNATE TO convert.cmd
  39. SET ALTERNATE ON
  40. ? 'CLEAR' 
  41. ? 'ERASE' 
  42. ? 'SET TALK OFF' 
  43. ? '***** File to recieve converted information.'
  44. ? 'SELECT PRIMARY'
  45. ? 'USE ' +tock
  46. ? 'SELECT SECONDARY' 
  47. ? '***** Source of converted information.'
  48. ? 'USE ' +fromck
  49. ? 'DO WHILE .NOT. eof' 
  50. ? '  @ 10,00 SAY "Currently record number-"+str(#,5)' 
  51. ? '  SELECT PRIMARY' 
  52. ? '  APPEND BLANK' 
  53. ***** This loop will display each available REPLACE 
  54. ***** statement.  The result of course is that each
  55. ***** REPLACE statement will be a separate line in the
  56. ***** command file.
  57. STORE 1 TO showline
  58. STORE str(showline,1) TO show
  59. DO WHILE 0#test(line&show)
  60.   ? '  ' +line&show
  61.   STORE showline+1 TO showline
  62.   IF showline<10
  63.     STORE str(showline,1) TO show
  64.   ELSE
  65.     STORE str(showline,2) TO show
  66.   ENDIF showline<10 
  67. ENDDO WHILE 0#test(line&show) 
  68. ? '  SELECT SECONDARY' 
  69. ? '  SKIP' 
  70. ? 'ENDDO' 
  71. ? 'RETURN' 
  72. ***** Turn off and close the ALTERNATE FILE.
  73. SET ALTERNATE OFF
  74. SET ALTERNATE TO
  75. ?
  76. ? 'Press any key to continue.' 
  77. WAIT
  78. RETURN
  79.  
  80.