×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Getting Program name from Control Blocks

Getting Program name from Control Blocks

Getting Program name from Control Blocks

(OP)
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

RE: Getting Program name from Control Blocks

perhaps this link can help you: https://www.zmainframes.com/viewtopic.php?t=74

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: *
* http://www.s390.ibm.com/bookmgr-cgi/bookmgr.cmd/li... *
* and searching for: *
* MVS DATA AREAS *
*----------------------------------------------------------------*

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close