Skip to main content

When creating a table, DBCONNECT will move key values to the top of the row. For example a file definition of;

          select MyTable assign to "MyTable"
               lock mode is manual
               organization is indexed
               access is dynamic
               record key is MyKey with duplicates
               file status is MyStatus.

      ******************************************************************
       data division.
       file section.

       fd  MyTable.
       01  MyRecord.
           03 MyField1         pic 9(5).
           03 MyField2         pic x(3).
           03 MyField3         pic 9(5).
           03 MyField4         pic 9(5).
           03 MyField5         pic 9(5).
           03 MyKey            pic x(3).
          

Will generate a table that looks like this;

My question is;

Why does DB connect do this and if i create a table outside of DBCONNECT, do i need to ensure keys are at the top of the table?

Thanks in advance for any help

My environment is;

Windows running Microsoft SQLSERVER
Visual-COBOL-SOA-Visual-Studio(PA) Version 7
DBConnector-SQLP(PA) Version 7

When creating a table, DBCONNECT will move key values to the top of the row. For example a file definition of;

          select MyTable assign to "MyTable"
               lock mode is manual
               organization is indexed
               access is dynamic
               record key is MyKey with duplicates
               file status is MyStatus.

      ******************************************************************
       data division.
       file section.

       fd  MyTable.
       01  MyRecord.
           03 MyField1         pic 9(5).
           03 MyField2         pic x(3).
           03 MyField3         pic 9(5).
           03 MyField4         pic 9(5).
           03 MyField5         pic 9(5).
           03 MyKey            pic x(3).
          

Will generate a table that looks like this;

My question is;

Why does DB connect do this and if i create a table outside of DBCONNECT, do i need to ensure keys are at the top of the table?

Thanks in advance for any help

My environment is;

Windows running Microsoft SQLSERVER
Visual-COBOL-SOA-Visual-Studio(PA) Version 7
DBConnector-SQLP(PA) Version 7

i work without dbconnector and had no problem to move data from isam to MS SQLSERVER. 

I know that oracle had a separate necessary key, but this is not by MSSQL!

Why do you dbconnector?

All commands are possible with sql commands starting in cobol with exec sql and ending with end-exec


When creating a table, DBCONNECT will move key values to the top of the row. For example a file definition of;

          select MyTable assign to "MyTable"
               lock mode is manual
               organization is indexed
               access is dynamic
               record key is MyKey with duplicates
               file status is MyStatus.

      ******************************************************************
       data division.
       file section.

       fd  MyTable.
       01  MyRecord.
           03 MyField1         pic 9(5).
           03 MyField2         pic x(3).
           03 MyField3         pic 9(5).
           03 MyField4         pic 9(5).
           03 MyField5         pic 9(5).
           03 MyKey            pic x(3).
          

Will generate a table that looks like this;

My question is;

Why does DB connect do this and if i create a table outside of DBCONNECT, do i need to ensure keys are at the top of the table?

Thanks in advance for any help

My environment is;

Windows running Microsoft SQLSERVER
Visual-COBOL-SOA-Visual-Studio(PA) Version 7
DBConnector-SQLP(PA) Version 7

The columns of the table including COBOL keys do not need to be in any particular order as they are mapped by name and not position within the table. I created a test here and successfully opened and wrote records to an existing table where the COBOL key field was defined at the end and it worked fine.


The columns of the table including COBOL keys do not need to be in any particular order as they are mapped by name and not position within the table. I created a test here and successfully opened and wrote records to an existing table where the COBOL key field was defined at the end and it worked fine.

I agree with your sentiment but if that is the case then why does DB CONNECTOR move the keys to the top of the table?

Is there a reason for that? If it makes no difference where the key is then why move it?