home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / 123rexx.zip / REXXADD.CMD < prev    next >
OS/2 REXX Batch file  |  1991-10-21  |  2KB  |  39 lines

  1. /*****************************************************************************/
  2. /* Lotus 1-2-3 For OS/2 sample macro command.                                */
  3. /*                                                                           */
  4. /* {REXXRV "REXXADD.CMD",range,value}                                        */
  5. /*                                                                           */
  6. /* Adds 'value' to each of the cells in 'range'.                             */
  7. /*                                                                           */
  8. /* {REXXRV "REXXADD.CMD logFileName",range,value}                            */
  9. /*                                                                           */
  10. /* Writes any TRACE or SAY output to a log file named 'logFileName'.         */
  11. /*                                                                           */
  12. /* Copyright (c) 1991 Lotus Development Corporation.  This code is supplied  */
  13. /* on an 'as is' basis as an example only.  This code has only received      */
  14. /* informal testing by Lotus.  Permission is granted  to copy and modify     */
  15. /* this code to your heart's content.  No warrenties expressed or implied.   */
  16. /* Remember, your mileage may vary.  Let us know if you find support of REXX */
  17. /* by 1-2-3 useful.                                                          */
  18. /*****************************************************************************/
  19.  
  20. PARSE ARG range, value
  21. IF range = "RANGE1" THEN DO                          /* first arg is a range */
  22.    PARSE VAR range1.0 elements sheets columns rows      /* get size of range */
  23.    i = 1
  24.    DO sheet = 1 TO sheets             /* loop through the cells of the range */
  25.       DO column = 1 TO columns
  26.          DO row = 1 TO rows
  27.             /* Compute the new value for the cell, dividing by one to remove */
  28.             /* the decimal point if it is unneeded.                          */
  29.             newValue = (range1.i + value) / 1
  30.             CALL Set123Cell "RANGE1", sheet, column, row, "NUMBER", newValue
  31.             i = i + 1
  32.             END
  33.          END
  34.       END
  35.    END
  36. ELSE                                             /* this should never happen */
  37.    CALL Display123Error "First argument to REXXADD.CMD is not a range."
  38. RETURN
  39.