Page 1 of 1

GETMAIN RESP

PostPosted: Fri Jul 13, 2012 9:45 am
by elixir
Hi

I using GETMAIN to obtain memory for my Linkage section in Cobol CICS Program. Im checking response as below,

EXEC CICS
GETMAIN ..
RESP(WS-ROSP)
END-EXEC

IF WS-ROSP not equal to DFHRESP(NORMAL)

MOVE EIBRESP to WS-1 (--This X(02))
MOVE EIBRESP to WS-2 (--This X(03))

RETURN to CICS

END-IF

Im am trying to display the error code on Screen using WS-1 and WS-2.

The error code isnot getting displayed properly. Im aware that the EIRESP and EIBRESP2 are 4 bytes Comp --> S9(08) COMP.

Please help me display the error code correctly. For eg if there is LENGTHERR the I should get EIBRESP 22. (please correct me if Im wrong with the error code interpretation)

Re: GETMAIN RESP

PostPosted: Fri Jul 13, 2012 10:30 am
by NicC
s9(8) is 8 digits so why are you only providing space for 2 and 3 digits? And what do you mean by 'not getting displayed properly'? Are you getting them upside down, back to front or what?

Re: GETMAIN RESP

PostPosted: Fri Jul 13, 2012 11:22 am
by Monitor
Normally there is no need to check the numeric value of the resp-field. Thats why you have the ability to check ii via DFHRESP(resp-name). The translator will do the job for you.
If you run EDF, you will see the resp returned from your EXEC-command.

Re: GETMAIN RESP

PostPosted: Fri Jul 13, 2012 4:51 pm
by Robert Sample
You need to find the COBOL Language Reference manual and read up on internal formats for data. The actual value of an EIBRESP 22 code as stored in COBOL is X'00000016' which is the binary value 22. Moving this value to a PIC X(2) variable will give you X'0000' since alphanumeric data is moved left to right (as opposed to numeric moves, which is decimal-adjusted before moving). Even if you did the move correctly, your PIC X(2) variable would have the value X'0016' in it -- not conducive to being displayed on a screen.

If you want to display the numeric EIBRESP value (which is quite likely the WORST single way to handle the abnormal response code -- learn to use the DFH values), you'll need a PIC 9(3) variable defined on your screen so the data can be moved as a number.

Re: GETMAIN RESP

PostPosted: Fri Jul 13, 2012 9:04 pm
by elixir
The WS-ROSP contains always EIBRESP?

I went thru the manual but not able to understand the significance of EIBRESP2

Re: GETMAIN RESP

PostPosted: Fri Jul 13, 2012 9:30 pm
by Monitor
In your case WS-ROSP containt th value from EIBRESP. Thats what you have told the translator to do, when you coded RESP(WS-ROSP). Have a look at the translator listing.
I had a short look at the manual and found the following:
EIBRESP2
contains more detailed information that may help explain why the RESP condition occurred. This field contains meaningful values, as documented with each command to which it applies.

Do you hav a problem understanding that?
I also had a look at the GETMAIN command and found the information here:
http://publib.boulder.ibm.com/infocente ... fields.htm

There are only two (2) conditions returned, apart from NORMAL, from this command.
LENGERR
RESP2 values:
1
The FLENGTH value is less than 1 or greater than the length of the target storage area from which the request is to be satisfied. See the discussion about DSAs in CICS storage allocation.

Also occurs if the LENGTH value is zero.

Default action: terminate the task abnormally.
NOSTG
RESP2 values:
2
The storage requested is more than is currently available in the target DSA. See the discussion about DSAs in CICS storage allocation.

Default action: ignore the condition. An active HANDLE CONDITION NOSTG also raises this condition.


If you have a problem with your program, just use CEDF and you will se the information you are after.
If you GETMAIN doesnt return a NORMAL condition, you shouldnt handle this in your program.
Default action is to ABEND the task.

Re: GETMAIN RESP

PostPosted: Mon Jul 16, 2012 8:50 pm
by elixir
The way I handled is as below,
Declared 2 WS storage variable, var1 pic 9(04) var2 pic9(04)

EXEC CICS
GETMAIN ..
RESP(WS-ROSP)
END-EXEC

IF WS-ROSP not equal to DFHRESP(NORMAL)

MOVE EIBRESP to var1
MOVE EIBRESP to var2

RETURN to CICS

END-IF

Im able to display in the screen the response code in case of GETMAIN failure

Also in my case WS-ROSP always contains EIBRESP.

Thanks to all for the help

Re: GETMAIN RESP

PostPosted: Mon Jul 16, 2012 11:31 pm
by Robert Sample
Make sure your VAR1 has at least 3 characters to display the response code since they can have values over 100 nowadays.