home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / fortran / tidy64.zip / TIDYEXEC.CMS < prev    next >
Text File  |  1989-02-15  |  4KB  |  117 lines

  1. &TRACE OFF
  2. *
  3. ************************************************************************
  4. *
  5. *  The exec TIDY renumbers and otherwise cleans up old and tired FORTRAN
  6. *  source program.  TIDY accepts ASA FORTRAN with 19 continuation cards
  7. *  as well as some IBM and CDC dialect FORTRAN statements. To invoke the
  8. *  the exec, type
  9. *
  10. *            TIDY filename filetype filemode
  11. *
  12. *  where
  13. *
  14. *            filename     is the name of the file containing the FORTRAN
  15. *                         source
  16. *
  17. *            filetype     is the type of the file containing the FORTRAN
  18. *                         source
  19. *
  20. *            filemode     is the mode of the file containing the FORTRAN
  21. *                         source
  22. *
  23. * TIDY produces 2 files:
  24. *
  25. *        filename TIDYLIST filemode   containing a diagnostic listing
  26. *                                     from the TIDY run
  27. *
  28. *        filename TIDYFORT filemode   containing the cleaned up FORTRAN
  29. *                                     source from the TIDY run
  30. *
  31. * TIDY uses 2 scratch file which are deleted at the end of the run:
  32. *
  33. *        $SCRTCH1 TIDYFILE filemode
  34. *        $SCRTCH2 TIDYFILE filemode
  35. *
  36. *
  37. ************************************************************************
  38. *
  39. *
  40. ************************************************************************
  41. *
  42. * If the keyword $TRACE appears on the command line &POSITION OF $TRACE
  43. * will set &$TRACE to the number of the argument in which $TRACE appears.
  44. &$TRACE = &POSITION OF $TRACE &1 &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20 &21 &22 &23 &24
  45. * save $TRACE parameter for passing to other execs
  46. &IF &$TRACE EQ 0 &TRCFLG = &BLANK
  47. &IF &$TRACE EQ 0 &GOTO -CONT
  48. * Argument that contained keyword $TRACE is set to blank.
  49. &&$TRACE = &BLANK
  50. * The sequence of arguments is restored, less the keywords, by stacking
  51. &STACK LIFO &1 &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20 &21 &22 &23 &24 &25 &26 &27 &28 &29 &30
  52. * then reading the arguments.
  53. &READ ARGS
  54. &STACK LIFO &1 &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20 &21 &22 &23 &24 &25 &26 &27 &28 &29 &30
  55. &READ STRING &ARGSTRING
  56. * &TRACE is set to ALL if &$TRACE is greater than 0
  57. &TRACE ALL
  58. * save $TRACE parameter for passing to other execs
  59. &TRCFLG = $TRACE
  60. -CONT
  61. *
  62. *************************************************************************
  63. *
  64. *     CHECK FOR EXISTENCE OF FILE AND R/W ACCESS TO DISK
  65. *
  66. &STACK LIFO
  67. &WRTFLG = 0
  68. &DISKAD =
  69. LISTFILE &1 &2 &3 (LIFO
  70. *
  71. *      FILE PROBABLY NOT FOUND
  72. *
  73. &IF &RETCODE NE 0 &EXIT &RETCODE
  74. &READ VARS &F1 &F2 &F3
  75. &LOOP -LP UNTIL .&F1 EQ .
  76.    &F3 = &PIECE OF &F3 1 1
  77.    QUERY DISK &F3 (STACK LIFO
  78.    &READ VARS &D1 &D2 &D3 &D4
  79.    &READ VARS
  80.    &IF .&D4 NE .R/W &SKIP 2
  81.       &WRTFLG = 1
  82.       &DISKAD = &D3
  83.    &READ VARS &F1 &F2 &F3
  84. -LP
  85. *
  86. *      FILE NOT ON R/W DISK
  87. *
  88. &IF &WRTFLG NE 0 &SKIP 4
  89. &TYPE
  90. &TYPE  FILE &1 &2 &3 IS NOT ON A DISK WITH WRITE ACCESS
  91. &TYPE
  92. &EXIT 888
  93. *
  94. *      SET UP FILEDEF'S FOR ALL FILES
  95. *
  96. FILEDEF 3 DISK PROFILE TIDY &DISKAD (RECFM FB LRECL 80 BLOCK 800
  97. FILEDEF 4 DISK &1 &2 &DISKAD (RECFM FB LRECL 80 BLOCK 800
  98. FILEDEF 6 DISK &1 TIDYLIST &DISKAD (RECFM FBA LRECL 132 BLOCK 1320
  99. FILEDEF 8 DISK &1 TIDYFORT &DISKAD (RECFM FB LRECL 80 BLOCK 800
  100. FILEDEF 1 DISK $SCRTCH1 TIDYFILE &DISKAD (RECFM V LRECL 1024 BLOCK 4096
  101. FILEDEF 2 DISK $SCRTCH2 TIDYFILE &DISKAD (RECFM V LRECL 1024 BLOCK 4096
  102. *
  103. *      LET USER KNOW WHAT'S GOING ON
  104. *
  105. &TYPE TIDY &1 &2 &DISKAD
  106. *
  107. *      INVOKE TIDY
  108. *
  109. TIDY
  110. &RTCDE = &RETCODE
  111. *
  112. *      GET RID OF SCRATCH FILES
  113. *
  114. ERASE $SCRTCH1 TIDYFILE &DISKAD
  115. ERASE $SCRTCH2 TIDYFILE &DISKAD
  116. &EXIT &RTCDE
  117.