Úprava CSV (REXX (Regina-Win))

/* ============================================================ */
/* #22=" , #0D0A , #3B=; , #2C=,                                */
/* ------------------------------------------------------------ */
/* aktivacia dll kniznic (len na zaciatku)                      */
call rxfuncadd 'sysloadfuncs','RexxUtil','sysloadfuncs'
call sysloadfuncs
/* ============================================================ */
parse arg subor
CurDir = directory()
if subor = '' then exit
subor_in = CurDir||'\'||subor ||'_in'
subor_ou = CurDir||'\'||subor
'@call rename' subor||' '||subor||'_in'
/* kontrola existenie suboru + osetrenie chyby */
rc = SysGetFileDateTime( subor_in )
if rc = 2 then do
  call RxMessageBox 'Subor:('subor_in') NEEXISTUJE.', 'CHYBA !!!' /* hlasenie */
  exit /* predcasne ukoncenie prace */
end
start = 0
  if stream(subor_in, 'C', 'OPEN READ') == 'READY:' then do
    say TIME('N') ' Subor "'subor_in'" je OTVORENY'
    say ' Velkost sub. = 'chars(subor_in)
    /*stream(subor_in, 'C', 'OPEN WRITE')*/
    count = charout(subor_ou, X2C("22"), );
    do pozicia =1 to chars(subor_in)
      znak = charin(subor_in,pozicia,1)
      znak_hex = C2X(znak)
      select
        when znak_hex = 0D
          then do
            count = charout(subor_ou, X2C("22"), );
            count = charout(subor_ou, znak, );
          end
        when znak_hex = 0A
          then do
            count = charout(subor_ou, znak, );
            if chars(subor_in)>2 then do
              count = charout(subor_ou, X2C("22"), );
            end
          end
        when znak_hex = 3B
          then do
            count = charout(subor_ou, X2C("22"), );
            count = charout(subor_ou, X2C("2C"), );
            count = charout(subor_ou, X2C("22"), );
          end
        otherwise
            count = charout(subor_ou, znak, );
      end
    end
  end
  else do
    stream(subor_in, 'D')
    call RxMessageBox 'Subor:('subor_in') sa nepodarilo otvorit.', 'CHYBA !!!' /* hlasenie */
  end
  call stream subor_in ,'C','CLOSE'
  call stream subor_ou ,'C','CLOSE'
  say TIME('N') ' << ZATVORENY'
  Say " subor:" SysGetFileDateTime( subor_in )
  Say " > HOTOVO <"
  call syssleep 8
exit