Hi Dan,
first of all, I'm not going to write that script for you. You'll have to do that yourself.
But I'll give you a number of hints that'll make it easy.
In our documentation of the command language (e.g.
Command Reference 2.11) I've added a chapter with programming examples.
Don't be confused that I reference the latest release, it'll work in previous releases exactly the same way.
In fact, the GUI is written in Python and uses the command language to communicate with the server, and the GUI exists since ages.
The basic principle is that the user sends a command and the server replies with a structure called OutputContainer.
These OutputContainers always have a similar structure. It is either a record, a record with tables or a table.
If you want to know what an OutputContainer looks like, you can use telnet, for instance. (There are other possibilities too).
Like in (I've formatted the code to make it better readable):
schedulix@oncilla:~$ telnet localhost 2506
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
connect system identified by 'JohannJohann' with protocol = python;
{
'DATA' : {
'TITLE' : 'Connect',
'DESC' : [ 'CONNECT_TIME' ],
'RECORD' : {
'CONNECT_TIME' : '02 Apr 2024 08:59:50 GMT'}
},
'FEEDBACK' : 'Connected'
}
show user;
{
'DATA' : {
'TITLE' : 'User',
'DESC' : [ 'ID', 'NAME', 'IS_ENABLED', 'DEFAULT_GROUP', 'CONNECTION_TYPE', 'CREATOR', 'CREATE_TIME',
'CHANGER', 'CHANGE_TIME', 'PRIVS', 'MANAGE_PRIVS', 'GROUPS', 'EQUIVALENT_USERS',
'PARAMETERS', 'COMMENTTYPE', 'COMMENT' ],
'RECORD' : {
'ID' : '0',
'NAME' : 'SYSTEM',
'IS_ENABLED' : 'true',
'DEFAULT_GROUP' : 'ADMIN',
'CONNECTION_TYPE' : 'PLAIN',
'CREATOR' : 'SYSTEM',
'CREATE_TIME' : '01 Jan 1970 00:00:00 GMT',
'CHANGER' : 'SYSTEM',
'CHANGE_TIME' : '07 Mar 2024 10:37:52 GMT',
'PRIVS' : 'KDEVG',
'MANAGE_PRIVS' : {
'TITLE' : 'MANAGE_PRIVS',
'DESC' : [ 'PRIVS' ],
'TABLE' : [ ]
},
'GROUPS' : {
'TITLE' : 'GROUPS',
'DESC' : [ 'ID', 'NAME', 'PRIVS' ],
'TABLE' : [
{
'ID' : '81',
'NAME' : 'ADMIN',
'PRIVS' : 'KDEMO(OCRESDILUWPMKA)VGR'
}, {
'ID' : '80',
'NAME' : 'PUBLIC',
'PRIVS' : 'KDEMO(OCRESDILUWPMKA)VGR'
}
]
},
'EQUIVALENT_USERS' : {
'TITLE' : 'EQUIVALENT_USERS',
'DESC' : [ 'TYPE', 'EQUIVALENT_USER' ],
'TABLE' : [ ]
},
'PARAMETERS' : {
'DESC' : [ 'ID', 'NAME', 'VALUE' ],
'TABLE' : [
{
'ID' : '113006',
'NAME' : 'PRIVATE_PROPERTIES',
'VALUE' : '{"NAME_UPPERCASING":"true","PRIVATE_TIME_ZONE":"Europe/Berlin","THEME":"LIGHT"}'
}
]
},
'COMMENTTYPE' : None,
'COMMENT' : {
'DESC' : [ 'ID', 'SEQNO', 'TAG', 'DESCRIPTION' ],
'TABLE' : [ ]
}
}
},
'FEEDBACK' : 'User shown'
}
In the above output you see the record output of the connect command as well as the combined record + table output of a show user.
In the description of the commands the output fields are documented. In case of writing commands that only return an OK or an Error, this is omitted.
Now back to your task.
The starting point is the job that is triggered by others.
If you issue a
LIST TRIGGER OF jobname;
You'll get loads of information about all triggers that trigger this job.
E.g. :
[SYSTEM@localhost:2506] SDMS> list trigger of system.utilities.notifier;
List of Triggers
ID NAME OBJECT_TYPE OBJECT_SUBTYPE OBJECT_NAME ACTIVE ACTION STATES SUBMIT_TYPE SUBMIT_NAME ...
----- ------------ -------------- -------------- --------------------------------------------------- ------ ------ --------------- ----------- ------------------------- ...
44026 ASYNCTRIGGER JOB_DEFINITION JOB SYSTEM.MAIN_BATCHES.BUNCH_OF_BATCHES.EVERY_DAY.JOB1 true SUBMIT JOB SYSTEM.UTILITIES.NOTIFIER ...
10058 NEW_TRIGGER JOB_DEFINITION JOB SYSTEM.MAIN_BATCHES.BUNCH_OF_BATCHES.EVERY_DAY.JOB1 true SUBMIT FAILURE,PENDING JOB SYSTEM.UTILITIES.NOTIFIER ...
2 Trigger(s) found
I've shortened the output, you can do this for yourself. But you can see what to expect.
The most interesting part here is the name of the Trigger (like ASYNCTRIGGER) and the name of the Job Definition (like ...EVERY_DAY.JOB1).
Your script can iterate over this table and do a
SHOW TRIGGER triggername ON JOB DEFINITION jobname;
like e.g.
show trigger asynctrigger on job definition SYSTEM.MAIN_BATCHES.BUNCH_OF_BATCHES.EVERY_DAY.JOB1;
The output will contain a table of parameters of the trigger and with this list you can render an appropriate ALTER TRIGGER statement.
A small note remains.
You might have noticed that I use both upper- and lowercase identifiers and keywords.
Just like in SQL the command language is case insensitive, which is also true for identifiers.
But since there exist people that find that blanks are valid characters for identifiers (which is especially funny if you use a non fixed font), we've added the possibility to quote identifiers.
Quoting them adds a few additional characters that may be used in names and makes the identifiers case sensitive. It also allows you to use otherwise reserved words, like e.g. SYSTEM.
I myself am much too lazy for quoting and always use proper identifiers, which are much like identifiers in SQL (letters, digits, underscore. at- and hash-character).
This laziness rewards me with not having to pay attention to my shift key and no problems with copy and paste.
I think this should help you to get the job done, but tell me if you get stuck somewhere.
And after digesting the above you probably won't need breakfast any more. ;-)
Best regards,
Ronald