MVS OS-390 - How do I Capture Job Information from CA-JOBTRAC programmatically - operating-system

I am using REXX to invoke JOBTRAC programmatically which works however I am unable to pass JOBNAME arguments using this approach. Can this be done using REXX?
The idea is to find the history of the job run using the program jobtrac. We use jobtrac's schedule to find the history of when job runs happened. We invoke jobtrac using
‘TSO JOBTRAC’ AND SUPPLY history command ‘H XXXXXX’ in the command line (XXXXX – jobname)
I was thinking to route the jobtrac info to a flat file and parse it so that I can do some reporting real time during the job run. The above problem is also linked to this following scenario:
If I give dslist 'DSLIST A.B.C.*'’ in the ISPF panel
It gives the series of datasets ...
A.B.C.A,
A.B.C.D
A.B.C.E
When I give
"SAVE ORANGE"
it stores this list under
MYUSERID.ORANGE.DATASETS.
I know this can be automated pro grammatically and I have seen that . But I don’t have the code base to do that right now. This is much similar to the jobtrack issue I have.
Here is some REXX CODE to help with understanding. I know this code is wrong…we cannot use outtrap for this as it is used to get console output.
say 'No. of month end jobs considered for history :'jobnames.0
if jobnames.0 > 0 then do
do i = 1 to jobnames.0
say jobnames.i
jobname = Word(jobnames.i,1);
say 'jobname under consideration is ' jobname;
tsocmd="JOBTRAC;ADDLOC=000;H "|| strip(jobname);
say 'tso command is ' tsocmd;
y = outtrap(jobdetails.)
Address TSO "'tsocmd'" ------------------> wrong…I believe I have to use ispexec
say 'job details are ' jobdetails.6;
end;

Related

Nightbot command - !uptime combined with a different command, is it possible?

I don't know if I'm posting to the right place or what but I was wondering if someone could help me with a Nightbot command I want to make.
I have the !uptime command and I have a !rage command which only retrieves one value. Now I'd like to combine the two into a command that would retrieve 5 or 6 different values (stages of rage in this situation) depending on what value !uptime would retrieve. So basically if I have been streaming for an hour !rage would say minimum but if for 5 hours it would say critical or something.
How is this possible? Someone pls help
Go to https://nightbot.tv/commands/custom and simply add these two commands
command : message : alias
!hour : $(eval var index = $(1); const options=["min","avg","max","babyRage"]; options[index] )
!rage : $(urlfetch https://beta.decapi.me/twitch/uptime/itsashawe) : !hour
NOTE: Remember to use your channel name instead of mine (itsashawe). Make sure you add !hour as alias in the !rage command.
P.S.
I've used an api to make it simpler. The rage command calls the hour command which gets the hours, minutes and seconds. The rage command uses $(1) i.e. the first argument i.e. the hour and uses it as an index to get values from options which you can change according to your use.

Trace32: How get programmatically get maintenance key expiry month and year using t32apinet?

I am trying to get the maintenance key expiry month and year of lauterbach JTAG programmatically. I am using t32apinet for that. Is there a way to read the maintenance information using the api?
You can get the date of you maintenance key via the PRACTICE function LICENSE.DATE(<idx>), where idx is the number of the attached serial number as it appears in the LICENSE.LIST window. Note, that one debug cable, plugged to your PowerDebug, can have up to 5 serial numbers and thus, also up to 5 maintenance key.
To get idx for the currently running PowerView executable use the PRACTICE function LICENSE.getINDEX().
Putting both together you get: LICENSE.DATE(LICENSE.getINDEX())
You can test it by using the PRINT command in PowerView:
PRINT LICENSE.DATE(LICENSE.getINDEX())
You should get a string in the form of YYYY/MM e.g. 2020/07
To use a PRACTICE function via the remote API, use the API function T32_Cmd() together with the TRACE32 command EVAL and then get the result via the API function T32_EvalGetString().
E.g. in C/C++:
char mdate[4096];
T32_Cmd("EVAL LICENSE.DATE(LICENSE.getINDEX())");
T32_EvalGetString(mdate);
printf("End Date: %s\n", mdate);
I am not skilled with Visual Basic .NET at all, but I guess there it should look like this:
Dim mdate As String
T32.Cmd("EVAL LICENSE.DATE(LICENSE.getINDEX())");
T32.EvalGetString(mdate);
Log("End Date: " + mdate)
New versions of TRACE32 support also the slightly nicer API function T32_ExecuteFunction().

Using QCMDEXC to call QEZSNDMG via DB2 stored procedure

Working on a side project where I use a set of views to identify contention of records within an iSeries set of physical files.
What I would like to do once identified is pull the user profile locking the record, and then send a break message to their terminal as an informational break message.
What I have found is the QEZSNDMG API. Simple enough to use interactively, but I'm trying to put together a command that would be used in conjunction with QCMDEXC API to issue the call to QEZSNDMG and alert the user that they are locking a record.
Reviewing the IBM documentation of the QEZSNDMG API, I see that there are two sets of option parameters, but nothing as required (which seems odd to me, but another topic for another day). But I continue to receive the error "Parameters passed on CALL do not match those required."
Here are some examples that I have tried from the command line so far:
CALL PGM(QEZSNDMG) PARM('*INFO' '*BREAK' 'TEST' '4' 'DOUGLAS' '1' '1' '-4')
CALL PGM(QEZSNDMG) PARM('*INFO' '*BREAK' 'TEST' '4' 'DOUGLAS')
CALL PGM(QEZSNDMG) PARM('*INFO' '*BREAK' 'TEST' '4' 'DOUGLAS' '1')
Note: I would like to avoid using a CL or RPG program if possible but understand it may come to that using one of many examples I found before posting. Just want to exhaust this option before going down that road.
Update
While logged in, I used WRKMSGQ to see the message queues assigned to my station. There were two: QSYS/DOUGLAS and QUSRSYS/DOUGLAS. I then issued SNDBRKMSG with no affect on my workstation (IE, the message didn't break my session):
SNDBRKMSG MSG(TESTING) TOMSGQ(QSYS/DOUGLAS)
SNDBRKMSG MSG(TESTING) TOMSGQ(QUSRSYS/DOUGLAS)
I realized if I provide the workstation session name in the TOMSG parameter it worked:
SNDBRKMSG MSG(TESTING) TOMSGQ(*LIBL/QPADEV0003)
Using SNDBRKMSG was what I was looking for.
Some nudging in the right direction lead me to realize that the workstation session ID is located within QSYS2.RCD_LOCK in field JOB_NAME (job number/username/workstation).
Extracting the workstation ID allowed me to create a correctly formatted SNDBRKMSG command to QCMDEXC and alert the user that they are locking a record needed by another process.

Can a list of strings be supplied to Capistrano tasks?

I have a task whose command in 'run' is the same except for a single value. This value would out of a list of potential values. What I would like to do is create a task which would use this list of values to define the task and then use that same value in the command defined in 'run'. The point is that it would be great to define the task in such a way where I don't have to repeat nearly identical task definitions for each value.
For example: I want a task that will get the status of a single program from a list of programs that I have defined in an array. I would like to define task to be something like this:
set programs = %w["postfix", "nginx", "pgpool"]
programs.each do |program|
desc "#{program} status"
task :#{program} do
run "/etc/init.d/#{program} status"
end
end
This obviously doesn't work, but hopefully it shows what I am attempting here.
Thoughts?
Well, I answered my own question... with a little trial and error. I also did the same thing with namespace so the control of services is nice and elegant. It works quite nicely!
set :programs, %w[postfix nginx pgpool]
set :init_commands, %w[status start stop]
# init.d service control
init_commands.each do |init_command|
namespace :"#{init_command}" do
programs.each do |program|
desc "#{program} #{init_command}"
task :"#{program}" do
run "/etc/init.d/#{program} #{init_command}"
end
end
end
end

Difference between 'Execute' and 'Execute as script'

I'm currently experiencing what I believe is strange behavior when using Oracle with TOAD.
I have a query:
SELECT
COUNT(as_at_date)
FROM
job_log
WHERE
as_at_date = TO_DATE('24/11/2009', 'dd/mm/yyyy');
When I try to run this using Toads 'Execute statement' button I get zero rows returned. However when I use 'Execute as script' I get one row returned, which is as expected.
Can anyone explain to me why using the different commands would produce differences in the result set?
Thanks.
It's not an direct answer to your question (and it will take you a moment or two to setup and analyse), but you could take a TKPROF trace in the database to see what actually arrives from Toad....
See
http://www.jlcomp.demon.co.uk/tkprof_01.html
and
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:969160000346108326
for some examples.
Execute will run the query where the cursor is present.
Execute as script will execute all the queries written in that tab from top to bottom.
Probably when pressed "EXECUTE" button the cursor would have been in an empty line.