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.