View previous topic :: View next topic
|
Author |
Message |
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
in my subprogram, I have below CICS statement:
Code: |
*EXEC CICS
* GETMAIN SET (CMLAPCMA-DB-BUFF-PTR (WK-BUF-IDX) )
* FLENGTH (CMLSEADR-DB-BUFFER-LEN)
* INITIMG (WK-INITIAL-VALUE)
* NOSUSPEND
*END-EXEC
Call 'DFHEI1' using by content X'0c02b000070000ec00f0
- 'f0f1f5f2404040' by reference CMLAPCMA-DB-BUFF-PTR
(WK-BUF-IDX) by content X'0000' by reference WK-INITIAL-VALUE
by reference CMLSEADR-DB-BUFFER-LEN end-call
* |
I copied the translated statement for GETMAIN, and take its place in the progrm.
when I move 0 to CMLSEADR-DB-BUFFER-LEN and test it , the called subprogram in endless loop... that is, the subprogram is called again and again...
below is my display message when subprogram is executed, showing this:
Code: |
IN SUB PROGRAM...
IN SUB PROGRAM...
IN SUB PROGRAM...
IN SUB PROGRAM... |
why endless loop occurred? can you advise?thanks. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you post enough code for someone to be able to help (NOT the entire program).
From what little you've posted, it appears you have some kind of programming error. Possibly because the code returns to the call over and over. . . |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Add the NOHANDLE keyword to the GETMAIN API. After the GETMAIN, check EIBRESP for an error; DFHRESP(LENGERR) which is 22 or DFHRESP(NOSTG) which is 42. Most likely, it will be 22.
The EIBRCODE will equal X'E10000000000 (when EIBRESP is 22) or X'E20000000000 (when EIBRESP is 42).
The EIBFN for a GETMAIN API is X'0C02'.
Please post the Picture Clause for CMLSEADR-DB-BUFFER-LEN.
Try debugging the transaction using CEDF. After you execute the GETMAIN API, check the above EIB fields for the values posted. A value of other than ZERO for EIBRESP and other than LOW-VALUES for EIBRCODE is considered an error in this API. |
|
Back to top |
|
|
Peter cobolskolan
Active User
Joined: 06 Feb 2012 Posts: 104 Location: Sweden
|
|
|
|
I assume this is the same program as in your previous post. The code you showed contained a Handle Abend. I asked you why, but no answer.
I ask the same question again, because Handle Abend tells CICS that "I have a better way to handle the error than you!".
This might be the cause of the loop, as a Getmain with zero length ALWAYS casues an error.
By the way: Why zero length?
If this might occur, you should check for zero and avoid the Getmain.
Solve the problem with the zero length befor you go on, this is probably the real error. |
|
Back to top |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
hi, BIll,
there is no NOHANDLE keyword in GETMAIN grammar:
Quote: |
GETMAIN
GETMAIN SET(ptr-ref) FLENGTH(data-value)
BELOW
LENGTH(data-value)
INITIMG(data-value)
SHARED NOSUSPEND USERDATAKEY
CICSDATAKEY
Conditions: LENGERR, NOSTG |
|
|
Back to top |
|
|
Peter cobolskolan
Active User
Joined: 06 Feb 2012 Posts: 104 Location: Sweden
|
|
|
|
I recommend you read about Resp Option for CICS Commands, which would clarify the Nohandle This outdates the Handle Condition, which I saw in your pervious post. This was used pre -85, and the preferred method is the Resp Option, when you write a new program.
I assume you havent specified the Handle Condition for Lengerr, neither you have the Resp Option. When an error occurs, the CICS default is to abend the task. But with my assumption that you have the Handle Abend in your program, this ovverrides CICS actions for handling the error, and your routine gets control.
As you really dont know how to handle CICS raised conditions, you might end up in illogic and eventully a loop. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Just reviewed your previous post and CMLSEADR-DB-BUFFER-LEN is in fact, a fullword. An error can easily be raised (such as a zero-length) when the FLENGTH keyword is used with a halfword (9999 COMP) and this why the Picture Clause was requested. So, you're OK with this field.
You need to review the NOHANDLE and RESP options of a given CICS API, introduced in the mid/late 1980's with CICS/MVS 1.7.
I agree with Peter that a HANDLE ABEND is worse than just letting the transaction ABEND on its own.
When a HANDLE CONDITION is coded, an internal GETMAIN is issued and a subsequent FREEMAIN is issued either at enclave termination or at task termination.
Using NOHANDLE or RESP eliminates these internal GETMAIN's/FREEMAIN's. |
|
Back to top |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
thanks for your suggestion.
I have coded input length check before GETMAIN. |
|
Back to top |
|
|
|