I'm working on z/OS and trying to use the Window Services provided by IBM. Everything work perfectly except the creation of an object by its DSNAME.
When I call CSRIDAC with a DSNAME I have the error : "The system was unable to allocate or unallocate the data set specified as object_name. The value rrrr is the return code from dynamic allocation. The value nnnn is the two-byte reason code from dynamic allocation. See z/OS MVS Programming: Authorized Assembler Services Guide for dynamic allocation return and reason codes."
So I searched for the meaning of the reason code which is 037c and found : "Invalid LEN specified in text unit. The accompanying message IKJ56231I indicates the number of the text unit in error."
So, it seems that the Window Services is calling the Dynamic Allocation service to create the object by its DSNAME and it makes a mistake when it counts the number of characters in the DSNAME I provided.
My DSNAME is a valid VSAM file name and I successfully read this dataset by another way with the same DSNAME.
Well, here is the code of my function calling the CSRIDAC function :
ozwinsrvObject *ozwinsrvObjectCreate(uint32_t uiFlags, int32_t iObjectSize, uint8_t *pcObjectName, int32_t *piHighOffset, int32_t *piRc)
{
ozwinsrvObject *pobject = __malloc31(sizeof(ozwinsrvObject));
*piRc = OZWINSRV_NO_ERROR;
pobject->pheap = __malloc31(18*4);
pobject->pparmList = __malloc31(11 * sizeof(int32_t));
memcpy(&pobject->parmObject.acOpType[0] , "BEGIN", 5);
pobject->parmObject.iObjectSize = iObjectSize;
pobject->parmObject.iHighOffset = *piHighOffset;
if(uiFlags & OZWINSRV_OBJECT_F_TYPE_DDNAME)
{
memcpy(&pobject->parmObject.acObjectType[0], "DDNAME ", 9);
}
else {
if(uiFlags & OZWINSRV_OBJECT_F_TYPE_DSNAME)
{
memcpy(&pobject->parmObject.acObjectType[0], "DSNAME ", 9);
}
else
{
memcpy(&pobject->parmObject.acObjectType[0], "TEMPSPACE", 9);
}
}
if(uiFlags & OZWINSRV_OBJECT_F_SCROLL_AREA_YES)
{
memcpy(&pobject->parmObject.acScrollArea[0], "YES", 3);
}
else
{
memcpy(&pobject->parmObject.acScrollArea[0], "NO ", 3);
}
if(uiFlags & OZWINSRV_OBJECT_F_STATE_NEW)
{
memcpy(&pobject->parmObject.acObjectState[0], "NEW", 3);
}
else
{
memcpy(&pobject->parmObject.acObjectState[0], "OLD", 3);
}
if(uiFlags & OZWINSRV_OBJECT_F_ACCESS_MODE_UPDATE)
{
memcpy(&pobject->parmObject.acAccessMode[0], "UPDATE", 6);
}
else
{
memcpy(&pobject->parmObject.acAccessMode[0], "READ ", 6);
}
memcpy(&pobject->acObjectName[0], pcObjectName, strlen(pcObjectName));
if(strlen(pcObjectName) < 45)
{
pobject->acObjectName[strlen(pcObjectName)] = ' ';
}
memset(pobject->pparmList, 0, 11 * sizeof(int32_t));
pobject->pparmList[0] = (int32_t) &pobject->parmObject.acOpType[0];
pobject->pparmList[1] = (int32_t) &pobject->parmObject.acObjectType[0];
pobject->pparmList[2] = (int32_t) &pobject->parmObject.acObjectName[0];
pobject->pparmList[3] = (int32_t) &pobject->parmObject.acScrollArea[0];
pobject->pparmList[4] = (int32_t) &pobject->parmObject.acObjectState[0];
pobject->pparmList[5] = (int32_t) &pobject->parmObject.acAccessMode[0];
pobject->pparmList[6] = (int32_t) &pobject->parmObject.iObjectSize;
pobject->pparmList[7] = (int32_t) &pobject->acObjectId[0];
pobject->pparmList[8] = (int32_t) &pobject->parmObject.iHighOffset;
pobject->pparmList[9] = (int32_t) &pobject->parmObject.iRc;
pobject->pparmList[10] = (int32_t) &pobject->parmObject.iReasonC;
x6csridac(pobject->pparmList, pobject->pheap);
if(pobject->parmObject.iRc != 0)
{
printf("Error creating object (csridac) Rc=0x%x, ReasonC=0x%x\n", pobject->parmObject.iRc, pobject->parmObject.iReasonC);
*piRc = OZWINSRV_ERROR_WINDOW_OBJECT_CREATE;
}
*piHighOffset = pobject->parmObject.iHighOffset;
pobject->iObjectSize = iObjectSize;
pobject->uiFlags = uiFlags;
pobject->uiNbViews = 0;
return pobject;
}
Then, here is the code calling this function :
int32_t iRc = 0;
int32_t iPageSize = 32*1024;
int32_t iPageOffset = iPageSize/4/1024;
int32_t iSize = 1;
int32_t iRealSize = 1;
ozwinsrvObject *pObject;
ozwinsrvWindow *pWindow;
uint8_t acFileName[] = "DSNB10.DSNDBC.DBTLS00.TS1449.I0001.A001";
pObject = ozwinsrvObjectCreate(OZWINSRV_OBJECT_F_ACCESS_MODE_READ | OZWINSRV_OBJECT_F_SCROLL_AREA_NO | OZWINSRV_OBJECT_F_STATE_OLD | OZWINSRV_OBJECT_F_TYPE_DSNAME,
iSize, &acFileName[0], &iRealSize, &iRc);
I hope my explanation of the problem is clear. Feel free to ask some questions if it's not. Thanks !
I have found my error and posting the answer. I use the following line to copy the name in an array:
memcpy(&pobject->acObjectName[0], pcObjectName, strlen(pcObjectName));
But! When I put this array in my parameter list I use this line of code :
pobject->pparmList[2] = (int32_t) &pobject->parmObject.acObjectName[0];
This means that the name is in pobject->acObjectName and I put pobject->parmObject.acObjectName in the parameter list. These two arrays are not the same variables...
I'm sorry for my mistake and confirm that the DWS works well.