Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 15th, 2012  |  syntax: None  |  size: 0.94 KB  |  hits: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to split input by ASCII control codes with Progress 4GL?
  2. def var c as char no-undo.
  3. def var i as int no-undo.
  4.  
  5. update c format "x(50)".
  6.  
  7. do i = 1 to length(c):
  8.     message substr(c, i, 1) = chr(29).
  9. end.
  10.        
  11. define variable bc as character no-undo format "X(50)".
  12.  
  13. update bc editing:
  14.   if lastkey = 313 then
  15.     apply ".".  /* 313 is the code for F13 */
  16.    else
  17.     apply lastkey.
  18. end.
  19.        
  20. /* create a test file (otherwise not needed...)
  21.  */
  22.  
  23. output to "barcode.dat".
  24. put control "240927140520" chr(29) "2120330017" chr(29) "100282".
  25. output close.
  26.  
  27. /* if you already have barcode.dat start here
  28.  */
  29.  
  30. define variable m  as memptr    no-undo.
  31. define variable bc as character no-undo.
  32.  
  33. set-size( m ) = 100.
  34. input from "barcode.dat" binary no-convert.
  35. import unformatted m.
  36. input close.
  37.  
  38. bc = get-string( m, 1 ).
  39.  
  40. display
  41.   entry( 1, bc, chr(29)) format "x(12)" skip
  42.   entry( 2, bc, chr(29)) format "x(12)" skip
  43.   entry( 3, bc, chr(29)) format "x(12)" skip
  44. .