reading COMP-3 data using cobol program on UNIX - Aix

This is a discussion on reading COMP-3 data using cobol program on UNIX - Aix ; hi ppl, I have problems reading the COMP-3 data.Below is the description of the problem. I have a file with COMP-3 data on IBM mainframe.It is in a PS file. As a next step i FTP it to the UNIX ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: reading COMP-3 data using cobol program on UNIX

  1. reading COMP-3 data using cobol program on UNIX

    hi ppl,
    I have problems reading the COMP-3 data.Below is the
    description of the problem.

    I have a file with COMP-3 data on IBM mainframe.It is in a PS
    file.
    As a next step i FTP it to the UNIX environment ( Solaris
    8.1).Also we have microfocus server express 4.0
    installed in the UNIX.


    After FTPing it in ascii mode i need to run a cobol program
    which can read this COMP-3 data.
    To compile and run the program we are using the microfocus
    compiler.


    The result of running the program is as below:
    Successfully reads the non-COMP data.
    COMP-3 data is read as a junk.


    The variable declaration in my cobol program is as follows:
    fs-abc S9(8) COMP-3.
    fs-xyz 9(2).
    FILLER X(73).


    I created a structure file using the DATA FILE EDITOR and
    tried to view the data in formatted mode,
    I can view the right data if FTPed in binary mode.


    Ultimately the aim is to read the data (COMP-3 and non-COMP
    data) using the cobol program.


    Kindly give me some inputs on the above problem.


  2. Re: reading COMP-3 data using cobol program on UNIX

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    kimi wrote:
    > hi ppl,
    > I have problems reading the COMP-3 data.Below is the
    > description of the problem.
    >
    > I have a file with COMP-3 data on IBM mainframe.It is in a PS
    > file.
    > As a next step i FTP it to the UNIX environment ( Solaris
    > 8.1).Also we have microfocus server express 4.0
    > installed in the UNIX.
    >
    >
    > After FTPing it in ascii mode


    That's your problem. COMP-3 is a /binary/ data format, and if you FTP it in
    ASCII /text/, your FTP will alter the COMP-3 data according to text rules.

    Since you are transferring COMP-3 from a mainframe, I'm going to assume that
    the source data is otherwise coded in EBCDIC. If so, your FTP will translate
    the EBCDIC text (including EBCDIC control characters) into ASCII text and
    control characters. Your COMP-3 numbers will suffer inadvertant translation.

    Think of the number 987 in COMP-3. That's x'98', x'7F', which are the
    EBCDIC-US small letter Q ('q') followed by the EBCDIC-US quotation mark ('"').
    /Because/ you told FTP to transfer in ASCII ("text") mode, FTP will see these
    as EBCDIC text bytes and not COMP-3 data, and translate them to the ASCII
    small letter Q (x'71') and the ASCII quotation mark (x'22), corrupting your
    COMP-3 data into a non packed decimal x'7122'.

    > i need to run a cobol program
    > which can read this COMP-3 data.
    > To compile and run the program we are using the microfocus
    > compiler.

    [snip]

    Don't transfer your data with FTP text mode.
    Either
    a) use BINARY mode and make your mainframe program translate the EBCDIC text
    to ASCII, or
    b) use BINARY mode and make your microfocus program translate the EBCDIC text
    to ASCII before processing it, or
    c) (Best choice) make your mainframe program use DISPLAY rather than the
    COMP-x formats for all output numeric data, and transfer the file in ASCII
    mode. This will mean that the Microfocus program will have to /read/ all
    numeric values in DISPLAY form.

    HTH
    - --
    Lew Pitcher

    Master Codewright & JOAT-in-training | Registered Linux User #112576
    http://pitcher.digitalfreehold.ca/ | GPG public key available by request
    - ---------- Slackware - Because I know what I'm doing. ------


    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.7 (GNU/Linux)
    Comment: Armoured with GnuPG

    iD8DBQFGYyOuagVFX4UWr64RAjzKAJ9Y7EPKYy36m4eWO4oOdj vDTN/EBQCfYyBG
    OMjsxF3iMP9Hf+CTRTb5L0Y=
    =jDdM
    -----END PGP SIGNATURE-----

+ Reply to Thread