gpt4 book ai didi

c - DSNAME 长度无效的 IBM Window Services (DWS) CSRIDAC

转载 作者:行者123 更新时间:2023-11-30 16:31:06 28 4
gpt4 key购买 nike

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

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

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

因此,Windows 服务似乎正在调用动态分配服务来通过其 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%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;
}

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

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 运行良好。

关于c - DSNAME 长度无效的 IBM Window Services (DWS) CSRIDAC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50792767/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com