Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Program name from Control Blocks 1

Status
Not open for further replies.

BCWilkenson

Programmer
Apr 17, 2019
1
0
0
US
I am using a pared down version of RUNINFO to dynamically get the program ID from the control blocks. It works for regular batch programs but not for DB2 programs using the TSO Call Attach Facility(returns a blank). I suspect setting the address X”0000021C” is the reason. Does anyone know what I should use when using TSO to call DB2 programs?

We are using IKJEFT01
PP 5655-S71 IBM Enterprise COBOL for z/OS 4.2.0

Here is my version of the program.

CBL LIST,NOOFF
IDENTIFICATION DIVISION.
PROGRAM-ID. RUNINFO.
AUTHOR. JACK SLEIGHT.
ENVIRONMENT DIVISION.
****************************************************************
* DISPLAYS THE FOLLOWING RUN INFO FOR THE CALLING PROGRAM: *
* *
* * PGM/JOB/JOBSTEP/PROCSTEP NAMES *
* * ENTRY/LOAD/END POINTS AND LENGTH OF PROGRAM *
* *
* FOR COBOL II PROGRAMS ALSO DISPLAYS 4 BYTES OF HEX INDICAT- *
* ORS SHOWING THE COMPILE OPTIONS SELECTED AT COMPILE TIME. *
****************************************************************

CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-370.
OBJECT-COMPUTER. IBM-370.
DATA DIVISION.
FILE SECTION.

****************************************************************
WORKING-STORAGE SECTION.
****************************************************************

01 WHEN-COMPILED-WORK.
05 COMPILE-DATE PIC X(08) VALUE 'MM/DD/YY'.
05 COMPILE-TIME PIC X(08) VALUE 'HH.MM.SS'.

01 WS-TCB-ADDR-01.
10 WS-TCB-ADDR POINTER.

01 WS-DISPLAY-FIELDS.
10 WS-PN-DISPLAY PIC X(008).
/
****************************************************************
LINKAGE SECTION.
****************************************************************

01 LK-TCB-ADDR POINTER.

*--------------------------------------------------------------
*===> T A S K C O N T R O L B L O C K
*--------------------------------------------------------------
01 LK-TCB.
10 FILLER PIC X(012).
10 LK-TIOT-ADDR POINTER.
10 FILLER PIC X(028).
10 LK-LAST-CDE-ADDR POINTER.

*--------------------------------------------------------------
*===> C O N T E N T S D I R E C T O R Y E N T R Y
*--------------------------------------------------------------
01 LK-CDE.
10 LK-PREV-CDE-ADDR POINTER.
10 FILLER PIC X(004).
10 LK-PGM-NAME PIC X(008).
10 LK-EP-ADDR PIC X(004).
10 LK-EXTENT-LST-ADDR POINTER.

****************************************************************
PROCEDURE DIVISION.
****************************************************************

000-MAINLINE.

*--------------------------------------------------------------
*===> ESTABLISH ADDRESSABILITY FOR TIOT
*--------------------------------------------------------------

MOVE X"0000021C" TO WS-TCB-ADDR-01
SET ADDRESS OF LK-TCB-ADDR TO WS-TCB-ADDR
SET ADDRESS OF LK-TCB TO LK-TCB-ADDR

SET ADDRESS OF LK-CDE TO LK-LAST-CDE-ADDR
PERFORM WITH TEST BEFORE UNTIL LK-PREV-CDE-ADDR = NULLS
SET ADDRESS OF LK-CDE TO LK-PREV-CDE-ADDR
END-PERFORM
MOVE LK-PGM-NAME TO WS-PN-DISPLAY

DISPLAY " "
MOVE WHEN-COMPILED TO WHEN-COMPILED-WORK
DISPLAY WS-PN-DISPLAY
' COMPILE DATE/TIME ' COMPILE-DATE
' - ' COMPILE-TIME ' **'
DISPLAY ALL SPACES.
****************************************************************
GOBACK
.
Thanks in advance

Brian
 
perhaps this link can help you:
Gilbert Saint-Flour made a great program in COBOL, reading the MVS data. I think he starts with a pointer on a ZERO address, and works from that position on, using the data as you can find in the manuals.

One of his programs is named COB2JOB. I used it with success.

It starts like the source below.

Lots of success!

Regards,

Crox


CBL TRUNC(OPT)
CBL NOSSRANGE
Identification Division.
Program-ID. Cob2Job.
Author. Gilbert Saint-flour <gsf@pobox.com>.
*----------------------------------------------------------------*
* *
* This program retrieves specific job-related data from MVS *
* control blocks and moves it to Working-storage. *
* *
* The name of the control-block is indicated in pos 1-6 of *
* the Procedure Division lines. *
* The layout of the MVS control blocks is described in the *
* MVS Data Areas manuals, which can be found on any MVS or *
* OS/390 CD collection or viewed on-line by going to: *
* *
* and searching for: *
* MVS DATA AREAS *
*----------------------------------------------------------------*
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top