Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
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    Post subject: why endless loop when CICS GETMAIN is executed for 0 length?
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

Site Director


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

PostPosted: Thu May 10, 2012 8:31 am    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu May 10, 2012 8:53 am    Post subject: Reply to: why endless loop when CICS GETMAIN is executed for
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    Post subject: Reply to: why endless loop when CICS GETMAIN is executed for
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    Post subject:
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    Post subject: Reply to: why endless loop when CICS GETMAIN is executed for
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu May 10, 2012 6:17 pm    Post subject: Reply to: why endless loop when CICS GETMAIN is executed for
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts CICS NEW SIT PARAMETERS CICS BEHAVIOR... Kyle Carroll CICS 0 Fri Nov 04, 2016 11:55 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us