I would like to be able to use an FD record layout in a derived class. I don't want any instance of the class to be able to use the fields in the record layout so I have them marked as private. I would rather use protected. Can this be done?
below is the code that I am working with. If I make the private field protected I get the following compile error
Error 2 COBCH0885 : Visibility attributes can only be used with native managed types at 01
select test-file
assign to "\\temp\\test.dat"
organization is indexed
access is dynamic
record key is test-key
lock mode is manual
file status is fileStatus.
fd test-file.
01 test-rec private.
05 test-key pic x(07) private.
#VisualCOBOLYou can't directly mark groups, or members of groups as anything other than private. Only fields mapping directly onto managed types (binary-long, string object references) are allowed to have more than private visibility. However, you can mark fields in the record definition as properties, something like:
$set sourceformat(free)
class-id a.
select test-file
assign to "\\temp\\test.dat"
organization is indexed
access is dynamic
record key is test-key
lock mode is manual.
fd test-file.
01 test-rec property protected.
05 test-key pic x(07) property protected.
end class.
class-id b inherits type a.
method-id m.
set test-key to "ABCDEFG"
end method.
end class.
In this case, both test-rec and test-key are exposed as string properties, and access to the properties works by expanding the pic x field (or group) to a Unicode string for the get property and vice versa for the set property. In this example, setting the test-rec property and setting the test-key property will in fact update the same data area in the inherited program.
I would like to be able to use an FD record layout in a derived class. I don't want any instance of the class to be able to use the fields in the record layout so I have them marked as private. I would rather use protected. Can this be done?
below is the code that I am working with. If I make the private field protected I get the following compile error
Error 2 COBCH0885 : Visibility attributes can only be used with native managed types at 01
select test-file
assign to "\\temp\\test.dat"
organization is indexed
access is dynamic
record key is test-key
lock mode is manual
file status is fileStatus.
fd test-file.
01 test-rec private.
05 test-key pic x(07) private.
#VisualCOBOLThis seems to be working for me. Thanks a bunch.
I would like to be able to use an FD record layout in a derived class. I don't want any instance of the class to be able to use the fields in the record layout so I have them marked as private. I would rather use protected. Can this be done?
below is the code that I am working with. If I make the private field protected I get the following compile error
Error 2 COBCH0885 : Visibility attributes can only be used with native managed types at 01
select test-file
assign to "\\temp\\test.dat"
organization is indexed
access is dynamic
record key is test-key
lock mode is manual
file status is fileStatus.
fd test-file.
01 test-rec private.
05 test-key pic x(07) private.
#VisualCOBOLThis seems to be working for me. Thanks a bunch.
I would like to be able to use an FD record layout in a derived class. I don't want any instance of the class to be able to use the fields in the record layout so I have them marked as private. I would rather use protected. Can this be done?
below is the code that I am working with. If I make the private field protected I get the following compile error
Error 2 COBCH0885 : Visibility attributes can only be used with native managed types at 01
select test-file
assign to "\\temp\\test.dat"
organization is indexed
access is dynamic
record key is test-key
lock mode is manual
file status is fileStatus.
fd test-file.
01 test-rec private.
05 test-key pic x(07) private.
#VisualCOBOLThis seems to be working for me. Thanks a bunch.
I would like to be able to use an FD record layout in a derived class. I don't want any instance of the class to be able to use the fields in the record layout so I have them marked as private. I would rather use protected. Can this be done?
below is the code that I am working with. If I make the private field protected I get the following compile error
Error 2 COBCH0885 : Visibility attributes can only be used with native managed types at 01
select test-file
assign to "\\temp\\test.dat"
organization is indexed
access is dynamic
record key is test-key
lock mode is manual
file status is fileStatus.
fd test-file.
01 test-rec private.
05 test-key pic x(07) private.
#VisualCOBOLDo you know if there is a way to access the test-file in the derived class?
I would like to be able to use an FD record layout in a derived class. I don't want any instance of the class to be able to use the fields in the record layout so I have them marked as private. I would rather use protected. Can this be done?
below is the code that I am working with. If I make the private field protected I get the following compile error
Error 2 COBCH0885 : Visibility attributes can only be used with native managed types at 01
select test-file
assign to "\\temp\\test.dat"
organization is indexed
access is dynamic
record key is test-key
lock mode is manual
file status is fileStatus.
fd test-file.
01 test-rec private.
05 test-key pic x(07) private.
#VisualCOBOLI'm afraid we don't have any way of doing this at the moment.