[Stackoverflow] [Progress OpenEdge ABL] how to convert binary to octal in Progress 4GL?

Status
Not open for further replies.
A

Arifudin

Guest
Can you help me. if convert binary to octal anyone can help me..???

this code convert octal to binary. help me for change this code.


Code:
function oct2bin returns character ( input octalString as character ):

  define variable i      as integer   no-undo.
  define variable n      as integer   no-undo.
  define variable c      as character no-undo.
  define variable result as character no-undo.

  n = length( octalString ).

  if n < 2 or substring( octalString, 1, 1 ) <> "~\" then        /* a valid octalString begins with "\"                                */
    do:
      message "valid octal strings must begin with ~\".
      result = ?.
    end.
   else
    do i = 2 to n:

      c = substring( octalString, i, 1 ).

      if asc( c ) < 48 or asc( c ) > 55 then                        /* a valid octalString only contains the digits 0 thru 7        */
        do:
          message c "is not a valid numeric character".
          result = ?.
          leave.
        end.

Continue reading...
 
Status
Not open for further replies.
Top