Menu

Record format F and File Organization PS

Help
2016-08-03
2016-08-10
  • Govindu Narendr

    Govindu Narendr - 2016-08-03

    Dear Bruce Martin,
    We are having an issue while reading record format with F and we used IO_FIXED_LENGTH file organization parameter . The issue is next line records not ending properly.Attached is the data set infomation.
    Please help.

    Regards
    Naren

     

    Last edit: Govindu Narendr 2016-08-03
  • Bruce Martin

    Bruce Martin - 2016-08-03

    From what you have provided, I can not tell for sure exactly what is going on.
    It may be releated to https://sourceforge.net/p/jrecord/discussion/678634/thread/4b00fed4/

    In which case this might work

    ICobolIOBuilder iobuilder = CobolIoProvider.getInstance()
            .newIOBuilder("copybookFileName", ICopybookDialects.FMT_MAINFRAME)
                    .setFont("CP037")
                    .setFileOrganization(Constants.IO_FIXED_LENGTH);
    LayoutDetail layout = iobuilder.getLayout();
    FixedLengthByteReader br = new FixedLengthByteReader(13682);
    br.open("...");
    
    byte[] bytes;
    while ((bytes = br.read()) != null) {           
        lines.add(iobuilder.newLine(bytes));
    

    Looking at the File info Record Length = 0 looks a little strange.


    I could tell you more with the Copybook / Cobol program / JCL / file data.

     
  • Govindu Narendr

    Govindu Narendr - 2016-08-03

    Dear Bruce Martin,
    Thanks for help and find attached copybook.

     
  • Bruce Martin

    Bruce Martin - 2016-08-04

    have you tried the code from the previous answer


    any way try looking at the File using the Wizard in the RecordEditor see

    https://sourceforge.net/p/jrecord/wiki/RecoprdEditor%20Wizard/

    Also I sent you a e-mail

     
    • Govindu Narendr

      Govindu Narendr - 2016-08-04

      Hi,
      used above program but there is no change in the output.
      File pulled using connect direct with SYSOPTS=":datatype=binary" options and none of the below options are used DISP=(RPL) DCB=(LRECL,RECFM,BLKSIZE)

       
  • Bruce Martin

    Bruce Martin - 2016-08-05

    Can you send me a sample of the file (say 100 kb) or a zipped version of the file

     
    • Govindu Narendr

      Govindu Narendr - 2016-08-08

      Hi,
      We have 120 MB zip file , can you please help how to pull less siae file (100 record) using NDM(connect direct options.
      Thanks

       
      • Bruce Martin

        Bruce Martin - 2016-08-08

        That I can not tell you. Alternative options:

        On the mainframe, copy the file with sort copy and use the stopafter option see
        http://mainframewizard.com/content/sort-jcl-stopaft-and-skiprec

        sort parm:

        SORT FIELDS=COPY,STOPAFT=100
        

        use java to read (and write 100k:

        a method like the following will fill a byte array; then just write it to a file

        int readBuffer(InputStream in, final byte[] buf, int inTotal)
        throws IOException {
        
            int total = inTotal;
            int num = in.read(buf, total, buf.length - total);
        
            while (num >= 0 && total + num < buf.length) {
                total += num;
                num = in.read(buf, total, buf.length - total);
            }
        
            if (num > 0) {
                total += num;
            }
        
            incBytesRead(total - inTotal);
        
            return total;
        }
        
         
  • Bruce Martin

    Bruce Martin - 2016-08-09

    By the way have you checked if it is not some 'DB' or special format file e.g. the NDM master file ???

     
    • Govindu Narendr

      Govindu Narendr - 2016-08-10

      Hi Martin,
      Please find attached sample file.
      Thanks
      Naren

       
  • Bruce Martin

    Bruce Martin - 2016-08-10

    Just

            ICobolIOBuilder iob = JRecordInterface1.COBOL
                                       .newIOBuilder(copybookName)
                                           .setFont("cp037")
                                           .setFileOrganization(Constants.IO_FIXED_LENGTH)
                                           .setSplitCopybook(CopybookLoader.SPLIT_NONE)
                                       ;
    

    works on the supplied file. The attached zip file holds generated sample code (RecordEditor).

    Also will add second update with how I generated the code

     
  • Bruce Martin

    Bruce Martin - 2016-08-10

    I just used the JRecord CodeGenerator in Record|Editor 0.98 to create the code

    In the RecordEditor 0.98, select Generate >>> Java~JRecord code for Cobol

    Generate Menu

    Then enter the Cobol Copybook and Sample file:

    Generate Screen

    The Recordeditor selected the Correct attributes:

    Generate Screen

    Then hit the Generate Button

    Generate Screen

    Then You select the Code Template you want and hit the Generate button

     

    Last edit: Bruce Martin 2016-08-10
    • Govindu Narendr

      Govindu Narendr - 2016-08-10

      Hi MArtin,
      Thanks for your help,if you look at the variable portion in the copybook AMED-VARIABLE-PORTION in that block of data example AMED-COST-CNTR-RPT field data is not correct.
      And the data is correctly first 400 bytes and variable portion 200 bytes is not correct.
      Please help.

      Thanks
      Naren

       
  • Bruce Martin

    Bruce Martin - 2016-08-10

    I would think there would be other Copybooks for the file.
    You will find the copybook matches the data when AMED-AUTH-CRITERIA-TBL = AAA

    The namke AMED-VARIABLE-PORTION suggest this portion of the record varies from Record to Record. There are presumably other copybooks related to the file

     

Log in to post a comment.