Announcement

Collapse
No announcement yet.

POWERBASIC BCD variables structure

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • POWERBASIC BCD variables structure

    I'm trying to read BCD variables from a binary file in VISUAL BASIC application (sorry!) and cannot find a way to implement de CVF function.

    I thought may be I could write the function myself and convert to a double precision variable.

    Any help?

    Thank you

    ------------------

  • #2
    PowerBASIC/DOS offers two types of BCD variables, an eight-byte version and a ten-byte version. PB/Windows has its own BCD types (1).

    So first thing is to identify the sizes of the subject fields, and/or the compiler which created them.

    Then what you will find is that each nibble (half byte) holds a decimal digit; for the 'floating point' BCD type (10-byte, PB/DOS) there will be a scaling factor somewhere in there. (PB's BCD types are a proprietary format).

    If these data were produced with COBOL (not too many BASICs do BCD, but BCD is quite common for COBOL), you can read my article on using COBOL-created data with non-COBOL programs at EBCDIC and ASCII, COBOL and IEEE : A Guide to Data Conversions

    Once you figure out the <U>actual</U> data format in use, it's just a matter of reading the byte values, AND'ing off the nibbles and storing the decimal digits.

    (1) Through PB/CC 2.11 and PB/Win 6.11, CUR and CUX were erroneously identified as BCD in the help files. They are in fact scaled binary. This error was corrected in the PB/CC 3.0 and Win 7.0 help files). (Thanks to a concerned user who took the time to point this out to the support department).



    ------------------
    Michael Mattias
    Tal Systems Inc.
    Racine WI USA
    mailto:[email protected][email protected]</A>

    www.talsystems.com
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      VB/32 Currency is an 8-byte QUAD with an implied decimal point. Therefore, you should be able to use a QUAD type in your PB/DOS code.

      However, if you need to perform math or display the values contained, divide each by 10000 first (to display the value with 4 decimal places).

      FWIW, VB/32's Currency is the same data type as a PB/Win (and PB/CC) CURRENCY data type.



      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment


      • #4
        Funny Micheal should mention EBCDIC. The problem I am constantly having is a type Two scenerio EBCDIC-COBOL to ASCII (with nulls), nightly ftp's of US IBM mainframe "tables" to a linux pc. Once on the linux pc, I ftp it to my pc at 1 meg/sec. They are sending it in ascii, but the piecemeal approach of continually begging for data is not working. None of the data I want is "sensitive", no payroll or anything even remotely like that. The mainframe folks are very uncooperative and I am ready to go to the top.

        Since they are always saying they don't personnel who have time, I am beginning to think that it would be better to do more of the work on a pc. They have also been complaining about bandwidth. I have seen a few of "the COBOL file Description (FD) for the source data", so I know they exist. They have QMF.

        I am convinced that the only long term solution is to have a duplicate of the mainframe data on a pc, to get "every damn table, every damn night". Have them directly wire a pc to the mainframe and just dump the data in EBCDIC format there nightly. There I would translate it to ascii, compress it and then I could ftp the data to a pc where ultimately I would use powerbasic. It would result in a huge increase in productivity, so I probably could dig up a budget.

        The general idea is the least amount of work for the mainframe folks.

        What do you think ? Done anything like that before ? Ideas for hardware, software, a budget ? Any suggestions ?

        Comment


        • #5
          if you are looking for the software to convert the mainframe data into something usable on the pc, drop me an email with a return address i do not have to edit.(i.e., if you use "[email protected]" that's where i send. (provide a link in text if your return address is like this).

          also read this recent thread for description of my kit's capabilities:

          http://www.powerbasic.com/support/pb...ad.php?t=26817

          i have been supplying this dll and conversion kit for free, but since feedback from users generally stinks, i get you to fill out a questionnaire about your application as feedfore.

          ------------------
          michael mattias
          tal systems inc.
          racine wi usa
          mailto:[email protected][email protected]</a>
          www.talsystems.com


          [this message has been edited by michael mattias (edited december 22, 2002).]
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            I will send one of my email addresses.

            At this point I am just plain furious, I don't know what I will end up doing. But converting is definately a possibility.

            Thanks,

            Comment


            • #7
              Better solution might be to get an ODBC driver for the PC.. I know there are PC (and 'nix) ODBC drivers for DB/2, which is what QMF is reading. (QMF=Query Management Facility for those not familiar with mainframe software. A screen-interface "command-line" where you can enter SQL statements against a database and get your results back on your terminal.)

              There are also some quasi-proprietary interfaces available to read VSAM and QSAM mainframe files over a PC-connection.

              The "rights" and "permissions" things I can't help with, but if you need to tell a boss if you get all the rights, the technical part of the interface is existing technology, maybe that's a start.

              MCM


              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Thank you very much once again! It worked fine!

                ------------------

                Comment

                Working...
                X