EBCDIC to ASCII conversion - FTP from mainframe to local PC

EBCDIC to ASCII conversion - FTP from mainframe to local PC

4
NewbieNewbie
4

    Dec 06, 2007#1

    Not having found a suitable solution to my problem at the forums, I've decided to post my own question - I'm trying to download a SPUFI output file from the mainframe to a PC. This file has accented european characters. For ex, 'Réception pour contrôle'.

    The server type has been set to MVS and the default transfer type to ASCII. I'm assumng this output file has an EBCDIC format and UE automatically converts to ASCII when downloaded. However, the downloaded file is unable to recreate these accented characters correctly. For instance, 'Réception pour contrôle' in SPUFI incorrectly becomes 'R©ception pour contrÊle' on the PC.

    I've tried the 'EBCDIC to ASCII' conversion included under the file menu but that doesn't seem to help and using a default transfer type of BIN while downloading doesn't help either.

    Any help would be greatly appreciated!

    262
    MasterMaster
    262

      Re: EBCDIC to ASCII conversion - FTP from mainframe to local

      Dec 06, 2007#2

      Well, to my understanding it is the host - the mainframe (z/OS, AS400 ?) - that performs the code page conversion from EBCDIC to ASCII. When a FTP client wants to download a file from the mainframe file system in text mode (ASCII mode), the mainframe FTP server converts the file from its native EBCDIC code page to ASCII before sending it back to the client.

      My guess is that the system programmer who has set up the FTP server on your mainframe, somewhere has defined which ASCII code page to convert into.

      I'm not sure about FTP server implementations on AS400 but for MVS (z/OS) this should be the case:

      If you want to take control yourself of the conversions on the server from the client side issue the FTP server command:

      SITE SBD=(IBM-277,ISO8859-1)
      (in this example it tells the mainframe FTP server to convert the (s)ingle(b)yte(d)ata from EBCDIC 277 (Denmark/Norway) to ASCII ISO8859-1)

      Sadly you are not able to enter initializing commands in the UltraEdit FTP account manager. (It might be possible in the future - see the thread How to edit MVS files via FTP?).

      So your options as I see it are:

      - tell your systems programmer to change the code page conversion definitions to support the ASCII code page you use on the pc

      - or use a FTP client that supports initializing FTP commands.

      (ps: Did you download binary (BIN) and then convert in UE using "EBCDIC to ASCII" ?)

      4
      NewbieNewbie
      4

        Re: EBCDIC to ASCII conversion - FTP from mainframe to local

        Dec 06, 2007#3

        jorrasdk,

        Thank you very much for your reply. The host, z/Os 1.4, quite possibly might have such server side settings.

        I might try FTP through the cmd prompt but I was wondering if this command - 'SITE SBD=(IBM=277,ISO8859-1)' is valid only for a session or if this is a permanent setting, since there are other users that access this FTP server and I wouldn't want to change any settings permanently.

        I used both 'ASCII' and 'BIN' transfer types. When I set this option to ASCII, the downloaded file was almost identical to the source file, except for a few accented european characters. I get the same result when I use 'BIN' for the transfer type and convert it in UE using "EBCDIC to ASCII", the only difference being, newlines/carriage returns are lost while using 'BIN'.

        Now that you've mentioned MVS, I have the server type set as MVS, since this type is the only one that seems to be able to retrieve the FTP server contents but the host mainframe's OS is z/OS 1.4.

        Thanks again!

        262
        MasterMaster
        262

          Dec 06, 2007#4

          Server type "MVS" is in this case a general term for all IBM mainframe generations in the MVS family (MVS/370 > MVS/XA > MVS/ESA > OS/390 > z/OS).

          The "SITE SBD..." command issued from a client is only valid for one session and will not affect other users.

          4
          NewbieNewbie
          4

            Re: EBCDIC to ASCII conversion - FTP from mainframe to local

            Dec 06, 2007#5

            Thanks! I used this command: SITE SBD=(IBM-1047,ISO8859-1) and it seems to have accepted it. I'm guessing 1047 is US based, which is what I'm interested in.

            .............
            ->:> SITE SBD=(IBM-1047,ISO8859-1)
            ->:< 200 SITE command was accepted
            ............

            I'm still figuring out how to access my files on the remote server using a new command based FTP program as you had suggested, but everything seems to be moving in the right direction, as of now and I'll have another update soon.

            Thanks again for your help!

              Re: EBCDIC to ASCII conversion - FTP from mainframe to local

              Dec 07, 2007#6

              jorrasdk,

              Thanks a ton!! It finally worked! I used a freeware called 'Core FTP LE' and, based on your suggestion, incorporated this command - 'SITE SBD=(IBM=1047,ISO8859-1)' . Accented european characters are interpreted faithfully. Thank you again!!

              262
              MasterMaster
              262

                Re: EBCDIC to ASCII conversion - FTP from mainframe to local

                Dec 07, 2007#7

                You are welcome :-)

                And I have just sent IDM an e-mail supporting the feature request mentioned in another thread for a possibilty to specify an "initializing command" for a FTP account.

                I think this feature is not essential for most ASCII based FTP servers, but as it turns out it can be quite useful and essential for people working with MVS FTP servers.

                1
                NewbieNewbie
                1

                  May 15, 2009#8

                  Hi,

                  I have a similar requirement. I am trying to FTP a file from mainframe to a FTP server.
                  While FTPing the pound (£) character is converted to dollar ($).

                  I use below option in the JCL to FTP the file.
                  //STEP01 EXEC PGM=FTP,PARM='(EXIT',COND=(4,LT)
                  //SYSTCPD DD DISP=SHR,DSN=SYS2.TCPIP.DATA(TCPIP)
                  //SYSFTPD DD DISP=SHR,DSN=NUPVL.CAPES.FTP.DATA.PASCAL
                  //SYSMDUMP DD SYSOUT=X,HOLD=YES
                  //SYSABEND DD SYSOUT=X,HOLD=YES
                  //SYSPRINT DD SYSOUT=*
                  //OUTPUT DD SYSOUT=*
                  //INPUT DD *
                  FTPL002A.VIA.NOVONET.
                  // DD DSN=PASSWORD.FILE,
                  // DISP=SHR
                  // DD *
                  TYPE A
                  LOCSITE TRAILINGBLANKS
                  CD \LIFE_CAPES\CPSLIVE\AGENTS
                  PUT 'FILE.TO.BE.TRANSFERED' CPSAGYRK.DAT
                  quit

                  Is there any changes you can suggest in my JCL so that pound character is not converted to dollar in the CPSAGYRK.dat file on the FTP server.

                  I tried using TYPE E ( For EBCDIC) but it gave me following error. I dont know what this error is trying to say.
                  EZA1456I Connect to ?
                  EZA1736I FTPL002A.VIA.NOVONET.
                  EZA1554I Connecting to: FTPL002A.VIA.NOVONET 10.14.154.96 port: 21.
                  220 Microsoft FTP Service
                  EZA1459I NAME (FTPL002A.VIA.NOVONET.:NUPVD99):
                  EZYFS34W FTP will not remove TRAILING sequence numbers
                  EZA1701I >>> USER CAPESFTP
                  331 Password required for CAPESFTP.
                  EZA1701I >>> PASS
                  230 User CAPESFTP logged in.
                  EZA1460I Command:
                  EZA1736I TYPE E
                  EZA1701I >>> TYPE E
                  504 Type E not implemented.
                  EZA1735I Std Return Code = 40504, Error Code = 00002
                  EZA1701I >>> QUIT

                  Any suggestions/help reagrding the above error and modifications to the JCL would be highly appreciated.
                  Thanks.

                  262
                  MasterMaster
                  262

                    May 18, 2009#9

                    Not so much a problem involving UE, but anyways:

                    "TYPE E" is only meaningful between hosts that use EBCDIC for their internal character representation. And that isn't the case with the "Microsoft FTP Service" you are connecting to.

                    So you really need your EBCDIC data to be converted into ASCII. That means a "non binary" connection ie "TYPE A". So either the MS FTP server or the FTP subsystem on your mainframe needs to be told which codepages to convert from (EBCDIC) and to (ASCII) - since the defaults are not working for you as it corrupts £ changing it to $.

                    I haven't worked on mainframes since 2006 so I can't test the validity of this but:

                    - either you need to figure out how to send a command to the MS FTP server which sets up the proper conversion. (SITE command). Check the MS FTP server manual.

                    - or you might be able to tell the FTP subsystem on your mainframe to convert locally and then upload as binary. As I recall a combination of a "TYPE A" command together with a "LOCSITE MBDATACONN__=__" (multibyte encoding) or "LOCSITE SBDATACONN=__=__" (singlebyte encoding) (file_system_codepage,network_transfer_codepage) command. But I can't test this as I have no access to a mainframe.

                    If this doesn't solve your problem I think you should post your problem in other forums like Mainframe forum

                    1
                    NewbieNewbie
                    1

                      Aug 13, 2010#10

                      I had the same problem and after several tests I found a solution.

                      When you configure or create an FTP account in the FTP Account Manager of UltraEdit, go to the "Server" tab and fill the field "send after login" with the following command (my MVS host has German EBCDIC table IBM-273):

                      "site SBDATACONN=(IBM-273,ISO8859-1)"

                      After connecting to the MVS host, this command is sent and all your FTP of this session is made with this conversion.