IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

why endless loop when CICS GETMAIN is executed for 0 length?


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu May 10, 2012 7:50 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu May 10, 2012 8:31 am
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu May 10, 2012 8:53 am
Reply with quote

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
View user's profile Send private message
Peter cobolskolan

Active User


Joined: 06 Feb 2012
Posts: 104
Location: Sweden

PostPosted: Thu May 10, 2012 10:27 am
Reply with quote

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
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu May 10, 2012 11:44 am
Reply with quote

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
View user's profile Send private message
Peter cobolskolan

Active User


Joined: 06 Feb 2012
Posts: 104
Location: Sweden

PostPosted: Thu May 10, 2012 11:53 am
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu May 10, 2012 6:17 pm
Reply with quote

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
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu May 10, 2012 6:29 pm
Reply with quote

thanks for your suggestion.

I have coded input length check before GETMAIN.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Using API Gateway from CICS program CICS 0
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
Search our Forums:

Back to Top