Menu

#29 Handle MultiRecord CP and Multicopybooks in response bytearray

v1.0_(example)
open
1
2019-09-12
2019-08-28
Anonymous
No

Hi Bruce,

Could you please help me to resolve the below issues with Jrecord :

I am working on a windows 10 OS and using Java 8 to send and read the response from mainframe comarea.
All copybooks are stored on my windows 10 as a text file.

1) How to read a multi-Record copybook file with the below menitoned structure

10 AREA.
15 P-NUM PIC X(01).
15 P-NUM-SYS-ID PIC S9(17)V COMP-3
*

  *      SOME STREET DATA
  *
         15  ADD-STR.
             20  PROV               PIC X(02).
             20  SYS-ID     PIC X(01).
  *
  *      SOME ADDRESS DATA
  *
         15  ADDRESS.
             20  ADD-TYP         PIC X(01).
             20  SYS-ID         PIC S9(17)V COMP-3.

I am not able to figure out, as how to define IOB and further properties to read the copybook correctly.
Also this is a multi-record copybook, so need to understand that how we can handle it all with Jrecord.

2) In the response - we are getting data for multiple copbooks i.e. it is having a -
header copybook (200 bytes) + some operation ID for data1 (4 bytes) + data1 copybook (variable length) + some operation id for data2 (4 bytes) + data2 copybook (variable length).

Your thougths on the above will surely help me to move forward with Jrecord solution
Thanks.

Discussion

  • Bruce Martin

    Bruce Martin - 2019-08-28

    Can I see the copyboo/data so I can understand exectly what is going on. Not If you create a user id (and enter a e-mail address, I could send you my emaill address

     
  • Gaurav

    Gaurav - 2019-08-29

    Hi Bruce,

    I created an account with the user id : gy2019.
    Please send me your email id.

     

    Last edit: Gaurav 2019-08-29
  • Gaurav

    Gaurav - 2019-09-05

    Hi Bruce,

    I sent you a mail today.
    Please let me know, if any other info is required..

     
  • Bruce Martin

    Bruce Martin - 2019-09-07

    I presume this is a follow up to https://sourceforge.net/p/jrecord/bugs/28/
    I presume you you need to compress the data as well ??

    Are you using the MDT templates I created ???

    You can use IOBuilders to read the Cobol-layout and create lines.

    In this case I would write the lines to a ByreArrayOuputStream (with any control information.

       ByteArrayOuputStream os = new ByteArrayOutputStream();
    
       headerLine.write(os);
       dateLine1.write(os);
       dateLine2.write(os);
    
       ...
    

    I have updated the Template support Classs (see attached)

    basically

    • in BaseGeneratedLine
        public void write(OutputStream os) throws IOException {
            compress.write(os, line.getData());
        }
    

    in CompressedData

        public void write(OutputStream outStream, byte data[]) throws IOException {
            //byte[] expanded = new byte[expandedLength];
            boolean processField = true;
            int pos = 0;
    
            for (FieldDetail field : fields) {
                if (pos >= data.length) { break; }
                byte test = data[pos];
                if (processField) {
                    int e = field.getEnd();
                    outStream.write(data, field.getPos(), field.getLen());
    
                    pos += field.getLen();
                }
                processField = ! (test == NOT_PRESSENT && field.getName().toUpperCase().endsWith("-MDT"));
            }
        }
    

    Note: I have not done any Testing

     

    Last edit: Bruce Martin 2019-09-13
  • Gaurav

    Gaurav - 2019-09-12

    Thanks Bruce.

    yes this is a follow up on #28, and dealing with MDT fields.
    we have done some customization to expand and written compress method also.

    Now my question was related to handling multirecord response - where one line will be a combination of few copybooks data and each line can repeat n number of times.
    do we have some good way in jrecord to handle these kind of records or we need some customization ?

     

Anonymous
Anonymous

Add attachments
Cancel