Page 1 of 1

Know the last execution date of the program?

Posted: Tue Jul 20, 2021 2:21 pm
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.

Re: Know the last execution date of the program?

Posted: Wed Jul 21, 2021 6:59 pm
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.

Re: Know the last execution date of the program?

Posted: Wed Aug 04, 2021 12:34 am
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?

Re: Know the last execution date of the program?

Posted: Wed Aug 04, 2021 7:19 pm
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.

Re: Know the last execution date of the program?

Posted: Fri Aug 06, 2021 11:59 pm
by Shruti Yadav
Fine Robert. Could you please share the program you talked about?

Re: Know the last execution date of the program?

Posted: Tue Aug 10, 2021 3:17 am
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.

Re: Know the last execution date of the program?

Posted: Fri Dec 09, 2022 6:01 pm
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.

Re: Know the last execution date of the program?

Posted: Fri Dec 09, 2022 10:29 pm
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.

Re: Know the last execution date of the program?

Posted: Wed Jul 05, 2023 6:58 pm
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

Re: Know the last execution date of the program?

Posted: Thu Jul 06, 2023 4:13 pm
by Taran Bhatia
Thanks Giorgio for the information.

So there is no way to find the timestamp for sub-programs?

Re: Know the last execution date of the program?

Posted: Thu Jul 06, 2023 9:54 pm
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.