Not sure what I used it for, but here is a simple program in assembler to create an ABEND with a completion code of your choice.
Look here in the IBM manuals for more specifics on the ABEND macro.
ABENDIT CSECT
EQUATES
SAVE (14,12),,ABENDIT/OURDEPT/&SYSDATE/&SYSTIME/
USING ABENDIT,R11 SET UP BASE ADDRESSABILITY
LR R11,R15 LOAD BASE REG WITH ENTRY POINT
LA R14,SAVE GET ADDRESS OF REGISTER SAVE
ST R13,4(0,R14) SAVE CALLER'S SAVE AREA ADDR
ST R14,8(0,R13) SAVE MY SAVE AREA ADDRESS
LR R13,R14 LOAD SAVE AREA ADDRESS
* Business Logic
ABEND 4321 4321 or some other code up to 4096
* Epilogue
RETURN EQU *
L R13,4(R13)
RETURN (14,12) RETURN TO CALLER
LTORG
SAVE DS 18F
END ABENDIT
Happy ABENDing!