saving file off Mainframe to PC as txt file.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mikedgre
    Enthusiast
    • Jan 2018
    • 28

    saving file off Mainframe to PC as txt file.

    When I am viewing a file on the Mainframe from BC 4, I want to save the file from editor to a text(txt) file.
    From the editor I do a 'right click' then 'save as'. The file encoding on the MF is IBM EBCDIC 00037 (US/Canada).
    After saving the MF file, there are no CRLF (carriage control/line feed) so all the lines just span with no line breaks.
    The file is 80 bytes each record. Where do I get the line feed characters appended to each line so I get line breaks ?

    I have the profile transfer type with Auto checked off. The ASCII and Binary are not checked. This is under Tools, Profiles(Mainframe location), and then Transfer tab. I think this transfer setting is from MF to Beyond Compare tool though.

    I attached a clip of the dialogue on the 'save as' popup. I rename to *.txt and open from PC. No line breaks are in it.

    Thanks
    Attached Files
  • Aaron
    Team Scooter
    • Oct 2007
    • 15941

    #2
    Hello,

    In the Transfer tab, switch from Auto to Binary, then restart BC4. Does this help with the Save process? That option does control both directions (Either ASCII or Binary, or Auto determines which should be used based on extension and what the server reports it expects).
    Aaron P Scooter Software

    Comment

    • mikedgre
      Enthusiast
      • Jan 2018
      • 28

      #3
      CRLF still not appending

      I changed it to binary and got the same result. When I am in the editor and do a select all, copy, then paste it into
      notepad or word, all the line breaks happen. There should be somewhere that the CRLF is appended to each line
      on the transfer to PC. I can do an FTP on my mainframe tool and for ASCII the CRLF is appended into the file.
      Any other pointers ?




      Originally posted by Aaron
      Hello,

      In the Transfer tab, switch from Auto to Binary, then restart BC4. Does this help with the Save process? That option does control both directions (Either ASCII or Binary, or Auto determines which should be used based on extension and what the server reports it expects).

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 15941

        #4
        Hello,

        I just noticed you are manually overriding the encoding in the Save As dialog each time. What if you update the Tools menu -> Profile, and update the FTP Profiles encoding to the correct encoding, so you do not need to override each view or save?

        Instead of your mainframe tool, how do other FTP clients (like Filezilla) act?
        Aaron P Scooter Software

        Comment

        • mikedgre
          Enthusiast
          • Jan 2018
          • 28

          #5
          CRLF inclusion

          In the Save As, the encoding is for the destination target file or file within the editor(source) ? If I change it to ASCII,
          I get the attached popup. I use Reflections FTP Client and have the setting to ASCII on the transfer. I do not see
          a checkbox for CRLF. It seems to incorporate CRLF behind the scenes.
          In BC 4, I have to specify the exact record length. If the source is 80 bytes and I set the record length to 200 (example).
          There are 200 characters per line. In Reflections FTP Client, it detects the record length(or doesn't care) and does not need record length to be inputted. There should be a way to place a CRLF automatically.





          Originally posted by Aaron
          Hello,

          I just noticed you are manually overriding the encoding in the Save As dialog each time. What if you update the Tools menu -> Profile, and update the FTP Profiles encoding to the correct encoding, so you do not need to override each view or save?

          Instead of your mainframe tool, how do other FTP clients (like Filezilla) act?
          Attached Files

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 15941

            #6
            Hello,

            ASCII will attempt to convert between line endings when transferring depending on what the client detects the server as, but if the detection isn't working, it'll need to be manually overridden.

            What behavior do you see if you go to the Tools menu -> Profiles, select your saved profile, Server tab, and set the Encoding from detect to "00037 EBCDIC (US/Canada)", then fully restart BC4, relaunch, and connect to your server?
            Aaron P Scooter Software

            Comment

            • mikedgre
              Enthusiast
              • Jan 2018
              • 28

              #7
              CRLF drop

              From Tools menu -> Profiles -> Server, I had the setting as Use Default. I changed it to EBCDIC and the file came out with garbage. I changed it to Detect and the file was good inside BC (like default). From the Save As dialogue,
              the Encoding is the destination code type. If I have EBCDIC as the encoding type in this Save As dialogue, it comes out garbage. I use 20127 (US-ASCII). I get all the text from the file but there are no line breaks. There are 1025 characters
              written per line. This is the max # of characters for notepad so it is ignoring line breaks.

              I have a workaround. I do CRTL + A and then CRTL + C. Then I do CRTL + V in notepad or Word. The lines break
              correctly. This takes just minimal effort. However, it seems the Save As should detect and incorporate line breaks
              from the editor. Have you tested this kind of Save out ? Thanks.






              Originally posted by Aaron
              Hello,

              ASCII will attempt to convert between line endings when transferring depending on what the client detects the server as, but if the detection isn't working, it'll need to be manually overridden.

              What behavior do you see if you go to the Tools menu -> Profiles, select your saved profile, Server tab, and set the Encoding from detect to "00037 EBCDIC (US/Canada)", then fully restart BC4, relaunch, and connect to your server?

              Comment

              • Aaron
                Team Scooter
                • Oct 2007
                • 15941

                #8
                Hello,

                I chatted with a developer and got some feedback:

                The first is to try setting the Profile back to Detect encoding, since it should actually be ANSI, but needs to use ASCII transfers, which AUTO is likely failing to use since your files do not have extensions matching the Auto Extensions list. You can switch the Profile's Transfer tab to always ASCII, or add extensions to your files and add that extension to the Auto Extensions list. Test with a test file, but you should then be able to save, and the server should translate this back to the EBCDIC encoding as part of the transfer handling, rather than you trying to do it manually.

                To perform it manually, the Profile should be set to Binary transfers but still ANSI format. Then the Tools menu -> File Formats will need a format for these files that sets the Conversion tab Encoding to Ebcdic and the Characters Per Line limit to the correct value for your server (80).

                Do either of these methods provide improved performance?
                Aaron P Scooter Software

                Comment

                • mikedgre
                  Enthusiast
                  • Jan 2018
                  • 28

                  #9
                  It is working (explanation). Also how to handle different record lengths....

                  Thanks! From 'Profiles', tab 'Server', I have encoding to be Detect. Under 'Transfer' tab I have Transfer Type to be ASCII.
                  After doing 'Save As' from the file, I got the Encoding to be ANSI. The Line Ending Style is Windows/DOS.
                  File type from MF had blank extension. I typed in the destination extension of .txt for the file.
                  In opening the file there are line breaks now. Yay!!!!
                  The EBCDIC option threw me off. EBCDIC is the type on the MF so once it comes into BC it is ASCII (by transfer type).
                  When I do Save As the dialogue, the 20127 (US-ASCII) option also works. I wonder what the difference is on the ANSI
                  verse US-ASCII save option.

                  The Mainframe file has no extension. I will have different record length files.
                  In the File formats if I trap by *.* , the first MF file format is chosen (record length 80). I have another
                  file format for record length 133. I have to find a way to trap the 133 when needed. I do this manually
                  right now. This is very small but Id like to see how to distinguish when to use record length 80 verse 133.

                  Thanks so much for your help!




                  Originally posted by mikedgre
                  From Tools menu -> Profiles -> Server, I had the setting as Use Default. I changed it to EBCDIC and the file came out with garbage. I changed it to Detect and the file was good inside BC (like default). From the Save As dialogue,
                  the Encoding is the destination code type. If I have EBCDIC as the encoding type in this Save As dialogue, it comes out garbage. I use 20127 (US-ASCII). I get all the text from the file but there are no line breaks. There are 1025 characters
                  written per line. This is the max # of characters for notepad so it is ignoring line breaks.

                  I have a workaround. I do CRTL + A and then CRTL + C. Then I do CRTL + V in notepad or Word. The lines break
                  correctly. This takes just minimal effort. However, it seems the Save As should detect and incorporate line breaks
                  from the editor. Have you tested this kind of Save out ? Thanks.

                  Comment

                  • Aaron
                    Team Scooter
                    • Oct 2007
                    • 15941

                    #10
                    Great to hear! If you need to use a specific file format which might be too aggressive for other, default comparisons:

                    Define it globally in the Tools menu -> File Formats dialog to capture everything (*.*), but then disable it by unchecking the box next to the name in the main format listing, which disables it.

                    Next, in a specific Folder Compare session, navigate to the Session menu -> Session Settings, Misc tab, and in the format list, enable only this format and disable the others. This session can now use the format which grabs everything, but other sessions would use the default formats as defined globally under Tools menu -> File Formats.
                    Aaron P Scooter Software

                    Comment

                    • mikedgre
                      Enthusiast
                      • Jan 2018
                      • 28

                      #11
                      Thanks. I put out another post. Can I apply Grammar setting to different compares where the Grammar is different? It seems the grammar is global. I want to make the grammar setting stick. Thanks

                      Comment

                      • Aaron
                        Team Scooter
                        • Oct 2007
                        • 15941

                        #12
                        One other strategy is to define the File Format's mask as:
                        *servername[?]*
                        this would then use this format when connecting to that server, assuming it is the topmost format match.
                        Aaron P Scooter Software

                        Comment

                        • Aaron
                          Team Scooter
                          • Oct 2007
                          • 15941

                          #13
                          "different compares" as different sessions? The hint I just posted, where the format contains the server name, would allow the format to work with that servername.
                          Aaron P Scooter Software

                          Comment

                          Working...