binary increment by *yuko*(LF)

program-id.y.data division.working-storage section.
1 i pic 99.
1 s pic x(99).
procedure division.accept s.a.move 99 to i.b.if 0<>s(i:1)if i>1 add -1to i
go b.inspect s(i:)replacing all 0 by 1 1 by 0
display function trim(s)accept s
if 01111111<>s(9:)go a.display s(1:16)1.

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page