unpack binary file



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

unpack binary file

Postby Dartrolton » Wed Oct 18, 2023 3:21 pm

Good morning,

I have a file generated automatically on the Mainframe, and to view some data, it is necessary to use the HEX ON command within the file. However, I need to download this file to the lower platform, and when I download it, it comes with compressed data.

Is there any way to download this file uncompressed in Windows/Linux? Could I create a JCL job for this? If so, which tool would I use?

ps: i cant use "Sysout" because company burocracy
Dartrolton
 
Posts: 2
Joined: Tue Oct 17, 2023 7:52 pm
Has thanked: 2 times
Been thanked: 0 time

Re: unpack binary file

Postby sergeyken » Wed Oct 18, 2023 4:54 pm

You need to know the exact "layout" of records in your file: e.g. the sequence of "fields", and the format of data in each of those fields.

Without this information any attempt to "HEX ON" wouldn't help even to understand the meaning of data, to say nothing about the correct transmission to another platform.

Typical method of data transfer to a different platform is:
1) Convert each field to its character presentation, in EBCDIC character set.
2) Perform conversion from EBCDIC to either ASCII, or Unicode, or any other encoding scheme used on the target platform.
3) Transmit the character file to another platform (this can be often combined with step 2).
4) Use the transferred text file with proper encoding for any further operation on the target platform.

From the style of your question I can conclude that you are trying to do the job while you have no idea about the basic, fundamental information "how the things work" in this computer world.
Javas and Pythons come and go, but JCL and SORT stay forever.

These users thanked the author sergeyken for the post:
Dartrolton (Wed Oct 18, 2023 7:50 pm)
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: unpack binary file

Postby sergeyken » Wed Oct 18, 2023 6:35 pm

FYI:
Binary files are not human readable and require a special program or hardware processor that knows how to read the data inside the file. Only then can the instructions encoded in the binary content be understood and properly processed.


Wikipedia. Binary Files.
Javas and Pythons come and go, but JCL and SORT stay forever.

These users thanked the author sergeyken for the post:
Dartrolton (Wed Oct 18, 2023 7:50 pm)
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: unpack binary file

Postby Dartrolton » Wed Oct 18, 2023 8:00 pm

sergeyken wrote:You need to know the exact "layout" of records in your file: e.g. the sequence of "fields", and the format of data in each of those fields.

Without this information any attempt to "HEX ON" wouldn't help even to understand the meaning of data, to say nothing about the correct transmission to another platform.

Typical method of data transfer to a different platform is:
1) Convert each field to its character presentation, in EBCDIC character set.
2) Perform conversion from EBCDIC to either ASCII, or Unicode, or any other encoding scheme used on the target platform.
3) Transmit the character file to another platform (this can be often combined with step 2).
4) Use the transferred text file with proper encoding for any further operation on the target platform.

From the style of your question I can conclude that you are trying to do the job while you have no idea about the basic, fundamental information "how the things work" in this computer world.


Hello, friend! Well, I had the Copybook, and yes, I can read and understand the file on the Mainframe. My difficulty was mainly in exporting this file from the mainframe, already decompressed, to be sent to other areas for analysis.

But you gave me an idea of how to do it. I appreciate your Hekp.
Dartrolton
 
Posts: 2
Joined: Tue Oct 17, 2023 7:52 pm
Has thanked: 2 times
Been thanked: 0 time

Re: unpack binary file

Postby sergeyken » Thu Oct 19, 2023 12:58 am

BTW, there is absolutely no chance to do it using any JCL tool.

Some of popular methods are:
- using SYNCSORT or DFSORT utility (they are 99.999% equivalent),
- using FILEAID utility,
- using a special program in any programming language; REXX is popular for such task.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: unpack binary file

Postby sergeyken » Thu Oct 19, 2023 6:59 pm

A few hints on data transfer from mainframe to other platforms.

1. Any file can be transferred via FTP in binary mode "as is", but the problem is: it becomes not usable in different environment due to absolutely different data presentation formats on different platforms.

2. Text fields on a mainframe (e.g. PIC X(nnn) in COBOL) are stored in EBCDIC codepage, which is not usable on any other platform.

3. Binary integer data on a mainframe (e.g. PIC S9(nn) COMP-1 in COBOL) are often not usable on other platforms, due to differences in hi-ending, and low-ending coding.

4. Decimal packed data on a mainframe (e.g. PIC S9(nn) COMP-3 in COBOL) are not usable on any other platform, due to unique IBM's encoding method.

5. Decimal unpacked data on a mainframe (e.g. PIC S9(nn) in COBOL) are not usable on any other platform, due to unique IBM's encoding method.

One needs to deeply understand all those difference prior to attempting "binary file transfer" to another platforms.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: unpack binary file

Postby sergeyken » Sun Oct 22, 2023 6:58 am

One more hint.

From my experience, when transferring data files between different platforms, 90%-99% of users do it using so called CSV-format (e.g. Comma Separated Values format). This sort of text files is almost standard input for many applications, starting from Excel, and many more specific ones, and hand-made applications.

I recommend you to google and to read about it. This forum is a help forum, but not a free of charge school for Information Technology.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post