Know the last execution date of the program?

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Taran Bhatia
Registered Member
Posts: 15
Joined: Wed Oct 22, 2014 8:51 am

Know the last execution date of the program?

Post by Taran Bhatia »

Hi,

How can we know of a program's last execution date apart from looking at the JCL, executing the program?

How can we same know for the CICS COBOL Program?

Please advise.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Know the last execution date of the program?

Post by Robert Sample »

Yes, but it is not easily done. The SMF type 30 records contain the name of each program (COBOL or otherwise) executed along with the date and time. Extracting this data can be done with assembler or COBOL or SAS (although many sites use MXG or another SMF analysis program to extract the data) and you could create a database of programs and last execution date.
Shruti Yadav
Registered Member
Posts: 17
Joined: Mon Oct 20, 2014 12:33 pm

Re: Know the last execution date of the program?

Post by Shruti Yadav »

This is great question. Is there no other way apart from SMF records? It looks like a very necessary statistics every company would want to have, there is no easy way for this?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Know the last execution date of the program?

Post by Robert Sample »

SMF is the repository of performance data on system Z machines. Extracting and analyzing the SMF records may already be done at a given site; many sites use MXG or another tool to handle the records.

I've worked at quite a few companies over the last 40+ years, and only one of them was interested in the last execution date of a program. I created a system to pull the SMF type 30 records, extract the program names and execution dates, and store this data in a VSAM data set. More typically, when applications are put into production they have their own load library and once the application is retired the load library is retired as well.
Shruti Yadav
Registered Member
Posts: 17
Joined: Mon Oct 20, 2014 12:33 pm

Re: Know the last execution date of the program?

Post by Shruti Yadav »

Fine Robert. Could you please share the program you talked about?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Know the last execution date of the program?

Post by Robert Sample »

I'm sorry but that program was written on company time using company resources and hence belonged to the company. I did not take a copy of the code when I left the company. At some point I may recreate that system but I don't have the time right now. The easiest way to do it would be to extract program names and run dates from the SMF type 30 records (one program in COBOL or assembler or another language), sort them (removing duplicates is probably a good idea), and then run the sorted output into a second program that reads the program name and run date, compares them to a VSAM KSDS (key is program name) and updates the VSAM run date if it is less than the sorted date. Reading SMF records in COBOL is a little tricky but not that hard for an experienced programmer. Instead of VSAM KSDS a DB2 (or other data base) table could be used. I had a program execution count field in my system to track how many times different programs were executed -- if that is needed, you would not want to remove duplicates from the sort.
Taran Bhatia
Registered Member
Posts: 15
Joined: Wed Oct 22, 2014 8:51 am

Re: Know the last execution date of the program?

Post by Taran Bhatia »

It's an old thread but could you please guide Robert. I am trying to learn reading SMF records. Where can I get started so that I can write a basic program rather than going too much trough the theory.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Know the last execution date of the program?

Post by Robert Sample »

https://www.ibm.com/docs/en/zos/2.5.0?t ... lities-smf has the latest information on SMF and would be the place to get started. However, you're not going to get very far without understanding a LOT of the theory -- for example, a time in SMF may be a 4-byte packed decimal value, or a 4-byte binary value representing the number of seconds (or milliseconds, depending) since midnight, or ... and a date may be stored as 4-byte packed decimal CYYYYDDD or YYMMDD or a 4-byte binary value of the number of days since January 1, 1900 or ...

In other words, if you don't know much about SMF yet you need to spend a lot of time reading.
User avatar
gmaestro
New Member
Posts: 1
Joined: Wed Jul 05, 2023 6:37 pm

Re: Know the last execution date of the program?

Post by gmaestro »

The program name and the timestamp of its execution can easily extracted from SMF 30 (for batch program) and from SMF 110 (for CICS program). However both record types share the same problem. In both records can be found only the first program invoked. If a program calls or links other sub-program the name and the timestamp for those sub-program are not available.

Giorgio Maestro
Taran Bhatia
Registered Member
Posts: 15
Joined: Wed Oct 22, 2014 8:51 am

Re: Know the last execution date of the program?

Post by Taran Bhatia »

Thanks Giorgio for the information.

So there is no way to find the timestamp for sub-programs?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Know the last execution date of the program?

Post by Robert Sample »

So there is no way to find the timestamp for sub-programs?
If the subprogram is statically linked into the load module, there is NO timestamp for it since it is part of the main program.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”