C语言 DSNAME 长度无效的 IBM Window Services (DWS) CSRIDAC



我正在研究z/OS,并尝试使用IBM提供的Window服务。 除了通过其 DSNAME 创建对象之外,一切都运行良好。

当我使用 DSNAME 调用 CSRIDAC 时,出现错误:"系统无法分配或取消分配 指定为 object_name 的数据集。值 rrrr 是返回代码 从动态分配。值 nnnn 是双字节原因 来自动态分配的代码。请参阅 z/OS MVS 编程: 动态分配返回的授权汇编服务指南 和原因代码。

所以我搜索了原因码 037c 的含义,发现:"文本单元中指定的 LEN 无效。随附的消息IKJ56231I指示错误文本单元的编号。

因此,似乎窗口服务正在调用动态分配服务以通过其 DSNAME 创建对象,并且在计算我提供的 DSNAME 中的字符数时出错。

我的 DSNAME 是一个有效的 VSAM 文件名,我使用相同的 DSNAME 通过另一种方式成功读取了此数据集。

好吧,这是我调用CSRIDAC函数的函数的代码:

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%xn", 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;
}

然后,这里是调用此函数的代码:

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);

我希望我对这个问题的解释是清楚的。如果不是,请随时提出一些问题。 谢谢!

我发现了我的错误并发布了答案。 我使用以下行将名称复制到数组中:

memcpy(&pobject->acObjectName[0], pcObjectName, strlen(pcObjectName));

但!当我把这个数组放在我的参数列表中时,我使用以下代码行:

pobject->pparmList[2] = (int32_t) &pobject->parmObject.acObjectName[0];

这意味着名称在pobject->acObjectName中,我将pobject->parmObject.acObjectName放在参数列表中。这两个数组不是相同的变量...

我很抱歉我的错误,并确认 DWS 运行良好。

相关内容

  • 没有找到相关文章

最新更新