Transferring .TIFF to mainframe - ASCII to EBCDIC error?

General discussion on the JZOS batch launcher and toolkit
Post Reply
jzosao
Posts: 1
Joined: Fri Jun 25, 2010 2:29 pm

Transferring .TIFF to mainframe - ASCII to EBCDIC error?

Post by jzosao »

Hi, I'm trying to transfer a .tiff file from an HFS format to MVS. I've tried a few different approaches in Java, one being http://www.google.com/codesearch/p?hl=e ... cd=1&ct=rc

The binary that results has one character that is different throughout, compared to the original.

Has anyone had this problem?
mwilliam
Posts: 37
Joined: Mon Oct 11, 2004 3:21 pm

Post by mwilliam »

Well, I can't say why you got the extra byte. Could be a number of reasons.
Either there was a EOF marker, padding of extra bytes because the resulting MVS could have been a fixed length format, etc...

However, based upon the link given, that example only applies to hierarchical based files only.

Have you tried using the ZFile methods?
For example, if it was up to me, I would use the following code fragment if I were to copy a HFS file to a binary MVS file (assuming the output is a variable record format) :

Code: Select all

      int bytesRead;
      byte buff[] = new byte[32768];  //pre-allocated byte buffer

      InputStream inputFile = com.ibm.jzos.FileFactory.newInputStream("Some HFS File");
      ZFile mvsFile = new com.ibm.jzos.ZFile("some MVS file","wb+"); // specified a binary file
      OutputStream outputFile = mvsFile.getOutputStream(); 
            // Although I could have used the FileFactory.newOutputStream, 
            //   I wanted specifically the binary option.

      while ((bytesRead =inputFile.read(buff)) > -1)
         outputFile.write(buff, 0, bytesRead);

      inputFile.close();
      outputFile.close();
Sorry, I never used the "nio.channels" methods, but I never had problems using variations of the above code. :P
Post Reply