Skip to main content

I've uploaded a simple c# project which uses a persistent object class and DevExpress XPO (xpress persistent objects) to bind a SQLite database table (called trans_item) to a DevExpress GridControl.  I have also uploaded a Visual COBOL project which tries to do the same thing.  I am trying to translate the c# persistent object class (trans_item) into Visual COBOL.  The problem I am having is in defining the attributes.  There are three DevExpress attributes I need to set.  I have looked at the Visual COBOL documentation on attributes and also at the the CustomAttributes solution under Micro focus Visual COBOL Samples.  The c# project works.  There is something wrong with how I am defining the attributes in Visual COBOL.  The editor gives an error of "incorrect program structure" for the first instance of "attribute" in the code.

The c# class looks like this:

using DevExpress.Xpo;

namespace CsSQLite
{
    public class trans_item :XPBaseObject {

        public trans_item() { }
        public trans_item(Session session) :
            base(session) {
        }

        [Key(AutoGenerate = false), Persistent("trans_item_id")]
        int ftrans_item_id = -1;

        [PersistentAlias("ftrans_item_id")]
        public int trans_item_id
        {
            get { return ftrans_item_id; }
        }


The Visual COBOL class is coded like this:

     class-id AM_420_PayeeActivity.trans_item inherits type XPBaseObject.
       
       working-storage section.

         01  ftrans_item_id            binary-long value -1.
         
       method-id NEW Public.
       procedure division.
           goback.
       end method.

       method-id NEW Public.
       procedure division using session as type Session.
           invoke super::new(session)
           goback.
       end method.
       
       attribute Key(AutoGenerate = false) Persistent("trans_item_id")
       
       attribute PersistentAlias("ftrans_item_id")
       property-id  trans_item_id binary-long public.
       getter.
         set property-value to ftrans_item_id
       end property.

I've uploaded a simple c# project which uses a persistent object class and DevExpress XPO (xpress persistent objects) to bind a SQLite database table (called trans_item) to a DevExpress GridControl.  I have also uploaded a Visual COBOL project which tries to do the same thing.  I am trying to translate the c# persistent object class (trans_item) into Visual COBOL.  The problem I am having is in defining the attributes.  There are three DevExpress attributes I need to set.  I have looked at the Visual COBOL documentation on attributes and also at the the CustomAttributes solution under Micro focus Visual COBOL Samples.  The c# project works.  There is something wrong with how I am defining the attributes in Visual COBOL.  The editor gives an error of "incorrect program structure" for the first instance of "attribute" in the code.

The c# class looks like this:

using DevExpress.Xpo;

namespace CsSQLite
{
    public class trans_item :XPBaseObject {

        public trans_item() { }
        public trans_item(Session session) :
            base(session) {
        }

        [Key(AutoGenerate = false), Persistent("trans_item_id")]
        int ftrans_item_id = -1;

        [PersistentAlias("ftrans_item_id")]
        public int trans_item_id
        {
            get { return ftrans_item_id; }
        }


The Visual COBOL class is coded like this:

     class-id AM_420_PayeeActivity.trans_item inherits type XPBaseObject.
       
       working-storage section.

         01  ftrans_item_id            binary-long value -1.
         
       method-id NEW Public.
       procedure division.
           goback.
       end method.

       method-id NEW Public.
       procedure division using session as type Session.
           invoke super::new(session)
           goback.
       end method.
       
       attribute Key(AutoGenerate = false) Persistent("trans_item_id")
       
       attribute PersistentAlias("ftrans_item_id")
       property-id  trans_item_id binary-long public.
       getter.
         set property-value to ftrans_item_id
       end property.

The c# project was too large to upload (greater than 64 kb) so I've only uploaded the Visual COBOL project.


I've uploaded a simple c# project which uses a persistent object class and DevExpress XPO (xpress persistent objects) to bind a SQLite database table (called trans_item) to a DevExpress GridControl.  I have also uploaded a Visual COBOL project which tries to do the same thing.  I am trying to translate the c# persistent object class (trans_item) into Visual COBOL.  The problem I am having is in defining the attributes.  There are three DevExpress attributes I need to set.  I have looked at the Visual COBOL documentation on attributes and also at the the CustomAttributes solution under Micro focus Visual COBOL Samples.  The c# project works.  There is something wrong with how I am defining the attributes in Visual COBOL.  The editor gives an error of "incorrect program structure" for the first instance of "attribute" in the code.

The c# class looks like this:

using DevExpress.Xpo;

namespace CsSQLite
{
    public class trans_item :XPBaseObject {

        public trans_item() { }
        public trans_item(Session session) :
            base(session) {
        }

        [Key(AutoGenerate = false), Persistent("trans_item_id")]
        int ftrans_item_id = -1;

        [PersistentAlias("ftrans_item_id")]
        public int trans_item_id
        {
            get { return ftrans_item_id; }
        }


The Visual COBOL class is coded like this:

     class-id AM_420_PayeeActivity.trans_item inherits type XPBaseObject.
       
       working-storage section.

         01  ftrans_item_id            binary-long value -1.
         
       method-id NEW Public.
       procedure division.
           goback.
       end method.

       method-id NEW Public.
       procedure division using session as type Session.
           invoke super::new(session)
           goback.
       end method.
       
       attribute Key(AutoGenerate = false) Persistent("trans_item_id")
       
       attribute PersistentAlias("ftrans_item_id")
       property-id  trans_item_id binary-long public.
       getter.
         set property-value to ftrans_item_id
       end property.

I've made this correction but still get the error:

      attribute Key(property AutoGenerate = false) Persistent("trans_item_id")


I've uploaded a simple c# project which uses a persistent object class and DevExpress XPO (xpress persistent objects) to bind a SQLite database table (called trans_item) to a DevExpress GridControl.  I have also uploaded a Visual COBOL project which tries to do the same thing.  I am trying to translate the c# persistent object class (trans_item) into Visual COBOL.  The problem I am having is in defining the attributes.  There are three DevExpress attributes I need to set.  I have looked at the Visual COBOL documentation on attributes and also at the the CustomAttributes solution under Micro focus Visual COBOL Samples.  The c# project works.  There is something wrong with how I am defining the attributes in Visual COBOL.  The editor gives an error of "incorrect program structure" for the first instance of "attribute" in the code.

The c# class looks like this:

using DevExpress.Xpo;

namespace CsSQLite
{
    public class trans_item :XPBaseObject {

        public trans_item() { }
        public trans_item(Session session) :
            base(session) {
        }

        [Key(AutoGenerate = false), Persistent("trans_item_id")]
        int ftrans_item_id = -1;

        [PersistentAlias("ftrans_item_id")]
        public int trans_item_id
        {
            get { return ftrans_item_id; }
        }


The Visual COBOL class is coded like this:

     class-id AM_420_PayeeActivity.trans_item inherits type XPBaseObject.
       
       working-storage section.

         01  ftrans_item_id            binary-long value -1.
         
       method-id NEW Public.
       procedure division.
           goback.
       end method.

       method-id NEW Public.
       procedure division using session as type Session.
           invoke super::new(session)
           goback.
       end method.
       
       attribute Key(AutoGenerate = false) Persistent("trans_item_id")
       
       attribute PersistentAlias("ftrans_item_id")
       property-id  trans_item_id binary-long public.
       getter.
         set property-value to ftrans_item_id
       end property.

https://www.dropbox.com/s/h5iqpt4wi792aly/CsSQLite.zip

This is a link to the c# project.


I've uploaded a simple c# project which uses a persistent object class and DevExpress XPO (xpress persistent objects) to bind a SQLite database table (called trans_item) to a DevExpress GridControl.  I have also uploaded a Visual COBOL project which tries to do the same thing.  I am trying to translate the c# persistent object class (trans_item) into Visual COBOL.  The problem I am having is in defining the attributes.  There are three DevExpress attributes I need to set.  I have looked at the Visual COBOL documentation on attributes and also at the the CustomAttributes solution under Micro focus Visual COBOL Samples.  The c# project works.  There is something wrong with how I am defining the attributes in Visual COBOL.  The editor gives an error of "incorrect program structure" for the first instance of "attribute" in the code.

The c# class looks like this:

using DevExpress.Xpo;

namespace CsSQLite
{
    public class trans_item :XPBaseObject {

        public trans_item() { }
        public trans_item(Session session) :
            base(session) {
        }

        [Key(AutoGenerate = false), Persistent("trans_item_id")]
        int ftrans_item_id = -1;

        [PersistentAlias("ftrans_item_id")]
        public int trans_item_id
        {
            get { return ftrans_item_id; }
        }


The Visual COBOL class is coded like this:

     class-id AM_420_PayeeActivity.trans_item inherits type XPBaseObject.
       
       working-storage section.

         01  ftrans_item_id            binary-long value -1.
         
       method-id NEW Public.
       procedure division.
           goback.
       end method.

       method-id NEW Public.
       procedure division using session as type Session.
           invoke super::new(session)
           goback.
       end method.
       
       attribute Key(AutoGenerate = false) Persistent("trans_item_id")
       
       attribute PersistentAlias("ftrans_item_id")
       property-id  trans_item_id binary-long public.
       getter.
         set property-value to ftrans_item_id
       end property.

Hi Phil,

The attributes should be defined as part of the field, property or method definition.
Please see the C#-->COBOL comparison examples in the docs under General Reference-->Managed COBOL-->Comparison of COBOL with other managed languages-->Attributes.

Example:

        working-storage section.
        01  areaCode                  string private.
        01  acctName                  string private.
        01  ftrans_item_id            binary-long value -1
              attribute Key("AutoGenerate" = false)
              attribute Persistent("trans_item_id").
      method-id NEW Public.
      procedure division.
          goback.
      end method.

      method-id NEW Public.
      procedure division using session as type Session.
          invoke super::new(session)
          goback.
      end method.

      property-id  trans_item_id binary-long public
          attribute PersistentAlias("ftrans_item_id").
      getter.
        set property-value to ftrans_item_id
      end property.


I've uploaded a simple c# project which uses a persistent object class and DevExpress XPO (xpress persistent objects) to bind a SQLite database table (called trans_item) to a DevExpress GridControl.  I have also uploaded a Visual COBOL project which tries to do the same thing.  I am trying to translate the c# persistent object class (trans_item) into Visual COBOL.  The problem I am having is in defining the attributes.  There are three DevExpress attributes I need to set.  I have looked at the Visual COBOL documentation on attributes and also at the the CustomAttributes solution under Micro focus Visual COBOL Samples.  The c# project works.  There is something wrong with how I am defining the attributes in Visual COBOL.  The editor gives an error of "incorrect program structure" for the first instance of "attribute" in the code.

The c# class looks like this:

using DevExpress.Xpo;

namespace CsSQLite
{
    public class trans_item :XPBaseObject {

        public trans_item() { }
        public trans_item(Session session) :
            base(session) {
        }

        [Key(AutoGenerate = false), Persistent("trans_item_id")]
        int ftrans_item_id = -1;

        [PersistentAlias("ftrans_item_id")]
        public int trans_item_id
        {
            get { return ftrans_item_id; }
        }


The Visual COBOL class is coded like this:

     class-id AM_420_PayeeActivity.trans_item inherits type XPBaseObject.
       
       working-storage section.

         01  ftrans_item_id            binary-long value -1.
         
       method-id NEW Public.
       procedure division.
           goback.
       end method.

       method-id NEW Public.
       procedure division using session as type Session.
           invoke super::new(session)
           goback.
       end method.
       
       attribute Key(AutoGenerate = false) Persistent("trans_item_id")
       
       attribute PersistentAlias("ftrans_item_id")
       property-id  trans_item_id binary-long public.
       getter.
         set property-value to ftrans_item_id
       end property.

Thanks.  It works well now.  It takes 1 second to load the grid with 30,000 records.