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

Problem with Return or Exit from DCB ABEND Exit routine


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vishnu Priya M R

New User


Joined: 22 Aug 2018
Posts: 4
Location: India

PostPosted: Thu Aug 23, 2018 9:43 am
Reply with quote

Hi Everyone,

In our program, we have a OPEN instruction to open the file whose parameters or details are supplied through DCB.

When the user is providing an input file with an invalid member (like spelling mistake in the member name) by mistake , we are hitting a S013 abend in the OPEN instruction. For Example , if the Input DSN should be SXP.INPUT.DATA(BOOK1) ,but it was misspelled as SXP.INPUT.DATA(BOK1) .

When I expedited the program, it gives S013 abend at the OPEN instruction. In other cases when we give a wrong DDNAME, it moves on to the next instruction and sets a flag. So we can test the flag and set the error code. But here since we are hitting the abend in the OPEN instruction itself, I tried to use the DCB ABEND EXIT to handle it.

So I have coded the EXLST parameter with the exit routine in the DCB as below.
Code:

FACCDCB  DCB   DSORG=PS,         
               EODAD=EOFILE,     
               DDNAME=XXXXXXXX, 
               MACRF=GL,         
               BFTEK=A,         
               SYNAD=SYNS001,   
               EXLST=ABDEXIT     
ABDEXIT  DC    0F'0',X'91',AL3(MEMINVA)

MEMINVA  DS    0H                     
         L     R7,ABDRET2             
         BSM   R0,R7                 
ABDRET2  DC    A(ABDRET3+X'80000000')
ABDRET3  DS    0H                     
         MVI   FACCRCDE,FACCOER1     
         RETURN (14,12),T,RC=20   

Now, when the S013 abend occurs , it goes to the DCB Abend exit routine MEMINVA. After entering the DCB abend exit routine, I need to set a return code and return to the main program or exit gracefully without abend which I am not able to achieve.

After entering the MEMINVA as the DCB ABEND Exit routine will be in AMODE 24, i have coded the BSM instruction to make it AMODE 31. But after that when I use the RETURN instruction or BR R14 to return back to the main program , it goes to the OPEN instruction and abend there again. When I use CEETERM or BR 14 I am getting the U4091 abend or U3007 abend.

I have referred the Z/OS DFSMS Macro instruction datasets and Z/OS DFSMS using datasets manual for this.

So can someone please help me in Exiting or returning from the DCB ABend exit routine .

Thanks and Regards
Vishnu Priya

Please learn to use the code tags to make things easier to read. They are easy to use

Code:
[code]
Your stuff here
[/code]

Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Thu Aug 23, 2018 1:19 pm
Reply with quote

I never could figure out how to get the DCB ABEND exit to do anything useful. For something like what you want I pre test the data set. What follows is a partially tested skeleton.
Code:
CHKM     CSECT
         USING *,12
         SAVE  (14,12)
         LR    12,15
         LA    15,SAVEAREA
         ST    13,SAVEAREA+4
         ST    15,8(,13)
         LR    13,15
         RDJFCB QSAMDCB
         TM    JFCBIND1,JFCPDS
         BZ    QSAMOPEN
         OPEN  (EXCPDCB,INPUT)
         MVC   MNAME,JFCBELNM
         BLDL  EXCPDCB,BLDLPARM
         LTR   15,15
         BNZ   OOPS
         CLOSE EXCPDCB
QSAMOPEN OPEN  (QSAMDCB,INPUT)
EOF      CLOSE QSAMDCB
         B     EXIT
OOPS     MVI   RC,16
         CLOSE EXCPDCB
EXIT     L     13,4(,13)
         SR    15,15
         IC    15,RC
         RETURN (14,12),RC=(15)
SAVEAREA DC    9D'0'
EXCPDCB  DCB   MACRF=E,DDNAME=MYDD
QSAMDCB  DCB   DSORG=PS,MACRF=GL,DDNAME=MYDD,EODAD=EOF,EXLST=XLIST
XLIST    DC    0A(0),AL1(X'80'+7),AL3(JFCB)
JFCB     DC    0XL176'0'
         IEFJFCBN ,
BLDLPARM DC    0A(0),AL2(1,20)
MNAME    DC    CL8' ',XL(20-8)'0'
RC       DC    FL1'0'
         END   CHKM

The program reads the JFCB and tests to see if there is a member name specified in the DCB. If no member is specified it goes to open the QSAM DCB. If a member is specified it opens the EXCP DCB. Since it's EXCP, OPEN does not try to open the member. The program does a BLDL macro to test if the member is present. If it is it opens the QSAM DCB; if not it just sets the RC to 16 and exits. I assembled the program to data set userid.CHKM.OBJ and ran this JCL -
Code:

//A       EXEC PGM=IEWL,PARM=MAP
//SYSPRINT DD  SYSOUT=*
//SYSLMOD  DD  DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(1,1,1)),DSN=&&G(G)
//SYSLIN   DD  DISP=SHR,DSN=&SYSUID..CHKM.OBJ
//B       EXEC PGM=IEBUPDTE,PARM=NEW
//SYSPRINT DD  SYSOUT=*
//SYSUT2   DD  DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(1,1,1)),DSN=&&D,
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN    DD  *
./ ADD  NAME=TESTM
LINE 1
LINE 2
//RC0     EXEC PGM=*.A.SYSLMOD
//MYDD     DD  DISP=(OLD,PASS),DSN=&&D(TESTM)
//RC16    EXEC PGM=*.A.SYSLMOD
//MYDD     DD  DISP=(OLD,PASS),DSN=&&D(TESTX)

Step RC0 completed with COND CODE 0, and step RC16 completed with COND CODE 16.

A real world program should do much more: it should verify the data set exists, to avoid an S213-04 ABEND, and that the data set is partitioned. I leave all that to you.

By my clock it's 03:45 and it's time for me to go to bed.
Back to top
View user's profile Send private message
Vishnu Priya M R

New User


Joined: 22 Aug 2018
Posts: 4
Location: India

PostPosted: Fri Aug 24, 2018 9:19 am
Reply with quote

Hi Steve

Thank you very much for the suggestion. I will try to use the JFCB and see if I can catch the error before the OPEN instruction.



Thanks and Regards
Vishnu Priya
Back to top
View user's profile Send private message
Vishnu Priya M R

New User


Joined: 22 Aug 2018
Posts: 4
Location: India

PostPosted: Tue Aug 28, 2018 4:50 pm
Reply with quote

Hi Steve

Thank you for the code. By using the JFCB and BLDL I was able to test if the member is present and set a Return code if the member is invalid.


I actually wanted to use the same piece of code for 2 different files. For the first iteration everything goes fine. But for the second iteration, that is for second PDS if the member is not found, I am getting a S0C4 abend in the BLDL instruction.

When I was expediting, I could see that in the MVC MNAME, JFCBELNM instruction, its picking up the right member name (second member). So it is reading the right file through EXCPDCB. But in the BLDL instruction its abending at the BLDLPARM.

I am not sure if there is any change I need to do if I am using the BLDLPARM for 2 iterations. Please let me know your thoughts on this.

Thanks and Regards
Vishnu Priya
Back to top
View user's profile Send private message
Vishnu Priya M R

New User


Joined: 22 Aug 2018
Posts: 4
Location: India

PostPosted: Tue Aug 28, 2018 4:55 pm
Reply with quote

Hi Steve

While it shows the abend message, it says S0c4 abend at 303. I further looked at the compile listing to see what instruction is there for the line 303.

The BLDL instruction is further expanded and at the line 303 we have the instruction

SVC 18 (Link to BLDL routine).

I am not sure why we are hitting S0C4 at this instruction only during the 2nd iteration when it was fine for the second one.

Please let me know your thoughts.

Thanks and Regards
Vishnu Priya
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Tue Aug 28, 2018 6:17 pm
Reply with quote

1) The real "two DCB handling code" updated by yourself is needed here, to give any meaningful answer.
2) Abend S0C4 means that wrong address is used at failure point, while trying to update some field. Most likely one of your registers is not set up properly, or somehow corrupted before the second BLDL.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Tue Aug 28, 2018 6:36 pm
Reply with quote

Of course it will ABEND at BLDLPARM: BLDLPARM is a data area; there are no executable instructions there.

I'm working on a proof on concept to try to reproduce your problem. It got more involved than I expected. I'm still working on it. It will be far too large to post here. I will send you a private mail when I get it working.
Back to top
View user's profile Send private message
hankoerlemans

New User


Joined: 25 Jan 2018
Posts: 57
Location: Australia

PostPosted: Tue Nov 19, 2019 7:18 am
Reply with quote

I don't see any use of the "Option mask byte settings" to control the type of recovery in your snippet.
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts ISAM and abend S03B JCL & VSAM 9
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts Use of Perform Thru Exit COBOL Programming 6
No new posts user exit in IBM Infosphere Optim DB2 8
Search our Forums:

Back to Top