[I realize this thread is kind of old, but I have yet to find a better
COBOL solution anywhere else so I thought I'd post it. This was originally
posted to the
"Mainframe (COBOL, etc) Experts" LinkedIn Group, which I manage for group
owner Vikas Kumar, see http://linkd.in/1S4BarK ]

Here's a COBOL example to pass a JFCB token to the actual SWAREQ routine
and receive back a pointer to the JFCB, exactly the same as an Assembler
program coded with an SWAREQ macro.

This code displays the JOBLIB concatenation, but the technique for
obtaining  the JFCB address using a JFCB token from the TIOT is universal.
It runs exactly the same chain as the SWAREQ macro (CVT -> JESCT ->
JESPEXT) to obtain the SWAREQ routine address from JESQBSVA, to which it
then passes the JFCB token from the TIOT and receives back a pointer to the
JFCB, which contains the DSN.  See "Accessing the Scheduler Work Area" in
the MVS Authorized Assembler Services Guide:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/iea2a8c0/11.0
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLE.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 SWAPARMS.
___ 05 EPA-PTR _ POINTER.
___ 05 FC-PTR __ POINTER.
01 SWAEPAX.
___ 05 SWBLKPTR POINTER.
___ 05 SWVA ____ PIC X(3).
___ 05 FILLER __ PIC X(24).
01. 05 TIOT-PTR POINTER.
___ 05 TIOT-ADDR REDEFINES TIOT-PTR PIC 9(9) COMP.
___ 05 FCODE ___ PIC XX VALUE 'RL'.
___ 05 HALFWORD PIC 9(4) COMP VALUE 0.
___ 05 REDEFINES HALFWORD.
______ 10 FILLER PIC X.
______ 10 HW-LOB PIC X.
___ 05 TIOSJBLB PIC X.
LINKAGE SECTION.
01 PSA.
___ 05 FILLER __ PIC X(16).
___ 05 FLCCVT __ POINTER.
___ 05 FILLER __ PIC X(520).
___ 05 PSATOLD _ POINTER.
01 TCB.
___ 05 FILLER __ PIC X(12).
___ 05 TCBTIO __ POINTER.
01 TIOT.
___ 05 FILLER __ PIC X(24).
___ 05 TIOELNGH PIC X.
___ 05 TIOESTTA PIC X.
___ 05 FILLER __ PIC X(10).
___ 05 TIOEJFCB PIC X(3).
01 CVT.
___ 05 FILLER __ PIC X(296).
___ 05 CVTJESCT POINTER.
01 JESCT.
___ 05 FILLER __ PIC X(100).
___ 05 JESCTEXT POINTER.
01 JESPEXT.
___ 05 FILLER __ PIC X(88).
___ 05 JESQBSVA POINTER.
___ 05 SWAREQ REDEFINES JESQBSVA FUNCTION-POINTER.
01 JFCB.
___ 05 JFCBDSNM PIC X(44).
PROCEDURE DIVISION.
___ SET ADDRESS OF PSA TO NULL
___ SET ADDRESS OF TCB TO PSATOLD
___ SET TIOT-PTR TO TCBTIO
___ SET ADDRESS OF TIOT TO TIOT-PTR
___ SET EPA-PTR TO ADDRESS OF SWAEPAX
___ SET FC-PTR TO ADDRESS OF FCODE
___ MOVE TIOESTTA TO TIOSJBLB
___ PERFORM UNTIL TIOSJBLB NOT EQUAL TIOESTTA
_____ MOVE TIOEJFCB TO SWVA
_____ SET ADDRESS OF CVT TO FLCCVT
_____ SET ADDRESS OF JESCT TO CVTJESCT
_____ SET ADDRESS OF JESPEXT TO JESCTEXT
_____ CALL SWAREQ USING SWAPARMS
_____ SET ADDRESS OF JFCB TO SWBLKPTR
_____ DISPLAY 'JOBLIB = ' JFCBDSNM
_____ MOVE TIOELNGH TO HW-LOB
_____ ADD HALFWORD TO TIOT-ADDR
_____ SET ADDRESS OF TIOT TO TIOT-PTR
___ END-PERFORM
___ GOBACK.

The field names used are exactly the same as those defined in the MVS Data
Areas and Assembler Services manuals, should anyone wish to reference them:
SWAEPAX, SWBLKPTR and SWVA from IEFZB505 LOCEPAX=YES macro
FLCCVT and PSATOLD from:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/A3208571/66.1.1
- PSA
TCBTIO from:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/A3208581/79.1.1
- TCB
TIOELNGH, TIOESTTA and TIOEJFCB from:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/A3208581/86.1.1
- TIOT
CVTJESCT from:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/A3208531/146.1.1
- CVT
JESCTEXT, JESPEXT and JESQBSVA from:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/A3208561/137.1.1
- JESCT
JFCBDSNM from:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/A3208561/138.0 -
JFCB
All links above from:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/SHELVES/ez2dgz50 -
z/OS 1.13 Diagnose Bookshelf

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to