MIDRANGE dot COM Mailing List Archive



Home » LINUX5250 » September 2000

asdbget, not quite a bug :)


  • Subject: asdbget, not quite a bug :)
  • From: Sean Porterfield <sporter@xxxxxxxxxxxx>
  • Date: Thu, 07 Sep 2000 15:43:13 -0400
  • Organization: Best Distributing Co.

fixed

I thought I had a bug...  well, I do, but it's not in the stock source.
I modded a bug into it.

Anyway, I tried to overcome the packed data field length problem and
caused my decimal point to move in one field.  I don't quite know why.

I changed the following:

in get_ffd_data_cb()
after WHFLDT

*** 346,353 ****

    field->length = field->buffer_length;
    if (field->type == 'P')
!     //field->length = field->length * 2 - 1;
!     field->length = signed2int (buf + 164, 2);

    if (field->buffer_offset + field->buffer_length > file_lrl)
      file_lrl = field->buffer_offset + field->buffer_length;


in XML_header() I added an if statement for Packed fields:


  <LAYOUT RECLEN=\"%d\">\n", DTDVERSION, file_lrl);

  if ((iter = fields) != NULL)
    {
      do
        {
           if (iter->type == 'P') { //start new code
            fprintf (outf, "    <FIELD NAME=\"%s\" TYPE=\"%c\"
OFFSET=\"%d\" WIDTH=\"%d\"",
              iter->name, iter->type, iter->buffer_offset,
              iter->length);
          } else { //back to what was there...
          fprintf (outf, "    <FIELD NAME=\"%s\" TYPE=\"%c\"
OFFSET=\"%d\" WIDTH=\"%d\"",
              iter->name, iter->type, iter->buffer_offset,
              iter->buffer_length);
          } // end the added if
          if (iter->type == 'P' || iter->type == 'S')
            fprintf (outf, " PRECISION=\"%d\"", iter->precision);
//        fprintf (outf, ">\n      %s\n    </FIELD>\n", iter->desc); //
removed due to invalid characters
          fprintf (outf, ">\n      "); //check for invalid XML
characters
          for (i = 0; iter->desc[i] != 0; i++) //new code
            XML_putc (iter->desc[i]); // new code

          fprintf (outf, "\n    </FIELD>\n"); //end of new code
          iter = iter->next;
        }
      while (iter != fields);



I think that's all I did to affect this.  It does correctly print
PRECISION for packed decimal fields.  However, my file has the
following:

the released asdbget puts
<FIELD NAME="IVQY01" TYPE="P" OFFSET="49" WIDTH="4" PRECISION="0">
<FIELD NAME="IVAMW6" TYPE="P" OFFSET="53" WIDTH="5" PRECISION="4">
<FIELD NAME="EXTWAC" TYPE="P" OFFSET="58" WIDTH="9" PRECISION="4">

mine has
<FIELD NAME="IVQY01" TYPE="P" OFFSET="49" WIDTH="7" PRECISION="0">
<FIELD NAME="IVAMW6" TYPE="P" OFFSET="53" WIDTH="9" PRECISION="4">
<FIELD NAME="EXTWAC" TYPE="P" OFFSET="58" WIDTH="16" PRECISION="4">

My "WIDTH" is the field length instead of the buffer length.

The data in the original file (first record) is
897    0.6200    556.1400
which matches what I get from the released code.

My code produces
897    0.6200    55.6140

Every record has the last field wrong.  There are 6 fields in the file,
and 5 are correct.  It's just the last one that's wrong.  Anything
obvious that I did wrong?

Thanks!  (Sorry the message is so big...)

+---
| This is the LINUX5250 Mailing List!
| To submit a new message, send your mail to LINUX5250@midrange.com.
| To subscribe to this list send email to LINUX5250-SUB@midrange.com.
| To unsubscribe from this list send email to LINUX5250-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact