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.
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
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
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 -
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.
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.
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.
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.
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
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.