home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / seedump.zip / SAMPLES / CALC.BAG < prev    next >
Text File  |  1995-08-18  |  560b  |  34 lines

  1. /*
  2.  * Author : a priori computer solutions GmbH
  3.  * Title  : Rexx-Utility
  4.  * Notice : Written 1995, the 27th of July
  5.  */
  6.  
  7. /*
  8. * mini calculator for bagger
  9. */
  10.  
  11. parse arg p
  12.  
  13. if ( p = "" )
  14. then do
  15.   say "Please use a valid decimal or hexadecimal number as parameter."
  16.   say "e.g.  calc 15 "
  17.   return 0
  18. end
  19.  
  20. numeric digits 12
  21. res='r'
  22. interpret res '=' p
  23. if DATATYPE(r) == 'NUM' then do
  24.   say p '=' r'     X'd2x(r)
  25.   return r
  26. end
  27. if DATATYPE(r,'X') == 1 then do
  28.   r = x2d(r)
  29.   say p '=' r'     X'd2x(r)
  30.   return r
  31. end
  32. say r
  33. return 0
  34.