I have to delete an object from metadata with id "Id" (from logins dataset) and create a new one with the name "TestObject".
I did like this:
length uri $256;
add_uri = "omsobj:Login?@Name='TestObject'";
del_uri = "omsobj:Login?@Id='" || trim(Id) || "'";
rc = metadata_delobj(del_uri);
if(rc<0) then do;
putlog "WARNING: Cannot delete uri: " del_uri;
putlog "INFO: Deleted uri: " del_uri;
* Add a new object if deletion was succsessfull
rc=metadata_newobj("Login", add_uri, Name="TestObject");
if(rc<0) then do;
putlog "WARNING: Cannot add uri: " del_uri;
putlog "INFO: Added uri: " add_uri;
but it works not like I want.
It deletes the object and creates a new one, but with name " 0" instead of "TestObject" O_o
Can please somebody explain me why?
Probably I don't understand completely which value should have URI...
My thoughts are that if I needed to write code to alter the metadata, I would call Tech Support for more help if my first attempt did not have the desired results. I'm very conservative --very conservative-- with the metadata. Of course, one of the reasons that I'm very conservative with the metadata is that I am the person who, with one JCL job, managed to delete the production load library out from under the queue of production jobs waiting to execute. (All because I did not check that there was a beginning comment in some code I was testing.)
Of course, that was when I was just starting out mumblety-mumble years ago in a mainframe shop. And there is a difference between a production load library and the metadata server. But you asked for my thoughts and my thoughts are that if I were at the point you're at, I would contact Tech Support. Certainly if you post your code and questions here, other folks might have some insight.