View previous topic :: View next topic
|
Author |
Message |
sedireswarapu
New User
Joined: 18 Jun 2008 Posts: 28 Location: India
|
|
|
|
Hi,
am using a C CICS program to read contents from ESDS VSAM
Pls find below the code snippet :
Code: |
DFHEIBLK* pEIBlock;
short int BuffLen;
char* Buffer;
BuffLen = MAX_TEXTLINE_SIZE; //equal to 256
EXEC CICS ADDRESS EIB(pEIBlock);
CurRecNum = 0;
EXEC CICS STARTBR FILE("BTMPLOG ")
RIDFLD(CurRecNum)
RBA;
Buffer =
(char*) malloc (sizeof (char) * (MAX_TEXTLINE_SIZE));
memset (Buffer, ' ' , MAX_TEXTLINE_SIZE);
do{
EXEC CICS READNEXT INTO(Buffer)
LENGTH(BuffLen)
FILE("BTMPLOG ")
RIDFLD(&CurRecNum)
RBA;
memset (Buffer, ' ' , MAX_TEXTLINE_SIZE);
}while(); |
The above code does read operation in a sequential manner (trying to read line by line in ESDS) until it finds end of CICS file. But am getting EISRESP-22 and EIBRESP2-11 in the READNEXT when it tries to read second time, first time it reads successfully and response code = 0.
Response code =11 suggests that there is a length error but in the above code i have given 256 as buffer len and buffer allocated exactly to that size, am not able to figure out why its reporting this error (also each line in ESDS is not that long ).
Please advise.
Thanks. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
From the CICS Programming Reference manual (link at the top of the page) with emphasis added by me:
Quote: |
LENGTH(data-area)
specifies the length, as a halfword binary value, of the data area where the record is to be put. On completion of the READNEXT command, the LENGTH parameter contains the actual length of the record. |
So the question becomes, where do you set BuffLen back to 256 after the first read? If the second record is longer than the first, you would very definitely get RESP=22, RESP2=11 on a READNEXT. |
|
Back to top |
|
|
sedireswarapu
New User
Joined: 18 Jun 2008 Posts: 28 Location: India
|
|
|
|
You are CORRECT. Very bad of me should have gone thorough the manuals. Thanks very much it works for me now. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Glad to hear it's working. |
|
Back to top |
|
|
|