#if defined(W32) || defined(LNX)

   .EBCDIC file support.

      (See also next section "EBCDIC translation" about CV cmd, XCV utility and EBCDIC cfg file)

      -EBCDIC encoded file is maintained as it is without translation to locale codepage.
       Hex display mode displays EBCDIC code.
       Use this function for the file downloaded from mainframe with no translation option
       or NFS mounted with no translation option.
       It is usefull when asccessing Linux/390 using sshfs(Dokan sshfs on windows)
       Unicode is used to display code, it enable to dispaly wider range of printable character.
       Default EBCDIC converter is CP930 on Japanese environment and CP037 on the other env.
       This env is local env, specify proper converter on EBCDIC cfg file if remote env is
       diffrent from local.
       And also try to select other than default charset on setup dialog of wxe
       if invalid glyph is displayed.

      -CPEB option is used for EDIt/SAVe/REPlace/CREate/APPend/CUT/END/COPy/MOVe/PASte cmd.
       IE option may be required if invalid EBCDIC code is contained.
       Indicater on header line is "=E" , and "=e" when binary mode.
         ex). "e file1 cpeb"
       When cfg file is not prepared or to use different codepage than defined on cfg file,
       use CPEB:codepage format.
         ex) "e file1 cpeb:IBM1047"
       Specify null like as "CPEB=" when back to cfg definition.
       xe accept max 7 codepages. xe can not recognize alias name.

       COPy/MOVe/PASte cmd inserts lines after translated from specified codepage to the encoding of th opened file.
       SAVe/REPlace/CREate/APPend/CUT/END cmd write lines after translated to the specified codepage.
         ex). "rep file2 cpeb nx ie"

       CPEB:codepage option is available for these cmd.
       Specified option on output cmd is registered to profile.
       COPy/MOVe/PASte cmd checks profile, so you may not be required to specify CPxx option.
       But naming may differ between ICU and iconv/Windows codepage.
       So, when you changed CONVERTER parameter of cfg file between ICU and not ICU,
       codepage name on profile may invalid.  Paste may fail in that case.
       Re-specify CPEB parameter on Edit cmd for these case.
       Even when CPEB is not spcified translation occures if codepage is registered to profile.
       Spevify "B"(Binary) suffix option if you do not want it.
       "B" option is not supported for UTF8 file as copy target.
       See "C"(Copy)/"M"(Move) lcmd for "B" suffix.

       Option specified to a directory is default for the file in the directory.
       To reset profile specify explicuitly other(CPLC/CPU8/CPAS) encoding option at open.
       EBCDIC codepage is displayed on the TopOfLine and EndOfLine.

       Cmd for write dose not update profile if translation error is detected,
       file is written upto EOF replacing those error character to substitution character.
       Substitution character depends to the codepage, you can change it by cfg parameter.
       Sometimes DBCS subchar is not defined, xe try to translate u-fffd, u-ff1f(DBCS "?"),u-3000(DBCS space)
       in this sequence the use it if available.

      -"C"/"M" line cmd also execute translation when codepage differs.
       Spevify "B"(Binary) suffix option if you do not want it.
       "B" option is not supported for UTF8 file as both copy source and copy target.
       Spaces by Tab expansion is dropped when copy from locale code file to EBCDIC file.
         {A|B}[B][C][n][,b][.s]
           A : After, B: Before, B : Binary Mode, C : Copy with CID
           n : repeat, b : bandle, s : skip
         ex)  c3
              :       Copy 3 lines After by Binary mode
              ab

      -"="(Compare) line cmd compares the line after translated if the codepage differs.
       (EBCDIC file is translated to UTF8/Locale coed then compared)
       Use "B" suffix to compare by binary code.
       Spaces by Tab expansion is ignored.
         =[B][n][,b][.s]
         ==[B]
         (supply "B" at any one of the line cmds)

      -CV cmd.

      -CV cmd B2M/M2B option is for CPLC(Locale code)file only.
       Cfg file is shared with EDIt cmd, -MFcfgfile option is discarded.
       CPEB:ebcdic-codepage parameter for B2M/M2B allows translation by out mapping cfg file specified on ini file.
       If CPEB is missing for the ebcidic file B2M uses the codepage of the opend file.
         ex) cv m2b cpeb:37
       Use B2B option to translate between different EBCDIC codepage.
         ex) cv b2b cpeb:1026
       B2B without SETCP option dose not change the codepage of current file, the file is displayed using original
       codepage.
       To change also the codepage itself, use SETCP option.
         ex) cv b2b cpeb:1026 SETCP

      -EBC cmd.

       EBC cmd also changes the codepage of the file.
         ex) EBC SETCP=CP935
       EBC cmd dose not change original code, but display the code according the codepage.
       So, close operation dose not write back to the file if there are no other modification to the file.
       Undo function restores SETCP effects of CV/EBC cmd.
       Codepage by SETCP option is registered to profile at close operation(not CANcel but END operation)
       Use "EBC SETCP=" to back to default codepage.

      -xcv utility.

         "m" of "m2b/b2m" is current codepage only, specify codepage for "b" using ebcmap file or -CPEB: option.
           ex) xcv -cm2b -cpeb:37 -mseteol localfile1  ebcfile1
         To translate to the different EBCDIC codepage, use B2B option.
           ex) xcv -cb2b -f:37 -t:1026 ebcfile1 -oebcfile2
         "-MF:" parameter is also required if use ICU converter. Specify CONVERTER=1 on the cfg file.
         Or spacify -ICU option.
           ex) xcv -cb2b -f:IBM037 -t:IBM1047 -mf:xeebc.map ebcfile1 ebcfile2
               xcv -cb2b -f:IBM037 -t:IBM1047 -ICU          ebcfile1 ebcfile2

      -EndOfLine-ID.
       Supports not only RecordMode but also Text mode by EndOfLineID of 0x15(EBCDIC-NL).
       Default of EBCDIC file is text mode.
       Following cmds has EOL related option. LRECL can be changed.
         EDIt/BROwse, END, CREate/REPlace, SAVe, COPy/MOVe.
       For SAVe cmd, new option is accepted when filename parameter is specified.
       For COPy/MOVe cmd Fxx option is LRECL of copy source file.
       RecordMod:On/Off and LRECL is saved to corresponding profile record,
       but EOL-ID is required each time.
           /M{t|p|u|m|e|r} /Fnn[-mm]
             e:EBCDIC-NL(0x15), r;RecordMode, nn:LRECL
       ex).
           e ebcf1 CPEB                        : EBCDIC file TextMode(EOL-ID=0x15)
           e ebcf1 CPEB  /mp                   : EBCDIC file TextMode(EOL-ID:0x0d0a)
           e ebcf1 CPEB  /mr /F72              : EBCDIC file RecordMode(LRECL=72)
                                                 Default LRECL is 80.
           end /mu                             : Change EOL-ID to 0x0a.
           end /mr /f80                        : Save as LRECL=80 RecordMode file(no EOL-ID).
           s ebcf1 CPEB /mr /F80               : translate (From PC file) to EBCDIC file.
                                                 Output is LRECL=80 RecordMode file.
           rep u8f1 nx CPU8 /mp                : translate (from RecordMode EBCDIC file) to UTF8 file.
                                                 EOL-ID:0x0d0a is appended to each line.

      -About DBCS
       Double Byte Character is indicated by SO(ShiftOut:0x0e) and SI(ShiftIn:0x0f) in EBCDIC.
       SO and SI enclose DBCS string. ex). 0e-40-40-0f is DBCS space.
       In other than EBCDIC, specific leading byte and some following bytes is combination of DBCS.
       Display width of DBCS is 2 column and it may be consists by 3 byte (EUC-SS3) or 3 byte(GB18030).
       ex). DBCS space is 81-40 in MS932.
       Accordingly translation between EBCDIC and Locale code changes line length if DBCS is contained.
       Option of treatement of SO/SI is prepared on translation cmd.
       Set default to cfg file.
       cfg option is applied to "C"opy line cmd which has no parameter for SI/SI option.
         ex).  COPy     file1 cpeb -sd       :Delete SO/SI from EBCDIC copy source file. Line length will shrink.
               COPy     file1 cpeb -sr       :SO/SI is replaced to one space.
               REPlace  file1 cpeb -sr       :SO/SI is inserted at translation to EBCDIC,
                                              but replace both side of space if avail.
               REPlace  file1 cpeb -si       :SO/SI is inserted simply. Line length will expand.
       Define default action on cfg file.
           SOSI_A2E      REP (="-sr") or INS ("=-si")
           SOSI_E2A      DEL (="-sd") or REP ("=-sr")

      -Codepage and translation option by cfg file.
         Specify cfg filename on INI file. Default is ::xeebc.cfg.
           EBCDIC_cfg        ="" #("::xeebc.map")# EBCDIC translation config filename
         Syntax is same as previously used for 3270 connection.
           Following option is added for non-3270 as alternative of option in xehosts file.
           This is for Windows/Japanese user with no external converter option only.
            SJIS_OPT  ENG_EXT      # Japanese English-Extension(CP939=CP1027)
            SJIS_OPT  KANA_EXT     # Japanese Katakana-Extension(CP930=CP290)
         -MF:mapfile option of CV cmd for B2M/M2B was discarded,
         CV cmd share mapping option specified on INI file.
         Default option when missing cfg file is as following.
           (Windows)
             Japanese :Codepage=CP930(Internal mapping table equivalent to Japanese-Katakana Extension), JIS83.
             else     :Codepage=CP037, No DBCS(SO/SI) consideration.
           (Linux)
             Japanese :Codepage=EUC-JP(Internal mapping table equivalent to Japanese-Katakana Extension), JIS83.
             else     :Codepage=CP037, No DBCS(SO/SI) consideration.
           Above default is used when CONVERTER=0 on cfg file, you can specify additional option
           such as SOSI,SJIS option.
           SOSI option is effective for CV cmd only, ignored for EDIt operation.

         (ex.)sample to use External(ICU/iconv) converter, Windows codepage.
               On Windows, you may have to add the EBCDIC codepage using
                 Control-Panel-->Region and Languages
               WindowsXP currently have no EBCDIC codepage supporting DBCS.
               So, CJK user may have to install ICU to use DBCS EBCDIC. (COVERTER=0 supports Japanese)
               To use ICU you may have to set PATH for DLL/so. Set PATH(LIBPATH is not used) or LD_LIBRARY_PATH.

               Codepage value on CHARSET statement varies by ICU/Windows/LinuxICONV.
               Confirm it using "uconv -l" (ICU) or "iconv -l".
               For codepage on Windows, check it by Control-panel-->Region and Language.

               -Use ICU SBCS.
                  CONVERTER          1
                  ICU_DLL_SUFFIX    44
                  ICU_API_SUFFIX   _44
                  SBCS_CHARSET     cp1047          //EBCDIC Latin/1 Open System(iso-8859-1)

               -Use ICU DBCS.
                  CONVERTER          1
                  ICU_DLL_SUFFIX    44
                  ICU_API_SUFFIX   _44
                  DBCS_CHARSET     cp1388          //chinese simplified. superset of cp935

               -Use Windows MultiByteToWideChar/WideCharToMultibute API.
                  CONVERTER          2
                  SBCS_CHARSET       20924        //EBCDIC Latin/1 Open System(1047+Euro)

               -Use Linux iconv API.
                  CONVERTER          2
                  SBCS_CHARSET       cp1047

         Translation of EndOfLine ID may not be preferable.
             EBCDIC NL(x15)-->u0085, LF(x25)-->u000a
             ASCII  LF(0x0a)-->EBC-15/EBC-25
         You can remap it as following.
             MAP_E2A  0x15: 0x0a   # EBCDIC 0x15(NL) -> ASCII 0a(LF)
             MAP_E2A  0x25: 0x3b   # EBCDIC 0x25(LF) -> ASCII "?"
             MAP_A2E  0x0a: 0x15   # EBCDIC 0x15(NL) <- ASCII 0a(LF)


      -CV cmd B2M/M2B option is for CPLC(Locale code)file only.
       To translate the file opened by CPEB option, use REP cmd.
       Cfg file is shared with EDIt cmd, -MFcfgfile option is discarded.
       xe display the file translated by CV cmd width B2M by the locale code,
       The file opened by CPEB option is displayed by Unicode.
       There may be difference in looks.

      -0x09 is not TAB (0x05:EBC-HT also is  not treated as TAB skip character).
       When Tab Key is pressed, TAB char(0x09,0x05) is not inserted into the line,
       but jump some columns even when INS mode.
      -HEX input mode(Ctrl+F11) send byte by byte(no DBCS consideration)
      -SO(0x0e)/SI(0x0f)(DBCS encloser) is displayed by alternative char "?".
       SO/SI is inserted when DBCS kbd input.
       For Cut&Paste DBCS re-evaluation is done each time.
       DBCS is even byte string enclosed by SO and SI.
       For ex, when paste EBCDIC line into UTF8/Locale code file,
       Translation will be done but unless SO/SI is not included in the pasteing data
       DBCS translation is not done and SBCS translation is done.
       When Joined 2 line split at DBCS position, DBCS may revive.
       TFLow cmd also join line but insert single space between the line joined,
       so DBCS may not revive.
       Invalid DBCS-EBCDIC is displayed by ":;", confirm the code by vertical hex line.
      -Binary mode by EB cmd or by the reason that file contains too may control char
       dose not consider DBCS. Use ET cmd for later case.
      -Find/Change cmd.
         Regardless of kbd mode is UTF8 or not, search and replace by EBCDI Code on EBCDIC file.
         No DBCS consideration for the file opened by binary mode.
         -g (Grep), P'.' option is not supported.
      - "#" line cmd(Execute cmd descripted on the line) is not supported.

#endif