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

   .TSO support.

          It is available to download,update then upload the file on TSO/E using tn3270+s3270+ind$file.
          Use this function if you favour although 3270-FTP response is slow a little bit.
          For a while you should try this function on your private DataSet.

     !!!  THERE IS NO WARRANTY IN THIS FREE SOFTWARE !!!
     !!!  NO LIABILITY FOR CONSEQUENTIAL DAMAGES.    !!!
          I'm not responsible for any DAMAGEs caused by using this software.

          Due to my environment, only Windows version was tested.
          And the logon procedure initialy calls ISPF primary options menu.
          Adjust logon procedure definition in xe3270.cfg if youre environment is
          native TSO READY mode

            (--For TurnkeyMVS--)
              "Turnkey MVS" is MVSR38J on PC("Hercules" emulates 370 instruction).
              This title line means the things for TurnkeyMVS only.

      (0) Prerequisite

            You have to install s3270.
            x3270/c3270/wc3270 is not available.
#ifdef W32
            This function use "s3270.exe" which runs under cygwin.
            You have to install cygwin.
#endif
            (--For TurnkeyMVS--)
              If you use x3270,install x3270 and setup xe3270.cfg to use x3270.
              When x3270 is used,you can see the x3270 screen,but xe loose the focus
              in some linux version. In that case you may minimize the x3270 window.
              #ifdef W32
                  You need to start X-server process before starting xe3270 if you use x3270.
                  (or else xe3270 fails by "Pipe Closed" or "Timeout")
              #endif

            You have to install also IND$FILE to MVS.
            Try IND$FILE cmd with no operand on TSO cmdline panel.

            APVUFILE supports DBCS(DoubleByteCharacterSet), but IND$FILE converts
            ASCII to EBCDIC byte bye byte.
            See (6) about DBCS environment,
            or if you have a problem of ASCII space(0x20) is not conveted to EBCDIC blank(0x40).

            (--For TurnkeyMVS--)
                Warning:ind$file106 returns "TRANS00file not opened"
                if HostFile D/S or member dose not exist, but ind$file111 wait infinitely.
                xe confirm the existance by LISTDS command in order to avoid infinite wait.

            At first,It is better to do connection test using s3270 alone as following.
              .Start s3270 with no operand.
              .Enter
                 connect hostname:23
                (--For TurnkeyMVS--)
                 connect hostname:3270
               Hostname is "localhost" etc. which is defined on hosts file
               (/etc/hosts or c:windows\system32\drivers\etc/hosts).
               Status line changed to indicate connected (4th char='C')?
               "ascii" command is used to see current screen.
               You can see logon prompt screen?
              .Logon procedure depends on youre environments.
               Keyboard-Input-Strings are entered by "String" cmd.
               For ex, to input "LOGON UID001", enter as following.
                 String "LOGON UID001\n"
               "\n" appended means Enter key, enter "Enter" on the next line if you did not appended it.
               If you requested password input, type also it using "String" cmd.
               If you want use PA1 to break REENTER prompt, enter as following.
                 PA(1)
               To use PF key, enter as following.
                 PF(3)

               (--For TurnkeyMVS--)
                  Enter like as following to logon
                   String "logon herc01\n"

              .Transfer is a cmd for FTP.
                 Transfer Direction=Receive HostFile=xxxx(yyy) LocalFile=zzz Exist=replace
               When transfer is executed, TSO is to be TSO READY mode.
               If, your environment, TSO LOGON PROCEDURE initially calls ISPF menu panel,
               enter "String =6\n" to change to command shell panel.

      (1) Setup for xe.
           .Define destination ID on "::xehosts" file(xehosts in xe's working directory).

            ex)  T4E     Heaven        HERC01  ""        TSO=23R
                 T4J     192.168.2.33  HERC02  password  TSO=23R  HOME='TEST.SRC.ASM'


            "TSO=" means target is 3270 and operand "23" specifies port number,
            usually it may be 23(telnet).
            "R" means destination is Real Mainframe.
            (xe's SUB cmd uses TSO SUBMIT cmd if "R" specified)

            (--For TurnkeyMVS--)
              Specify as TSO=3270.
              TunkeyMVS prepares submit tool to enable submit local file.
              If you did not setup for submit tool,specify TSO=3270S to use TSO SUBMIT cmd

            If missing "TSO=xxxx", target is tcpip:ftp remote such as linux.
            Host-id(first item) for TSO is case insensitive.
            Password is encrypted when saved.

            HOME is used to reduce DSN input.
            For example, "e h01:" opens the member list of the DataSet specified as HOME,
            "e h01:abc" opens the member.
            HOME can be changed temporarily by CD command.
            To restore original home enter "CD h02:''"
            You may register multiple hostID entry for each DataSet accessed repeatedly.
            But logon to TSO is userID by userID, you'|| see the same screen
            on remote shell even when different destination is used.

           .configure xe3270.cfg

            (Check it once after created or modified using xe3270 alone as following.
               xe3270 1 -wxxdir
             xxdir :directory of xe3270.cfg
             If no format error on xe3270.cfg,try logon from cmd prompt screen of xe3270.
               logon hostid,userid[/pswd]
             this hostid is not of xehosts but of OS hosts file.
            )
            The holding directory is specified by /W command line parameter of xe3270.
            When xe3270 is automatically started by xe that is workdir of xe(::xe3270.cfg).

            Define logon procedure etc.
            Especially to manipulate SPF information specify both SPF_LEVEL and CMD_MEMBLIST.
            Following options are defined for each destination.
              CMD3270, OPTIONS, LOGON_CMD, LOGOFF_CMD, LOGON_ERR, TEXT_PRELOGON, SUBMITWORK
            For ex. LOGON_CMD.T4E is for the destination T4E on xehosts.
            Without ".dest", it defines default.
            If you defined a option as destination specific, you should define the option wholely
            because any default definition lines are applied for the option.

              CMD3270      :Specify cmd for s3270 if that is not on PATH env or s3270 option is required.
                            Default is S3270.

              (--For TurnkeyMVS--)
                            To use x3270(-script option is required for xe)
                            #ifdef LNX
                                CMD3270 = "x3270 -script"
                            #else
                                CMD3270 = "bash c:\x3270script"
                                           c:\x3270script contents is as following
                                             DISPLAY=:0.0  x3270 -script
                            #endif

              OPTIONS      :
                            NOGETCONF :Because I met transfer-error with TurnkeyMVS, xe3270 download twice
                                       then check both is same.
                                       This is now option for TSO/E.
                            NOPUTCONF :By the same reason,download the uploaded file to confirm that is same as
                                       uploaded source file.
                                       NOPUTCONF option skips those process.
                            (With confirm option,detected error is register on ::xe3270ftp.errlog with append mode.
                             For a while,you would be better to do with confirm option and check errlog)
              TEXT_PRELOGON:String to detect VTAM LOGON prompt screen.
                            xe3270 starts its logon procedure if found this string.
                            Without this option, when TSO session was lost by x22 ABEND,
                            you will get UNSUPPORTED FUNCTION error msg.
              LOGON_CMD    :defines xe3270 logon procedure.
                            Without this option,xe enter as following
                              logon %userid%/%pswd%\n
                              (%userid% and %pswd% is replaced by those of defined on ::xehosts)
                            xe3270 execute these line sequentially.
                            Each line format is
                              Input string[,String to be detected[,Retry count]]
                            If "String to be detected" is specified and not found after "Retry count" snap
                            of screen, logon procedure terminate.
                            Default of retry count is 8 and it means about 3 seconds(sum of 100 to 700ms)
                            Append "\n" at last of string,that means Enter key.
                            For ex,  LOGON_CMD = "LOGON %user%\n"
                            You can specify 3270 Actions(3270 cmd) using "Action" prefix.
                            For ex.
                              LOGON_CMD = "Action MoveCursot(6,10)"
                            For only Enter action, you can omit action prefix.
                              LOGON_CMD = Enter
                            See manuals of s3270,x3270-script for the other actions such as EraseEOF, Attn.
                            If you want to fill multiple fields,omit last \n.
                            After moving on the screen using Home, Tab etc. action,
                            use Enter action finally.
                            s3270 supports also \t(TAB) and \r(Newline) \f(Clear).
                              ABC\t123\rXYZ\n
                            This is same as
                              ABC ; Action TAB ; 123 ; Action Newline ; XYX ; Enter
                            Use "Sleep" xe's action to avoid timing problem.
                            To wait 5 seconds
                              LOGON_CMD ="Sleep 5000"[,string[,retry]]

                            About prefix "|" of the message to be checked, see Ex-2.

                            Ex-1. (The case of not TSO READY mode)

                              LOGON_CMD = "Action Reset"           # For the case protection error status
                              LOGON_CMD = "Action Clear"           # confirm string input availability
                              LOGON_CMD = "APP TSO4\n",IKJ56700A   # Input on VTAM prompt panel
                                                                   # After input "APP TSO4", wait "IKJ56700A" appears.
                                                                   # (IKJ56700A ENTER USERID)
                              LOGON_CMD = %user%\n,"TSO/E LOGON"   # Input user id.
                                                                   # %user% is replaced by userid defined on xehosts.
                                                                   # Wait "TSO/E LOGON" appears.
                                                                   # "TSO/E" the string in the panel prompting input password
                                                                   # in my environment.
                              LOGON_CMD = %pswd%\n,ICH70001I       # %pswd% is replaced by password on xehosts.
                                                                   # Wait "ICH7001I ... LAST ACCESSED ..." appears.
                              LOGON_CMD = Enter,ISPF,3             # Press Enter key.
                                                                   # Wait ISPF primary options menu panel.
                                                                   # Retry screen check 3 times inserting 10mms sleep.
                              LOGON_CMD = "=6\n"                   # change to command shell panel

                            Ex-2. (DIALOG ERROR case when s3270 is not enable-DBCS and HOST SPF is DBCS panel)

                              LOGON_CMD = "Action Reset"           # For the case protection error status
                              LOGON_CMD = "Action Clear"           # confirm string input availability
                              LOGON_CMD = "APP TSO4\n",IKJ56700A
                              LOGON_CMD = %user%\n,"TSO/E LOGON"
                              LOGON_CMD = %pswd%\n,ICH70001I
                              LOGON_CMD = Enter,"|ISPF DIALOG ERROR" #error caused by DBCS environment
                                                                     #but changes to native TSO READY mode by Enter key.
                                                                     #prefix "|" means that it is not logon-fail
                                                                     #when the msg is not found,
                                                                     # and continue to next procedure.
                              LOGON_CMD = Enter,READY               #change to native TSO READY mode by Enter key.
                                                                    #any TSO cmd cause disconnection in this status.
                              LOGON_CMD = ISPF\n,"OPTION ===>"      #but ISPF is only avalable cmd,
                                                                    #change to english mode ISPF primary options menu panel.
                              LOGON_CMD = "=6\n","COMMAND SHELL"    #change to command shell panel.

            LOGOFF_CMD     :define xe3270 LOGOFF procedure.
                            these are same as LOGON_CMD option.
                            If LOGOFF procedure is not defined,
                            xe enters PA(1) then after detected "READY", enter "logoff\n".

                            (--For TurnkeyMVS--)
                              PA1 breaks RPF and "READY" appears, but

                            PA1 may not break ISPF then unsupported cmd error may occur.

                            Ex-1. (Automatically disconnected when exit from ISPF)
                              LOGOFF_CMD = "=X\n","*** VTAM"        #Set LOG/LIST option to bypass the LOG/LIST option input panel.
                                                                    #detect VTAM LOGON prompting panel

                            Ex-2. (define LOG/LIST panel input)
                              logoff_cmd       = "=X\n",BATCH       #detect LOG/LIST option input panel
                              logoff_cmd       = "2\n","*** VTAM"   #Input LOG/LIST option,then wait ISPF exit.

            LOGON_ERR      :defines error message to be detected in LOGON procedure and related actions.
                            define 3270 action without "Action" unlike procedure definition.
                            actions are concatinated using separator ";".
                            Action "CONTINUE" is psude action to do action when the string was detected.
                            The string is not the error indication but continue to the next procedure.
                            In the next example, if "HIT THE ENTER KEY" is detected,
                            do the action "Enter" the continue to next procedure.
                            Prefix "_" means that the string is checked if LOGON_CMD string is not found.
                            Widthout "_", the string is checked before LOGON_CMD string.
                            (LOGON fail if both LOGON_CMD and LOGON_ERR string are detected)
                            Ex.
                              LOGON_ERR = IKJ56425I,"logoff\n"      #USERID IN-USE
                                                                    #reply LOGGOFF for "ENTER LOGON OR LOGOFF".
                              LOGON_ERR = IKJ56420I,"Action PF(3)"  #USERID NOT AUTHORIZED
                                                                    #PF3 means LOGOFF in the panel of sample case.
                              LOGON_ERR = IKJ56421I,"Action PF(3)"  #PASSWORD NOT AUTHORIZED
                              LOGON_ERR = IKJ56447I,"Action PF(3)"  #REENTER THE NEW PASSWORD ... FOR VERIFICATION
                              LOGON_ERR = IKJ56415I,"Action PF(3)"  #CURRENT PASSWORD HAS EXPIRED
                              LOGON_ERR = IKJ56710I,"Action PA(1);logoff\n"  #break by PA1 for the case "INVALID USERID REENTER"
                              LOGON_ERR = "_HIT THE ENTER KEY","Enter;Continue"       #

            RETRY_UPLOAD   :read-check retry count when read check after put failed (without NOPUTCONFORM option)
                            Max:4 Min:0 Default:2
            RETRY_DOWNLOAD :read retry count when dual read unmatch (without NOGETCONFIRM option)
                            Max:4 Min:0 Default:2
            SPF_LEVEL      :process level of SPF information of PDS members.
                            0:CMD_MEMBLIST is not used. TSO LISTDS is used to get member list.
                            1:SPF info is displayed on dir-list using XE4S001Z
                            2:SPF info is maintenanced using XE4S001Z
                            default is 0 without CMD_MEMBLIST or 2 with CMD_MEMMLIST specified
            CMD_MEMBLIST   :TSO command to get PDS memberlist
                            Default is TSO native "LISTDS" command
                            Specify you LibraryDataSet name if you use XE4S001Z prepared by xe package.
                            Ex.
                              CMD_MEMBLIST  = "call 'TEST01.load.asm(xe4s001z)'"
            PS_UPLOAD      :Allow DSNAME as upload target
                            1:allow 0:prohibit(default)
                            I worried about "1" may accidentaly cause corruption of PDS directory.
                            But when transfer target is DSNAME of PDS, it may be rejected by
                              TRANS17   Missing or incorrect TSO data set name: file transfer canceled
                            PS_UPLOAD=1 may have no problem.
            RSH_ECHO       :Echo output to RSH screen to also xe3270 screen.
                            1:Echo ON(Default),  0:Echo OFF.
                            No echo option makes better response of such as cursor move action.
            TIMEOUT_CONNECT:timeout to get 3270 connection by seconds
                            commandline parm -C override this cfg parm
                            -1:infinite, default=10
            TIMEOUT_LOGON  :timeout to LOGON after 3270 connection succeeded.
                            -1:infinite, default=5
            TIMEOUT_LOGOFF :timeout to LOGOFF.
                            -1:infinite, default=3
            TIMEOUT_DISCONN:timeout to disconnect after LOGOFF.
                            -1:infinite, default=3
            TIMEOUT_FTP    :timeout to file Send/Receive
                            commandline parm -T override this cfg parm
                            -1:infinite, default=600sec(10 min).
            TIMEOUT_TSOCMD :timeout to TSO cmd such as RENAME,ALLOC,FREE by xe's TSO cmd.
                            -1:infinite, default=30
            CMD_ROW        :Command input line of ISPF command shell panel.
                            default=6 (start from 1)
            CHARSET_CFG    :Conversion parameter file when use external converter such as ICU/iconv.
                            (See "EBCDIC translation")

            Ex). ("#" on the top of line means comment line)
            #####################################################################
            # xe3270.cfg
            #          Following options may be destination specific by the format of OPT.dest=xxxx.
            #            CMD3270, OPTIONS, LOGON_CMD, LOGOFF_CMD, LOGON_ERR, TEXT_PRELOGON, SUBMITWORK
            #          For ex. LOGON_CMD.T4E is for the destination T4E on xehosts.
            #          That is default if destination specified.
            #
            #     CMD3270        :cmd to call 3270(enclose by quotation if optional parameter required)
            #                     default is s3270
            #                       To use x3270 on TurnkeyMVS -script option is required for xe.
            #                         Windows example
            #                           CMD3270 = "bash c:\x3270script"
            #                             c:\x3270script contents is as following
            #                               DISPLAY=:0.0  x3270 -script
            #                         Linux example
            #                           CMD3270 = "x3270 -script"
            #     OPTIONS        : NOGETCONF:bypass confirmation procedure to download twice then compare.
            #                    : NOPUTCONF:bypass confirmation procedure to download after upload then compare.
            #                      ex) OPTIONS=NOGETCONF,NOPUTCONF
            #     TEXT_PRELOGON  :String to detect VTAM LOGON prompt screen.
            #                     Start logon procedure when this string is found on the screen.
            #                     ex) TEXT_PRELOGON="Welcome to MVS3.8J"    # Turnkey-MVS VTAM panel detection
            #     LOGON_CMD      :defines xe3270 logon procedure.
            #                     Each line format is
            #                       Input string[,String to be detected[,Retry count]]
            #
            #                       ex)  LOGON_CMD = "LOGON %user%\n",ICH70001I
            #                       %user% and %pswd% is replaced by those defined on ::xehosts.
            #                       \n:Enter, \r:Newline, \t:Tab, \f:Clear
            #                     You can specify 3270 Actions(3270 cmd) using "Action" prefix.
            #                       ex)  LOGON_CMD = "Action Home"
            #                     To insert timing sleep,
            #                       ex)  LOGON_CMD ="Sleep 5000".
            #
            #
            #     LOGOFF_CMD     :define xe3270 LOGOFF procedure.
            #                     same format as LOGON_CMD
            #                       ex) LOGOFF_CMD = "=X\n","*** VTAM"
            #     LOGON_ERR      :defines error message to be detected in LOGON procedure and related actions.
            #                       ex) LOGON_ERR = IKJ56420I,"Action PF(3)"  #USERID NOT AUTHORIZED
            #               Ex. (in my environment)
            #                 LOGON_ERR = IKJ56425I,"logoff\n"        #REJECT BY ALREADY LOGON
            #                 LOGON_ERR = IKJ56420I,"Action PF(3)"    #REJECT BY USERID NOT AUTH
            #                 LOGON_ERR = IKJ56421I,"Action PF(3)"    #REJECT BY PSWD   NOT AUTH
            #                 LOGON_ERR = IKJ56447I,"Action PF(3)"    #REENTER THE NEW PASSWORD ... FOR VERIFICATION
            #                 LOGON_ERR = IKJ56415I,"Action PF(3)"    #CURRENT PASSWORD HAS EXPIRED
            #                 LOGON_ERR = IKJ56710I,"Action PA(1);logoff\n"  #invalid userid reenter
            #     RETRY_UPLOAD   :read-check retry count when read check after put failed.
            #                     Max:4 Min:0 Default:2
            #     RETRY_DOWNLOAD :read retry count when dual read unmatch
            #                     Max:4 Min:0 Default:2
            #     SPF_LEVEL      :process level of SPF information
            #                     0:CMD_MEMBLIST is not used.
            #                     1:SPF info is displayed on dir-list using XE4S001Z
            #                     2:SPF info is maintenanced using XE4S001Z
            #                     default is 0 without CMD_MEMBLIST or 2 with CMD_MEMBLIST specified
            #     CMD_MEMBLIST   :TSO command to get PDS memberlist
            #                     Default is TSO native "LISTDS" command
            #                     Specify you LibraryDataSet name if you use XE4S001Z prepared by xe package.
            #                       ex)  CMD_MEMBLIST  = "call 'herc01.load.asm(xe4s001z)'"
            #     PS_UPLOAD      :Allow DSNAME as upload target
            #                     1:allow 0:prohibit(default)
            #                     "1" may accidentaly cause corruption of PDS directory.
            #     RSH_ECHO       :Echo output to RSH screen to also xe3270 screen.
            #                      1:Echo ON(Default),  0:Echo OFF.
            #     CHASET_CFG     :FTP translation parameter filename
            #
            #     TIMEOUT_CONNECT:timeout to get 3270 connection by seconds
            #                     commandline parm -C override this cfg parm
            #                     -1:infinite, default=10
            #     TIMEOUT_LOGON  :timeout to LOGON after 3270 connection succeeded.
            #                     default=5
            #     TIMEOUT_LOGOFF :timeout to LOGOFF.
            #                     default=3
            #     TIMEOUT_DISCONN:timeout to disconnect after LOGOFF.
            #                     default=3
            #     TIMEOUT_FTP    :timeout to file Send/Receive
            #                     commandline parm -T override this cfg parm
            #                     default=600
            #     TIMEOUT_TSOCMD :timeout to file Send/Receive
            #                     -1:infinite, default=30
            #     CMD_ROW        :Command input line of ISPF command shell panel.
            #                     default=6 (start from 1)
            #####################################################################
             CMD3270.T4J     = "s3270 -charset japanese-939 -km windows-932 -trace -tracefile c:\xe_wd\s3270.trc"
             CMD3270.T4E     = "s3270 -trace -tracefile c:\xe_wd\s3270.trc"
             CMD3270         = s3270
             OPTIONS         = NOPUTCONF,NOGETCONF
            #RETRY_UPLOAD    = 2
            #RETRY_DOWNLOAD  = 2
             SPF_LEVEL       = 2
             CMD_MEMBLIST    = "call 'sak01.load.asm(xe4s001z)'"
             PS_UPLOAD       = 1                    #allow upload to dataset without member specification
             RSH_ECHO        = 0                    #no echo to xe3270 for input from RSH
             charset_cfg     = c:\xeebc.map
            #######
            #text_prelogon   ="Welcome to MVS3.8J"    # Turnkey-MVS VTAM panel detection
            text_prelogon      ="*** (T4)"            #VTAM panel detection
            text_prelogon      ="UNSUPPORTED FUNCTION"  #VTAM panel detection
            ###### LOGON procedure for the case initialy ISPF panel opened #########
            #
               LOGON_CMD.t4j = "Action Reset"           # Reset protection error status
               LOGON_CMD.t4j = "Action Clear"           # confirm string input availability
               LOGON_CMD.t4j = "APP TSO4\n",IKJ56700A   # Input on VTAM prompt panel
                                                    # After input "APP TSO4", wait "IKJ56700A" appears.
                                                    # (IKJ56700A ENTER USERID)
               LOGON_CMD.t4j = %user%\n,"TSO/E LOGON"   # Input user id.
                                                    # %user% is replaced by userid defined on xehosts.
                                                    # Wait "TSO/E LOGON" appears.
                                                    # "TSO/E" the string in the panel prompting input password
                                                    # in my environment.
               LOGON_CMD.t4j = %pswd%\n,ICH70001I       # %pswd% is replaced by password on xehosts.
                                                    # Wait "ICH7001I ... LAST ACCESSED ..." appears.
               LOGON_CMD.t4j = Enter,ISPF,3             # Press Enter key.
                                                    # Wait ISPF primary options menu panel.
                                                    # Retry screen check 3 times inserting 10mms sleep.
               LOGON_CMD.t4j = "=6\n"                   # change to command shell panel
            #
            ## DIALOG ERROR case when s3270 is not enable-DBCS and HOST SPF is DBCS panel(for Japanese user)
            #
               LOGON_CMD.t4e = "Action Reset"           # Reset protection error status
               LOGON_CMD.t4e = "Action Clear"           # confirm string input availability
               LOGON_CMD.t4e = "APP TSO4\n",IKJ56700A
               LOGON_CMD.t4e = %user%\n,"TSO/E LOGON"
               LOGON_CMD.t4e = %pswd%\n,ICH70001I
               LOGON_CMD.t4e = Enter,"|ISPF DIALOG ERROR",3 #error caused by DBCS environment
                                                            #but changes to native TSO READY mode by Enter key.
                                                            #prefix "|" means that it is not logon-fail
                                                            #when the msg is not found,
                                                            # and continue to next procedure.
               LOGON_CMD.t4e = Enter,READY,3               #change to native TSO READY mode by Enter key.
                                                       #any TSO cmd cause disconnection in this status.
               LOGON_CMD.t4e = ISPF\n,"OPTION ===>"        #but ISPF is only avalable cmd,
                                                       #change to english mode ISPF primary options menu panel.
               LOGON_CMD.t4e = "=6\n","COMMAND SHELL"      #change to command shell panel.
            #define action if detected error msg in logon procedure
             LOGON_ERR   = IKJ56425I,"logoff\n"            #REJECT BY ALREADY LOGON
             LOGON_ERR   = IKJ56420I,"Action PF(3)"        #REJECT BY USERID NOT AUTH
             LOGON_ERR   = IKJ56421I,"Action PF(3)"        #REJECT BY PSWD   NOT AUTH
             LOGON_ERR   = IKJ56447I,"Action PF(3)"        #REENTER THE NEW PASSWORD ... FOR VERIFICATION
             LOGON_ERR   = IKJ56415I,"Action PF(3)"        #CURRENT PASSWORD HAS EXPIRED
             LOGON_ERR   = IKJ56710I,"Action PA(1);logoff\n"  #invalid userid reenter
             LOGON_ERR = "_HIT THE ENTER KEY","Enter;Continue"       #
            ##
            #define logoff procedure
            ## for the case that Automatically disconnected when exit from ISPF
             LOGOFF_CMD = "Action Home"            #move cursor to home position
             LOGOFF_CMD = "Action EraseEOF"        #enable to input string
             LOGOFF_CMD = "=X\n","*** VTAM",3      #Set LOG/LIST option to bypass the LOG/LIST option input panel.
            #                                      #detect VTAM LOGON prompting panel
            ##SPF LOG/LIST option set required case
            #logoff_cmd    = "=X\n",BATCH       #detect LOG/LIST option input panel
            #logoff_cmd    = "2\n","*** VTAM"   #Input LOG/LIST option,then wait ISPF exit.
            #
            #TIMEOUT_CONNECT = 20
             TIMEOUT_LOGON   = 20
             TIMEOUT_LOGOFF  =  5
            #TIMEOUT_FTP     = 600
            #TIMEOUT_TSOCMD  = 60
            #CMD_ROW         =6
            #####################################################################

           .Install XE4S001Z
            XE4s001Z is required if you want to display SPF information
            (userid,timestamp,line count) on dir-list
            and to update after edit.
            Assemble XE4S001Z then put LoadModule to a Library.
            Then configure CMD_MEMBLIST parameter of xe3270.cfg.
            Referencing MACLIB is as follows(SP macros are used).
              // EXEC PGM=IFOX00,PARM='...,SYSPARM=NOSNAP',...
              //SYSLIB   DD   DSN=SYS2.MACLIB,DISP=SHR
              //         DD   DSN=SYS1.MACLIB,DISP=SHR
              //         DD   DSN=SYS1.AMODGEN,DISP=SHR
            (SYSPARM=NOSNAP is required to make ULSNAP debug macro to NOP)
            Or, try to LKED appended OBJECT.
            Upload XE4S001Z.obj by binaly mode of LRECL=80,then execute LKED.

              //TESTLKED  PROC MBR=                                                   00040000
              //********************************************************************//00050000
              //*            LKED                                                  *//00060000
              //********************************************************************//00070000
              //********************************************************************//00127000
              //*            LINK EDIT ( AMODE=31,RMODE=ANY )                      *//00128000
              //********************************************************************//00129000
              //LKED   EXEC  PGM=IEWL,                                                00130000
              //       PARM='LET,LIST,MAP,XREF,RENT'                                  00140001
              //SYSLMOD  DD  DISP=SHR,DSN=TEST.SAK.LOAD(&MBR)                         00170000
              //SYSUT1   DD  DSN=&&SYSUT1,UNIT=SYSDA,                                 00180000
              //             SPACE=(1024,(200,50),,CONTIG,ROUND),DCB=BLKSIZE=1024     00190000
              //SYSPRINT DD  SYSOUT=*                                                 00200000
              //SYSLIN   DD DISP=OLD,DSN=TEST.SAK.OBJ(&MBR)                           00211000
              //         PEND                                                         00220000
              //SS1 EXEC TESTLKED,MBR=XE4S001Z COND=ONLY                              00230000
              //*                                                                     00260000

              (--For TurnkeyMVS--)
                How to install load module XE4S001Z from aws tape.
                  -Vary tape unit to ONLINE from MVS console.
                     V 480,ONLINE
                  -Submit XE4S001Z.jcl
                   use tool "sub" embedded with TurnkeyMVS,
                   or Submit from TSO after send to MVS using 3270FTP.
                   (modify DSNAME of //DD2. aws tape is created as BLKSIZE=19069)
                  -mount tape unit after request msg issued on MVS console.
                   Enter as following from HERCULES console.
                     devinit 480 (path)XE4S001Z.aws
                     path:directory path of XE4S001Z.aws on your PC.
                Refer MAKEAWS.jcl to make aws tape if you modified and re-assembled XE4S001Z.


      (2) Access TSO.

        (2-1) FTP.
            Specify TSO destination ID on Edit/Browse command etc.

            ex)  e h02:'herc01.source.asm(memb1)'
                 e herc01:source.asm(memb1)

            At the first access to TSO, "xe3270.exe" is started which help communication
            between xe and 3270 emulator.
#ifdef LNX
            Terminal emulator on which xe3270 start is set by ini file.
            Default is determined by searching gnome-terminal,konsole and xterm in this sequence.
#endif
            NamedPipe with multiple instances is used to communicate with xe.
            Thread starts for each target(system + TSO-UserID) and communicate with
            3270 emulator process by stdin/stdout redirection pipe.
            This allows that multiple xe use same TSO-UserID and one xe session use
            multiple TSO-UserID.
            Even after xe ended, xe3270.exe remains active and wait next request from xe.
            You can check the status in DOS-prompt window of xe3270.exe.
            Optionally(/F parm of xe) those are logged in "::xe3270.log" file.

            New command xe's "TSO" supports to handle communication trouble.

            Same command but different syntax can be entered through xe3270 DOS prompt screen,
            Use 3270 cmd such as String,Enter,PA(1) etc. on the screen
            to respond to 3270 prompt such as ENTER-,REENTER-.

        (2-2) Remote Shell.

         (a) You can switch =6 panel to TSO mode. In TSO mode native MVS TSO command
             such as "listalc" is entered without xe's TSO command prefix.

             =6.xxx [FS3|FST|NFS]
                xxx :destination defined on ::xehosts.
                FS3 :start by 3270 keyboard mode of following (b).
                FST :start by TSO keyboard mode of following (c).
                NFS :not fullscreen mode.
                Default is same as  "TSO xxx: logon FS".

             Without FS(FullScreen) option, only response msg lines are displayed.
             The remote shell initially starts with CAPs ON.
             (But letter just after "\" is back to lowercase
              for the case such as \n is alternative of Enter key input)
             Ascii/Snap command displays current 3270 screen.
             Screen is protected when Fullscreen mode.
             Logoff command switches back to local command mode.
             ("TSO xxx logoff"  xxx:destination)

             Not the same opration as real SPF panel,taking some labor,
             you can constrol ISPF panel.
             Input strings on the cursor position and s3270 Action commands
             are entered from command line of xe's panel.
             xe check at first the string on command input line,
             and process it if it is defined as xe's command.
             To input strings duplicated with xe's cmd,
             use ">" prefix for TSO/s3270 input.
             String enclosed by double quotation is input to TSO,
             String with "Action" prefix is input to s3270.

             For ex. "exec" TSO command is duplicated to xe's EXEcute cmd.
             Enter as following to send to TSO.
               >exec 'herc01.source.clist(helloc)'\n
             "=2" is xe's =2, but
               >=2\n
               "=2\n"
             are types on TSO screen.
               Action Home
               >Action Home
               >>Home
             are s3270 Action cmd.

             You can omit "Action" preffix for the following actions,
             and xe supports abridged cmd.
             Action cmds are case insensitive.
             ex) eraseeof
                 EEOF
                 >EEOF
                 >>H
                 >>D
                 >Ins

             Some letters are alternative of key typing in the string input.
               Enter : \n,  TAB : \t,  Newline : \r,  Clear : \f

               Action         Abridge  Function
               -------------  -------  -------------------------------------
               "Attn"         "Att"    //attention key
               "BackSpace"    "BS"     //move cursor left (or send ASCII BS)
               "BackTab"      "BT"     //tab to start of previous input field
               "CircumNot"    "Not"    //input "^" in NVT mode, or "?"(Not sign) in 3270 mode
               "Clear"        ""       //clear screen
               "DeleteField"  "DF"     //delete the entire field
               "Delete"       "DC"     //delete character under cursor (or send ASCII DEL)
               "Down"         ">D"     //move cursor down
               "Enter"        ""       //Enter AID (or send ASCII CR)
               "EraseEOF"     "EEOF"   //erase to end of current field
               "EraseInput"   "EINP"   // erase all input fields
               "Erase"        "ERA"    //erase previous character (or send ASCII BS)
               "FieldEnd"     "FEND"   //move cursor to end of field
               "HexString"    "Hex"    //(hex_digits) insert control-character string
               "Home"         ">H"     //move cursor to first input field
               "Insert"       ""       //set insert mode
               "Key"          ""       //(keysym) insert key keysym
               "Left"         ">L"     //move cursor left
               "MoveCursor"   "MVC"    //(row, col) move cursor to (row,col)
               "Newline"      "NL"     //move cursor to first field on next line (or send ASCII LF)
               "PA"           ""       //PA n/PA(n)  Program Attention AID (n from 1 to 3)
               "PF"           ""       //PF n/PF(n)  Program Function AID (n from 1 to 24)
               "Reset"        "Res"    //reset locked keyboard
               "Right"        ">R"     //move cursor right
               "String"       "Str"    //(string) insert string (simple macro facility)
               "SysReq"       "Sys"    //System Request AID
               "Tab"          ""       //move cursor to next input field
               "ToggleInsert" "Ins"    //toggle insert mode
               "Transfer"     "FTP"    //(option=value...) file transfer
               "Up"           ">U"     //move cursor up

               (Note). Sor far there is no way to detect Insert-mode-status.
                       So, Insert key is assigned to ToggleIsert.

             In TSO mode local command can be entered by prefixing ":"
             For example,":grep ABC *.c".

         (b) You can change keyboard mode to 3270 like.

               3270---*::SO1 T4E:(128.101.207.9) ------------------------------- 001-(   5)-102=Ins
               ===>                                                                       ===>HALF
               10:21:35 ===>> PF(3)
                  MENU  UTILITIES  COMPILERS  OPTIONS  STATUS  HELP

                                           ISPF PRIMARY OPTION MENU
                OPTION ===>

                0  SETTINGS      TERMINAL AND USER PARAMETERS            User ID . : USER002
                1  VIEW          DISPLAY SOURCE DATA OR LISTINGS         Time. . . : 10:20
                2  EDIT          CREATE OR CHANGE SOURCE DATA            Terminal. : 3277KN
                3  UTILITIES     PERFORM UTILITY FUNCTIONS               Screen. . : 1
                4  FOREGROUND    INTERACTIVE LANGUAGE PROCESSING         Language. : ENGLISH
                5  BATCH         SUBMIT JOB FOR LANGUAGE PROCESSING      Appl ID . : XXX
                6  COMMAND       ENTER TSO OR WORKSTATION COMMANDS       TSO logon : TSOLPS2
                7  DIALOG TEST   PERFORM DIALOG TESTING                  TSO prefix: USER002
                8  LM FACILITY   LIBRARY ADMINISTRATOR FUNCTIONS         System ID : T4E1
                9  IBM PRODUCTS  IBM PROGRAM DEVELOPMENT PRODUCTS        MVS acct. : **NONE**


                     ENTER X TO TERMINATE USING LOG/LIST DEFAULTS




               U F U C(128.101.207.9) I 4 24 80 3 13 0x0 -
               ok
               ********** END OF FILE *********************************************************

             Alt+z is assigned to hotkey as default.
             Press again to back to xe's keyboard mode.
             "3270" at top-left corner indicates 3270 mode.
             Following table is key and 3270 function.
             These ae little bit different from PCOM defualt
             for the co-operation with xe.
             For ex, "Attn" is by Shift+Esc, cursor movement by Shift+arrow-key.
             Screen is protected, input from command input line.
             Strings on cmd line is send to TSO by Enter key.
             xe check at first the input string, and process it
             if it is cmd defined to xe.
             For ex,
               HEX                   : xe's HEX cmd
               >HEX , "HEX"          : HEX is send to TSO
               >>HEX                 : >HEX is send to TSO
             To input 3270 action, use Alt+a key after input action on cmd line.

             ISPF accepts TSO cmd only on the command shell panel,
             so xe issues "=6" internally.
             Panel may changed under the ground you are operation on remote shell panel.

             (--For TurnkeyMVS--)

               RPF has panels on which "=6" (2 letters) could not be input.
               xe dose not issue "=6".
               Use FTP/LISTC on READY mode screen, and use another userID
               to operate on RPF panel.

             3270mode key and function.
             +----------------------------------------------------------------+
             | Key      ||(No modifier)|Shift+      | Alt+        | Ctrl+     |
             |----------||-------------|------------|-------------|-----------|
             | Enter    ||Enter/NewLine|            |             |           |
             | R-Ctrl   ||Enter/NewLine|            |             |           |
             | Esc      ||             |Attn        |SysReq       |           |
             | Tab      ||Tab          |BackTab     |             |           |
             | BackSpace||Erase        |            |             |           |
             | a        ||             |            |Action       |           |
             | c        ||             |            |Reset        |           |
             | q        ||             |            |(TSO-kbd)    |           |
             | r        ||             |            |NewLine      |           |
             | Insert   ||ToggleInsert |            |PA(1)        |           |
             | Delete   ||Delete       |            |             |DeleteWord |
             | Home     ||Home         |            |PA(2)        |           |
             | End      ||EraseEOF     |DeleteField |EraseInput   |           |
             | Left     ||             |Left        |PreviousWord |           |
             | Right    ||             |Right       |NextWord     |           |
             | Up       ||             |Up          |             |           |
             | Down     ||             |Down        |             |           |
             | PgUp     ||             |            |PA(3)        |           |
             | F1       ||PF(1)        |PF(13)      |             |           |
             | F2       ||PF(2)        |PF(14)      |             |           |
             | F3       ||PF(3)        |PF(15)      |             |           |
             | F4       ||PF(4)        |PF(16)      |             |           |
             | F5       ||PF(5)        |PF(17)      |             |           |
             | F6       ||PF(6)        |PF(18)      |             |           |
             | F7       ||PF(7)        |PF(19)      |             |           |
             | F8       ||PF(8)        |PF(20)      |             |           |
             | F9       ||PF(9)        |PF(21)      |             |           |
             | F10      ||PF(10)       |PF(22)      |             |           |
             | F11      ||PF(11)       |PF(23)      |             |           |
             | F12      ||PF(12)       |PF(24)      |             |           |
             +----------------------------------------------------------------+

             (Note). Right-Ctrl key option changes the function of Enter key
                     and R-Ctrl key.
                     For other keys,basically xe process the key when
                     strings are  remains on command input line.

                     Enter/Rctrl:For execute function,xe process the string
                                 if cursor is on the cmd input line and data remains on the line.
                     Home       :jump to xe's home is cursor is not on there.
                     BackSpace  :xe process the key if cursor is on the cmd input line
                                 but not on home position
                     Ins/Del/End:xe process the key if cursor is on the cmd input line
                                  and data remains on the line.

         (c) By Alt+q on 3270 mode, keyboard changes to more TSO specific mode.

             Typed character is sent to 3270 immediately,
             Alt+a(Action cmd input) is not usable.
             Cursor is moved by cursor key without shift modifier key.
             Press Alt+q to back to 3270mode,3270 Hotkey to back to xe mode.


      (3) Trouble handling.

            (--For TurnkeyMVS--)
              .When Hercules/MVS is not yet started.
              #ifdef LNX
                 "port 3270:Connection refused."
                 "Connection rejected, no available 3270 device" if Hercules started.
              #else
                 Connection wait until response returns with 10sec timeout.
              #endif
              .When 3270 device is not ready.
                 Connection wait until response returns with 10sec timeout.
                 ---> Activate from MVS console.
                        V NET,INACT,ID=CUU0Cx,I
                        V NET,ACT,ID=CUU0Cx
                      You can enter these command using PF2.(Check it by "D PFK")
              .When reached to maximum 3270 session count.
                 "no available 3270 device"
                 --->close one of opened TSO(3270 emulator) session to yield to xe.
                     Or,run "setupterm" to increase device count.
                     "startterm" defines intial start session count,and
                     SYS1.VTAMLST defines terminal initialy activated.
              .When TSO is not active.
                 "APPLICATION IS INACTIVE"
                 --->"S TSO" from MVS console

            .When invalid TSO-UserID used.
               "INPUT NOT RECOGNIZED"
               --->Correct definition in ::xehost file then retry.
            .When invalid Password used.
               "PASSWORD NOT AUTHOLIZED FOR USERID  REENTER -"
               --->Enter "TSO reply hostid valid-password" command.
                   (LOGON procedure in xe3270.cfg will break the wait status automatically
                   if you configured)
                   ::xehosts file would be corrected.
                   You can check current screen using snap cmd from xe3270 DOS prompt screen.
            .When duplicated UserID logon.
              "IKJ56425I LOGON REJECTED, USERID xxxx INUSE"
              --->"logoff" is issues internaly when native TSO READY mode.
                  Configure xe3270.cfg to issue logoff when SPF mode.
                  "C U=xxxx" from another TSO session if you have multiple userID
                  will immediately release the UserID which is interrupted.

            (--For TurnkeyMVS--)
               "C U=xxxx" is entered on MVS console.

            .File I/O.
              Following error msg issued if DATASET or member is not found.
                TRANS17   Missing or incorrect TSO data set name: file transfer canceled
              When ABEND such as x37 occued, following msg issued.
                TRANS19   Error reading or writing to host disk: file transfer canceled
              Unlike with TurnkeyMVS, indefinite wait will not occur.

              (--For TurnkeyMVS--)
                ind$file v106 returns FILE00 when FILE-NOT-FOUND. Other version may cause infinite wait.
                xe confirm existency before issue transfer request.
                See MVS console whether ABEND S013 etc ocuured.

            .When timeout received.
              Connection timeout is set to 10 seconds,Transfer timeout is infinite.
              Even when timeout msg is retuned,thread may be waiting 3270 response.
              Until 3270 returns response thread is busy and is not available to accept cmd.
              When xe3270 dose not respond to any input from xe3270 DOS prompt screen,
              once cancel TSO user.
                C U=userid
              If no response yet, kill s3270 process.
              #ifdef LNX
                  use kill cmd.
              #else
                  use xkp tool embeded in this package.
                  to list process name and id enter "xkp -l".
                  to kill process enter "xkp pid".
              #endif


            If file save failed,xe dose not end the panel.
            Save temporarily to local file then exit xe.
            Later you may restore to original destination.

      (4) Other miscellaneous.

           .TSO file is opened with option CAP ON as default.
            To deny it use [CAP|NOCAP] option of Edit command
            or change the default by CAP command.
            To enter lowercase letter when CAP ON,use Shift key.

           .E/B command is treated as EN/BN for the file with RECFM=Fx,LRECL=80.
            For COBOL file,'N' is yet required like as ECN to maintenance automatically line number field.
            Alias command function allow to abbreviate optional parameter specification
            such as /P1(protect col.73-80 field).
            For the file col.73-80 is not line-number but a part of data,it is convenient
            to specify f80 option to open. You may use e8 command as alternative.
            No conversion is done when upload/download if opened by binary mode
            (EB,EH command).
            /B option of Copy/Move/Append command support file transfer with no translation
            of EBCDIC and ASCII.

           .Filename referencing function corresponds to MVS file naming convention.
            PC file naming specification is also available.
            *\ --> *.  **\ --> **.   ^*\ --> ^*.
            ex) "e *(m2)" opens  h01:'a.b.c(m2)'  on the screen opened  h01:'a.b.c(m1)',
                **.d(m3) means  h01:'a.b.d(m3)'.
                "e ^*(m2)" on the 2nd panel opens  h01:'a.b.c(m2)'  when  h01:'a.b.c(m1)'
                is opened on the 1st panel of the split screen,
                ^*.**(m4)  means  h01:'a.b(m4)'.

           .JCL submitting is done using TSO SUBMIT cmd.
            On edit panel,updated contents is uploaded to the submit work DataSet
            then SUBMIT cmd is issued.
              Submit work is 'XE3270.TEMP.SUBMIT' as default, this is configurable
              using SUBMITWORK statement in ::xe3270.cfg.
              ex) SUBMITWORK="'DSNAME(MEMBNAME)'"
              You can specify not only PDS member but also Sequential DataSet.
              If single quotation is missing, UserID on ::xehost is prefixed.
            In the other case, # line cmd on dir-list panel of TSO dataset,
            SUB cmd with operand specifying TSO DataSet(Member),
            and member opened but not yet updated,
            TSO SUBMIT cmd is issued.
            Local file could not be submit, you have to upload it.

           (--For TurnkeyMVS--)
              To bypass download overhead, you can use TSO SUBMIT cmd
              by specifying on ::xehost like as
                TSO=3270S
              You want to submit local file directly, set up submit tool of TurnkeyMVS
              as following.

              JCL submitting is available using sub.bat provided by Turnkey-MVS.
              Call sub.bat from xe's SUB command.(place sub.bat on proper PATH).
              On the panel JCL file is opened,enter simply "SUB".
              On the panel local file is opened,enter "SUB sub *".
              Alias command may be used for abbreviation.
              for example,after defined "Alias:JCL SUB sub.bat *" on =0.1 panel,
              "JCL" cmd submit the local file to TSO.
              If you want to use "SUB" to submit to TSO,you have to change
              the command verb of submit function on ini file,then define
              "SUB" as alias command.
              To submit from dir-list,use "#" line cmd. Input on rename field
              is ignored. When using "%" linecmd,enter "sub"(tool name prepared
              by Turnkey-MVS) on rename field.

           .About SPF information.
            By specifying SPF_LEVEL and CMD_MEMBLIST on xe3270.cfg,
            SPF information is displayed on dir-list panel for the PDS member
            with RECFM=Fx and LRECL=80.
            To display line count or files size is toggled by F6 key.
            For SPF file line count is initialy displayed.
            Use S+F6 to display USERID.
            xe keeps the SPF information dropped by uploading by IND$FILE.
            And MM(modification level) is updated as following.
              If the member's COL73-80 is valid line-number, max value of COL79-80
              is assumed as MM value of the member.
              When the member update session end,the MM+1 is back to the PDS directory.
              If the other member is replaced by Save/Replace command,the MM value is
              set to that member. When copy source has no SPF information such as PC file
              or when append to that member,target members MM is 1 up.
              By XCOpy command SPF info is copied,by XAPpend command target MM is 1 up.
            "a" line command is used to update Version and Modification level of the member.
            SPF subcommand of xe's TSO command may be used to update SPF info of
            whole(WILDCARD "*"/"?" is also supported) member of the PDS.
            For ex.,use it to set SPF info at once for the PDS with no SPF info.
            Line count is gotten by reading the member.
            (RPF may require CreationDate,LastUpdateDate,Userid to display on the PDS list)
            To execute XE4S001Z as batch job,refer the following description to specify parameter.
            (copied from header part of source file XE4S001Z)

            *(2)* UPDATE  SPF INFORMATION ON PDS DIRECTORY *********************    00330030
            * PARM FORMAT                                                           00340030
            *  '1,DSN(MEMB),VV,MM,CDATE,UDATE,UTIME,CURLINE,INITLINE,USER'          00350035
            *                                                                       00360034
            *  (START BY NOT NUMERIC MEANS MISSING OPERAND EXCEPT FOR USERID)       00370034
            *  (!!! RPF(V153) NEED CRE-DATE/UP-DATE/USERID TO DISPLY ON DIRLIST)    00380039
            *                                                                       00390034
            *  1:FUNCTION ID:UPDATE SPF INFO                                        00400030
            *  MEMB:REQUIRE. WILDCARD('*' or '?') IS AVAILABLE.                     00410030
            *  VV:VERSION                                                           00410030
            *     IF MISSING,KEEP CURRENT VALUE OR SET 0 IF NO PREVIOUS INFO        00420034
            *     +N FORMAT IS USED TO INCREMENT                                    00430030
            *  MM:MODIFICATION LEVEL                                                00440030
            *     IF MISSING,KEEP CURRENT VALUE OR SET 0 IF NO PREVIOUS INFO        00450034
            *     +N FORMAT IS USED TO INCREMENT                                    00460030
            *     'NOW' IS USED TO SET TO MAX VALUE OF COLUMN 79-80                 00470038
            *  CDATE:CREATED DATE                                                   00480030
            *     IF MISSING,KEEP CURRENT VALUE OR SET 0     IF NO PREVIOUS INFO    00490039
            *     'NOW' IS USED TO SET TO TODAY                                     00500034
            *     '000000' IS USED TO SET TO 0                                      00510039
            *  UDATE:LAST UPDATED DATE                                              00520030
            *     IF MISSING,KEEP CURRENT VALUE OR SET 0     IF NO PREVIOUS INFO    00530039
            *     'NOW' IS USED TO SET TO TODAY                                     00540030
            *     '000000' IS USED TO SET TO 0                                      00550039
            *  UTIME:LAST UPDATED TIME                                              00560030
            *     IF MISSING,KEEP CURRENT VALUE OR SET 0       IF NO PREVIOUS INFO  00570039
            *     'NOW' IS USED TO SET TO CURRENT TIME                              00580031
            *  CURLINE:CURRENT LINE COUNT                                           00590031
            *     IF MISSING,KEEP CURRENT VALUE OR SET 0 IF NO PREVIOUS INFO        00600033
            *     'NOW' IS USED TO SET CURRENT LINE COUNT BY READING MEMBER         00610034
            *  INITLINE:INITIAL LINE COUNT                                          00620035
            *     IF MISSING,KEEP CURRENT VALUE OR SET 0 IF NO PREVIOUS INFO.       00630035
            *     'NOW' IS USED TO SET CURRENT LINE COUNT BY READING MEMBER         00640035
            *  USER   :LAST UPDATED USER                                            00650031
            *     IF MISSING,KEEP CURRENT VALUE OR SET BLANK IF NO PREVIOUS INFO    00660031
            *SAMPLE JCL TO EXECUTE BATCH *                                          00670031
            *//GO EXEC PGM=XE4S001Z,PARM=('1','HERC01.SOURCE.ASM(MEMB),',           00680033
            *//        '01,21,061105,061125,2210,99,101,HERC01')                    00690031
            *//GO EXEC PGM=XE4S001Z,PARM=('1','HERC01.SOURCE.ASM(MEMB),',           00700033
            *//        'VV,+1,CDT,NOW,NOW,CLC,NOW,HERC01')                          00710035
            *//GO EXEC PGM=XE4S001Z,PARM='1,HERC01.SOURCE.ASM(MEMB),DEL'            00720035
            *//STEPLIB DD DISP=SHR,DSN=HERC01.LOAD.ASM                              00730031

      (5) Limitation and Warning.

         !! .To update PDS directory,the dataset should be allocated exclusively.
             (currently XE4S001z use DISP=OLD and dose not use RESERVE macro)
             Try again after closing SPF session.
            .Upload is for PDS member only as default.
             Specify PS_UPLOAD parameter of xe3270.cfg to do it.
            .Long lines are split when upload to the file with RECFM=F(B).
             When uploading by binary mode,null char is appended to fill the
             line up to the record length if RECFM=Fx.
         !! .With TurnkeyMVS, I do not know the reason but file transfer sometimes miss,duplication
             or lack, some amount (it may be 24*76=1844) of lines.
             Following steps against it may not be necessary for the current TSO/E.
             If error was detected, error msg is written to ::xe3270ftp.errlog by append mode.
             Please, watch the file for a while.
             NOPUTCONFIRM and NOGETCONFIRM option of cfg file will set to bypass these step.

             xe3270 download twice for get request from xe and if both is same
             returns "success". If unmatch is detected,retry until the count
             specified by xe3270.cfg exausted.
             (retry will be stopped by Timeout)
             If the retry count exausted,the file for investigation is left in the
             temp dir(TEMP environment variable for Windows or /tmp for Linux).
             Those file nameing is xe3270pc.xxxxxxxx.GETn.y.(xxxxxxxx:Member name)
             Usually you may retry the download request.
             For the case whole PDS download by xcopy command is interrupted,
             you may continue the xcopy adding /y- (skip the existing file) option.

             For put request from xe,xe3270 confirm the output by re-downloading
             after upload.
             When SPF_LEVEL option is specified, xe checks current time stamp in SPF-info.
             If timestamp is not changed,bypass reloading.

             (--For TurnkeyMVS--)
               Warning:RPF(V1M5R3) set HHMM only and dose not set SS in the directory.

             When binary mode,Null character appending is checked and
             allow it as successful and the fact is displayed on the xe3270 DOS-prompt.
             And optionally logged.
             If 2 file is unmatch,Send&Receive are retried by the count specified at xe3270.cfg.
             If retry count is exausted,the file for investigation are left on
             temp dir. Those file nameing is xe3270pc.xxxxxxxx.PUTGETn.y.(xxxxxxxx:Membername)
             If put request is of save of file edit,save is rejected but
             contents are save on workdir(::xeftpwd) by the naming of
             xxxxxxxx.timestamp even after you canceled save.
             Usually you may retry to upload request except following case.
             IND$FILE split long line when upload to fixed LRECL dataset.
             xe issue warning on xe3270 prompt screen and beep twice when detected split line,
             and upload is assumed as completed.
             If the file contains the character which is not commutative for
             conversion between EBCDIC and ASCII.
             Confirm using file compare tool(xe package includes compare tool "xfc")

         !! .Downloaded file is not locked.
              Before upload xe confirms the file is not updated from the previous download time.
              (Timestamp check or compare by re-downloading depending on SPF_LEVEL option).
              Warning is issued before force to upload.
              SPF cannot detect that the file is downloaded, so the uploaded file
              may be overrided by SPF save operation.
              xe provides "TSO Alloc/Free" command for the case dataset is a private.
              If unmatch detected,both files are kept on work-dir(::xeftpwd)
              by the naming of xxxxxxxx.timestamp and xxxxxxxx.timestamp.UPDATECHK
              but you should save current update to another file.

         !! .xe3270 depends on TSO logon procedure and reposnce messages from LISTDS cmd etc.
             You can freely modify xe3270?.c

      (6) DBCS environments.
            .About the trouble that upload converts ASCII space(0x20) to other character than EBCDIC blank(0x40).
             It may occurs when you used -charset option of s3270 cmd.
             X3270.xad in s3270 source package defines translation table.
             In version 3.3, following charset #table defines ASCII=0 for multiple codepoints of EBCDIC>0x40.
               hebrew, bracket437, simplified-chinese, chinese-gb18030,
               japanese, japanese-290, japanese-930, japanese-939, japanese-1390, japanese-1399
             Following update will fix it. (see in sample dir for whole charset.c)
             One line is added.(==> if (iso!=0x20)  //a#20080802 for the case apace->unprintable

              /* Process a single character definition. */
              static void
              remap_one(unsigned char ebc, KeySym iso, remap_scope scope, Boolean one_way)
              {
                  unsigned char cg;

                  /* Ignore mappings of EBCDIC control codes and the space character. */
                  if (ebc <= 0x40)
                      return;

                  /* If they want to map to a NULL or a blank, make it a one-way blank. */
                  if (iso == 0x0)
                      iso = 0x20;
                  if (iso == 0x20)
                      one_way = True;

                  if (!auto_keymap || iso <= 0xff) {
              #if defined(X3270_FT) /*[*/
                      unsigned char aa;
              #endif /*]*/

                      if (scope == BOTH || scope == CS_ONLY) {
                          if (iso <= 0xff) {
                              cg = asc2cg[iso];

                              if (cg2asc[cg] == iso || iso == 0) {
                                  /* well-defined */
                                  ebc2cg[ebc] = cg;
                                  if (!one_way)
                                      cg2ebc[cg] = ebc;
                              } else {
                                  /* into a hole */
                                  ebc2cg[ebc] = CG_boxsolid;
                              }
                          }
                          if (ebc > 0x40) {
                              ebc2asc[ebc] = iso;
                              if (!one_way)
                                  asc2ebc[iso] = ebc;
                          }
                      }
              #if defined(X3270_FT) /*[*/
                      if (iso <= 0xff && ebc > 0x40) {
                          /* Change the file transfer translation table. */
                          if (scope == BOTH) {
                              /*
                               * We have an alternate mapping of an EBCDIC
                               * code to an ASCII code.  Modify the existing
                               * ASCII(ft)-to-ASCII(desired) maps.
                               *
                               * This is done by figuring out which ASCII
                               * code the host usually translates the given
                               * EBCDIC code to (asc2ft0[ebc2asc0[ebc]]).
                               * Now we want to translate that code to the
                               * given ISO code, and vice-versa.
                               */
                              aa = asc2ft0[ebc2asc0[ebc]];
                              if (aa != ' ') {
                                  ft2asc[aa] = iso;
                                  if (iso!=0x20)  //a#20080802 for the case apace->unprintable
                                  asc2ft[iso] = aa;
                              }
                          } else if (scope == FT_ONLY) {
                              /*
                               * We have a map of how the host translates
                               * the given EBCDIC code to an ASCII code.
                               * Generate the translation between that code
                               * and the ISO code that we would normally
                               * use to display that EBCDIC code.
                               */
                              ft2asc[iso] = ebc2asc[ebc];
                              asc2ft[ebc2asc[ebc]] = iso;
                          }
                      }
              #endif /*]*/
                  } else {
                      /* Auto-keymap. */
                      add_xk(iso, (KeySym)ebc2asc[ebc]);
                  }
              }

            .DBCS is not supported by IND$FILE
             (APVUFILE will do. See next item about xe's DBCS(Jpanese only) support.)
             -charset option of s3270 is for keyboard input and screen output.
             For ftp, ASCII<-->EBCDIC translation is done byte by byte using table defined in X3270.xad.
             On the other hands, without DBCS charset for -charset option,
             TSO LOGON procedure may fail by DIALOG ERROR(SPF panel not found) depending on HOST environments.
             (If client dose not notify that client is DBCS env, //ISPPALT DD is not serched for the panel
             for DBCS)
             But fortunately,Enter key on the dialog error panel changes the screen to native TSO READY mode.
             On this screen,only ISPF cmd is accepted and it opens primary options menu of English.
             Command shell panel is now available for xe.
             See sample xe's logon procedure definition in xe3270.cfg.

             If you want see DBCS panel, you should prepare s3270 DBCS version as folllowing.
               a. configure && make with -DX3270_DBCS (on cygwin bash).
                  (s3270-cygwin-dbcs.exe embedded is ones made in my environment)
                    ./configure --enable-dbcs
                  If it issues following warning,
                    Warning disabling DBCS
                  You have to install ICU.
                  After ICU installed, make make fail at ld.
                  Under cygwin,ICU configulation generates different library name from the case of under linux.
                  Modify about line 4808 of s3270 configure script.
                    #LIBS="-licui18n  $LIBS"
                    LIBS="-lsicuuc  $LIBS"
                  Then configure && make as following.
                    export LIBS="-lsicudt -enable-auto-import"
                    ./configure --enable-dbcs

               b. ICU installation.
                  Additional installation is required if you met the message
                    Cannot find ICU converter for ibm-1027
                  when you specified japanese as -charset option.
                    japanese    :1027(SBCS)+300(DBCS)   1027 is filled katakana between English lowercase letter.(Newer)
                    japanese-290: 290(SBCS)+300(DBCS)    290 is filled English lowercase letter between katakana.
                  These are defined on X3270.xad of s3270 source package.
                  I think 930=290(SBCS)+300(DBCS), 939=1027(SBCS)+300(DBCS),
                  but -charset japanese-930 or -charset japanese-939 cause no problem
                  (in X3270.xad defines DBCS only for 930 and 939).
                  If you want to use cp1027 by "-charset japanese", follow the next step.
                    The file ibm01-27....ucm etc are included in s3270 package,
                    and corresponding .cnv file is made ./configure of s3270 using --enable-dbcs option.
                    I could not use those cnv files because ICU_DATA environment setting error?
                    So, I installed ibm-1027 to ICU package as following.
                      copy *.ucm in s3270 package to icu\source\data\mappings
                      create/update icu\source\data\mappings\ucmlocal.mk
                        ###
                        UCM_SOURCE_LOCAL =  ibm-1027_P100-1995.ucm\
                        ibm-1385_P100-1997.ucm\
                        ibm-300_P110-1997.ucm\
                        ibm-837_P100-2000.ucm
                      ./configure --enable-static && make

            .DBCS(Japanese) support of xe.
              Supports Host codepage of CP1027 and CP290.
                CP1027:English lower case letter extension
                CP290 :Katakana extension
              Specify DBCSP option in ::xehost.
                DBCS={cp930|cp939}
                   SBCS codepage of cp930 is CP290, CP2017 is of CP939.
                   DBCS option is JIS83+IBM (See CV command)
              Supports only RECFM=F(B)
              After downloading with bynary mode,splits to lines by LRECL.
              EBCDIC->SJIS conversion are done for those lines.
              SO(0x0e) and SI(0x0f) is replaced to spaces(0x20).
              When uploading,SJIS->EBCDIC conversion is done line by line.
              SO/SO are inserted replacing space(0x20) of both sides.
              If no space exists on the boundary,SO/SO are inserted expanding length.
              Following continued space is deleted by expanded length if exist.
              Single space is left as delimiter.
              Finally,if the line length is over LRECL,the overflow part is cut
              if the length before conversion is lower than or equal to the LRECL.
              If the length before translation is larger than LRECL,
              those line is split to multiple lines without considering DBCS split.
              If the line length after translated is lower than LRECL,
              spaces are padded up to the LRECL.
              Accordingly, Number field on COL.73-80 may not be kept.
  #ifdef LNX
              EBCDIC<->euc.jp translation is done only when LANG environments is euc.jp
              By euc.jp hankaku-katakana(single width Japanese letters of a group)
              are translated to 2 byte code(0x8e+xx).
              When host file contains hankaku-katakana line length expands over the LRECL.
              xe issues warning of LRECL error.
              By uploading, line length may shrink under the LRECL and transfered with
              padding space up to the LRECL.
              Accordingly, Number field on COL.73-80 may not be kept.
              For the file opened as SPF file(80 byte fixed LRECL with STD line number field),
              Line number is kept at col73-80 if available.
              NUMSTD profile is checked for Save/Replace/Create cmd.
              XCOPY/XMOVE cmd dose not check the profile record.
  #endif


#endif