Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for dec2hex.rex

(view source code of dec2hex.rex as plain text)

  1. /* Dec2Hex.rex,  Version 1.01 */
  2.  
  3. /* Parse command line parameters */
  4. parse arg number dummy .
  5.  
  6. /* Check command line parameters */
  7. if number = "" then call Syntax
  8. if dummy <> "" then call Syntax
  9. if Pos( "?", number )      > 0 then call Syntax
  10. if DataType( number, "W" ) = 0 then call Syntax
  11.  
  12. /* Convert the number and display the result */
  13. say
  14. say number||" = 0x"||Right( D2X( number ), 8, "0" )
  15.  
  16. Exit 0
  17.  
  18.  
  19. Syntax:
  20. 	say
  21. 	say "Dec2Hex.rex,  Version 1.01"
  22. 	say "Convert specified decimal number to 8 digit hexadecimal"
  23. 	say
  24. 	say "Usage:  <REXX>  DEC2HEX.REX  number"
  25. 	say
  26. 	say 'Where:  "<REXX>" is your Rexx interpreter:'
  27. 	say "                 - Windows:  REGINA.EXE or REXX.EXE, whichever you installed"
  28. 	say "                 - OS/2:     no need to specify, just rename script to *.cmd"
  29. 	say '        "number" is any decimal number ranging from 0..2147483647 (0x7FFFFFFF)'
  30. 	say
  31. 	say "Written by Rob van der Woude"
  32. 	say "http://www.robvanderwoude.com"
  33. 	Exit 1
  34. Return
  35.  

page last modified: 2024-04-16; loaded in 0.0186 seconds