Unexpected Behavior in a returned List


I am using Managed COBOL on .NET and I fetch a list of customers from the Oracle Database and then add them to a list of type List[Customer]

the problem is at the debug everything is okay and the list is 100% filled with the right objects with the right values and when it's returned to be set to another list on the other also managed project - I've separated the business logic from the desktop view in two projects- the result is having the list filled with the object of the last entry of the list that was originally fetched for example if the list has the values 





the result of returning the list is 





and I repeat at debug time every thing is okay at the business logic project!!

could anyone please tell me what's going on ??

Best Regards


  • Can you please zip up your project and send to me at chris.glazier@microfocus.com so that I can review it?

    Also include notes on where in the program the problem is occurring?


  • Verified Answer

    Dear Chris,

    Tank you very much. I'd figured it, the problem was that I just change the attributes of an object at the local-storage section of the method so I keep changing the same object and adding it to the list which practically means that I just add a new reference to the same object to the list, so I just changed my code to add a new object with the newly fetched values dynamically and I wrote a constructor that takes the record as an argument so it now looks like:

    write customers-list from new Entities.Customer(customer-record)

    and as usual fro COBOL it just works!!

    Kind Regards