Gen EDGE

 View Only

 Encyclopaedia, on object update getting error EAPI_OBJECT_PROTECTED_RC

Jump to Best Answer
Gintaras Svalbonas's profile image
Gintaras Svalbonas posted Jul 28, 2023 08:31 AM

We are using Gen8.6 with latest patches.

When I try to update an object's property I am getting error EAPI_OBJECT_PROTECTED_RC.

The model is new generated model from 8.5 version.

In documentation there is not so mach about this error, some where there is info that there could be because of a subset. 

I have checked, there is no subset of the model.

Please if some one knows why the object is locked and/or how to free it.

The log of upddemo.exe is following.

C:\Program Files (x86)\CA\Gen86\CSE\bin>upddemo.exe

****** MAIN MENU ******
1 - Encyclopedia Functions
2 - Model Functions
3 - Object Functions
4 - Subset Functions
5 - Checkout Functions
6 - User/Group Functions
7 - Authorization Functions
8 - Schema Functions
9 - Count Functions
10 - Update Functions
Select <Enter to Exit> -> 1

****** Encyclopedia Functions ******
1  - EApiConnectToEncy
2  - EApiDisconnectEncy
3  - EApiCommit
4  - EApiLogonUserId
5  - EApiPasswordValidate
6  - EApiFetchEncyInfo
7  - EApiFetchEncyModelIds
Select <Enter to Exit> -> 1

Inputs for function::EApiConnectToEncy
Database Parms  -> xxxx/xxxx@xxxx

Outputs for function::EApiConnectToEncy
Function return status is EAPI_CONNECT_FAILED_RC
Press <Enter> to Continue

****** Encyclopedia Functions ******
1  - EApiConnectToEncy
2  - EApiDisconnectEncy
3  - EApiCommit
4  - EApiLogonUserId
5  - EApiPasswordValidate
6  - EApiFetchEncyInfo
7  - EApiFetchEncyModelIds
Select <Enter to Exit> -> 1

Inputs for function::EApiConnectToEncy
Database Parms  -> ENCY2/ENCY2@gen86

Outputs for function::EApiConnectToEncy
Function return status is EAPI_SUCCESSFUL_RC
Press <Enter> to Continue

****** Encyclopedia Functions ******
1  - EApiConnectToEncy
2  - EApiDisconnectEncy
3  - EApiCommit
4  - EApiLogonUserId
5  - EApiPasswordValidate
6  - EApiFetchEncyInfo
7  - EApiFetchEncyModelIds
Select <Enter to Exit> -> 4

Inputs for function::EApiLogonUserId
User Id -> yyyy

Outputs for function::EApiLogonUserId
Function return status is EAPI_SUCCESSFUL_RC
Press <Enter> to Continue

****** Encyclopedia Functions ******
1  - EApiConnectToEncy
2  - EApiDisconnectEncy
3  - EApiCommit
4  - EApiLogonUserId
5  - EApiPasswordValidate
6  - EApiFetchEncyInfo
7  - EApiFetchEncyModelIds
Select <Enter to Exit> ->

****** MAIN MENU ******
1 - Encyclopedia Functions
2 - Model Functions
3 - Object Functions
4 - Subset Functions
5 - Checkout Functions
6 - User/Group Functions
7 - Authorization Functions
8 - Schema Functions
9 - Count Functions
10 - Update Functions
Select <Enter to Exit> -> 2


****** Model Functions ******
8  - EApiOpenModel
9  - EApiFetchModelInfo
10 - EApiFetchModelCreateInfo
11 - EApiFetchModelLastUpdateInfo
12 - EApiFetchModelParentInfo
13 - EApiFetchModelChkoutInfo
14 - EApiFetchModelByName
15 - EApiLockModel
16 - EApiUnLockModel
17 - EApiFetchAllModelObjects
18 - EApiFetchAllModelTypeObjs
Select <Enter to Exit> -> 15

Inputs for function::EApiLockModel
Model Id -> 89499840
Lock Type (0-Read) (1-Write) -> 1

Outputs for function::EApiLockModel
Function return status is EAPI_SUCCESSFUL_RC
Press <Enter> to Continue

****** Model Functions ******
8  - EApiOpenModel
9  - EApiFetchModelInfo
10 - EApiFetchModelCreateInfo
11 - EApiFetchModelLastUpdateInfo
12 - EApiFetchModelParentInfo
13 - EApiFetchModelChkoutInfo
14 - EApiFetchModelByName
15 - EApiLockModel
16 - EApiUnLockModel
17 - EApiFetchAllModelObjects
18 - EApiFetchAllModelTypeObjs
Select <Enter to Exit> ->

****** MAIN MENU ******
1 - Encyclopedia Functions
2 - Model Functions
3 - Object Functions
4 - Subset Functions
5 - Checkout Functions
6 - User/Group Functions
7 - Authorization Functions
8 - Schema Functions
9 - Count Functions
10 - Update Functions
Select <Enter to Exit> -> 10

******  Update Functions ******
87 - EApiAddObject
88 - EApiDelObject
89 - EApiAddAssoc
90 - EApiDelAssoc
91 - EApiReordrAssocBefr
92 - EApiReordrAssocAftr
93 - EApiUpSingleChar
94 - EApiUpCharArray
95 - EApiUpNumeric
96 - EApiCommitUpdate
97 - EApiUpRollback
Select <Enter to Exit> -> 95

Inputs for function::EApiUpNumeric
Object Id -> 66200964
PrpTypeCode -> 191
New Int Value -> 9

Function return status is EAPI_OBJECT_PROTECTED_RC
Press <Enter> to Continue

Andy Hebert's profile image
Broadcom Employee Andy Hebert Best Answer

I have opened a Support case for Gintaras and working to find a resolution.

Cheers,

Andy Hebert

Gen Support @ Broadcom

Daniel Stratton's profile image
Daniel Stratton

It's because you've locked the model with EApiLockModel.

Per https://techdocs.broadcom.com/us/en/ca-mainframe-software/devops/ca-gen/8-6/reference/encyclopedia-api-reference/model-lock-and-unlock.html, a read lock will prevent updates, a write lock will prevent access.

Gintaras Svalbonas's profile image
Gintaras Svalbonas

@Daniel Stratton 

The answer is not correct. You must lock model to be able to update objects.
Or else, you will get the error :
EAPI_MODEL_NOT_LOCKED_RC if the model is not locked for update

As per https://techdocs.broadcom.com/us/en/ca-mainframe-software/devops/ca-gen/8-6/reference/encyclopedia-api-reference/property-information/eapiupnumeric.html

Best Regards

Gintaras Svalbonas's profile image
Gintaras Svalbonas

Hello to all,

The bug was in my code. I was caching model ID & Object ID.

As a result I was trying to modify object from other model.

The misleading error message  EAPI_OBJECT_PROTECTED_RC was not expected.

I believe the error should be EAPI_MODEL_NOT_LOCKED_RC since the other model was not locked for edit.

The correct error would lead to examine program flow and wrong model id usage would be found mach faster.

Best Regards