Monday, August 10, 2015

Remote CLI .. Windows PC set-up

TWS remote CLI for a personal PC advantages:
  • You can skip using the TDWC which in is slow and hard to use for big / massive changes.
  • No need to connect to any host.
  • Configure and personalize the editor (which for local CLI is the OS default one).

Once the remote CLI software was deployed (it also can be copied from an already installed source, installation is not mandatory) perform the following tasks for a better view and easier access:

    1. Create a *.cmd (e.g. TWS_CLI_Start.cmd) file that is setting up the global variables before launching the composer, and use it to start the remote CLI (more details can be found HERE):

@echo off set MAESTRO_OUTPUT_STYLE=LONG set MAESTROLINES=0 set MAESTROCOLUMNS=520
"%CD%\bin\composer.exe"
   2. Adjust the localopts file, personalize tp make sure there wont be any confusions to which TWS environment are you connected / working on (all the lines can be removed except the below ones):

e.g. TWS1 env.

############## Attributes of this Workstation: ############## composer prompt    =TWS1> ############## Attributes for CLI connection ############## HOST   =   TWS1.company.com  PROTOCOL   =   https PORT   =   31116 TIMEOUT   =   3600 IS REMOTE CLI = yes
e.g. TWS2 env.

############## Attributes of this Workstation: ############## composer prompt    =TWS2> ############## Attributes for CLI connection ############## HOST   =   TWS2.company.com  PROTOCOL   =   https PORT   =   31116 TIMEOUT   =   3600 IS REMOTE CLI = yes
I personally have multiple versions of localopts files and i'm overwriting the localopts file based on the needs. (e.g. localopts_TWS1, localopts_TWS2 and based on which TWS env. i want to connect i'm copying its localopts_XXX file over localopts)

     3. Once the user password expired you need to re-add it (as per first use), the first step that needs to be performed is to remove the useropt file from the user profile home and this can be automated by creating a *.cmd, file using the below commands:

@echo off del "%USERPROFILE%\.TWS\useropts" "%CD%\TWS_CLI_Start.cmd"
     4. You can adjust the default Windows editor which will be used in editing composer modify commands:

     X. To take full advantage of the remote CLI I recommend to use Windows PowerShell rather the default command line.


Tuesday, May 26, 2015

"conman" commands & syntax


conman commands are user to manage objects in PLAN (composer commands are used to manage objects in DATABASE)

Below are some very useful conman commands syntaxes grouped is several categories:

1. Jobs & Job Streams:

# display the stdlist (job log) of a specific job with jobid=job_number
conman sj "@#$job_number;stdlist;single" 
# add job steam scheduled time / date in the search query
conman "sj @#@ (0000).@" ; conman "ss @#@ (2204 05/25)" 
# count EXEC jobs, `echo "Yes"` before the command if conman parameters aren't set up
conman "sj @#@+state=EXEC;short" | grep "EXEC +" | wc -l 
# change job stream priority to 0
conman "ap @#JS1;0;noask" 
# change job stream limit to 0
conman "ls @#JS1;0;noask" 
# displays prompt messages
conman recall 
# displays information about files
conman showfiles 
# update windows user "username" password in the current plan
conman altpass username 
# display job details from plan
conman "dj @#@" 
# display job stream syntax from plan
conman "ds @#@" 
# display user launching the job
conman "sj @#@;logon" 
# display script / command used by job
conman "sj @#@;info" 
# display info using unique id for JS
conman "sj @#@;keys;extended" | uniq 

2. FTA Agents:

# change limit to 100
conman "lc @;100"
# change fence to 0, no ask
conman "fence @;0;noask"
# additional details about workstations (including netman port)
conman "sc;link"
# display agent version / fixpack and OS details
conman "sc @;info"
# to start monman, for event rules
conman startmon

3. Symphony:

# to check the agent health status (including symphony corruption)
conman "chs XYZ"
# to reset symphony of a corrupted agent
conman "resetfta XYZ"

4. Event rules:

# to list active event rules
conman "sc;getmon"
# to deploy the event rules
conman "deploy"

Control Characters:
You can enter the following control characters to interrupt conman.
Control+c   Conman stops executing the current command at the next step that can be interrupted, and returns a command prompt.
Control+d   Conman quits after executing the current command.

Wildcards:
@ Replaces one or more alphanumeric characters.
?   Replaces one alphabetic character.
% Replaces one numeric character.

Delimiters and special characters:
&amp Command delimiter.
+   A delimiter used to select objects for commands. It adds an attribute the object must have. For example: sked1.@+priority=0
~   A delimiter used to select objects for commands. It adds an attribute the object must not have. For example: sked1.@~priority=0
;    Argument delimiter. For example: ;info;offline
,    Repetition and range delimiter. For example: state=hold,sked,pend
=   Value delimiter. For example: state=hold
: !  Command prefixes that pass the command on to the system. These prefixes are optional; if Conman does not recognize the command, it is passed automatically to the system. For example: !ls or :ls
<<>> Comment brackets. For example: sj @#@.@ <>
*** Comment prefix. The prefix must be the first character on a command line or following a command delimiter. For example: *comment or sj & *comment**
>  Redirects command output to a file and overwrites the contents of the file. If the file does not exist, it is created. For example: sj > joblist
>> Redirects command output to a file and appends the output to the end of file. If the file does not exist, it is created. For example: sj >> joblist
|   Pipes command output to a system command or process. The system command is run whether or not output is generated. For example:  sj| grep ABEND
||  Pipes command output to a system command or process. The system command is not run if there is no output. For example: sj || grep ABEND



!!!! Note: I only described a fraction of conman commands available, to see all of them used THIS link.




Tuesday, May 5, 2015

"MAKEPLAN" & "UPDATESTATS" increase runtime


Why the runtime for jobs MAKEPLAN & UPDATESTATS from FINAL job stream it is increasing steadily day by day?

The main reason is that there are "left overs" in the plan or preproduction plan

1. Clean the old jobs / job streams from the plan. My recommendation is to set-up an automatically clean-up job that is canceling the +N weeks older job streams (in my experience I've discovered that we can safely cancel the +2 weeks old job streams).
conman "ss @#@"  # check the SchedTime 
2. Clean the "junk data" data from preproduction plan.
Do i have "junk data" in pre-production plan? In order to check run:
planman showinfo
And check the below line time stamp against you oldest job stream from the plan, if it is older a manual DB "junk data" clean-up must be performed.
Start time of first not complete preproduction plan job stream instance: 04/20/2015 00:04 TZ America/Los_Angeles
Connect to the TWS database check and delete the following:
a) All records from JSI_JOB_STREAM_INSTANCES older than the oldest job stream from the plan (usually the number of records should be low).

select * from JSI_JOB_STREAM_INSTANCES order by JSI_SCHEDULED_DATE;

    JSI_ID JSI_SYM_ID       JSI_FIRST_RUN_NUMBER JSI_LAST_RUN_NUMBER JSI_SCHEDULED_DATE JSI_START_TIME                  JSI_STATUS JST_ID                           RCY_ID                           WKC_ID                           VAT_ID                           PLAN_ID                       
---------- ---------------- -------------------- ------------------- ------------------ ------------------------------- ---------- -------------------------------- -------------------------------- -------------------------------- -------------------------------- --------------------------------
  10742074 0AAAAAAAAAAKH2J2                  863                 863 06-APR-15          05-APR-15 04.04.00.000000000 PM C          5A9D352A24D53AE78074D760D7CCB44B                                  DF397BE179E632FAA7892A3BBF01B179                                                                  
  10507507 0AAAAAAAAAAKAVHT                  848                 849 19-APR-15          20-APR-15 07.03.00.000000000 AM C          530A93D37FCA394E8144EA089708ECA6 33FCBC96CB62363AA4A1BC87D74EF655 38C431C7F7563087B4DF692EF152AB5A                                                                  
  10435375 0AAAAAAAAAAJ6OZP                  848                 848 19-APR-15          19-APR-15 11.00.00.000000000 PM C          6506E033D41F37219ABA3E6D4D2E46E0 01C08911A19E377CA1D75AE5A4FB81C1 DF397BE179E632FAA7892A3BBF01B179                                                                  
  10496296 0AAAAAAAAAAKAKJI                  848                 848 19-APR-15          20-APR-15 01.30.00.000000000 AM C          B7390188014E32A6BCADBE87A68B93F9 4E0BBC5B7DD432ACBA7F15AE621EA5C6 9B18F62CEE2532919612989A031EF052                                                                  
  10496303 0AAAAAAAAAAKAKJP                  848                 848 19-APR-15          20-APR-15 01.30.00.000000000 AM C          B5F7FDF861D133F0B75E6940CF97A39F B5C442B6CD653F4790ADCF25AE3F54C0 9B18F62CEE2532919612989A031EF052                                                                  
  10496310 0AAAAAAAAAAKAKJW                  848                 848 19-APR-15          20-APR-15 01.30.00.000000000 AM C          7A68C1570A9D3364845CB3F6D6A7DC0F 75C767CDAD0E33D4ACCD11076A7854D4 9B18F62CEE2532919612989A031EF052                                                                  
  10496317 0AAAAAAAAAAKAKJ5                  848                 849 19-APR-15          20-APR-15 01.30.00.000000000 AM C          190E13C8D2F633F88E53A7AC78FA2ACD 816CED621ADD3B02B4C71D30B21E6D5B 9B18F62CEE2532919612989A031EF052                                                                  


delete from JSI_JOB_STREAM_INSTANCES where JSI_SYM_ID = '0AAAAAAAAAAKH2J2';
commit;
b) All invalid entries from preproduction plan:
select count(*) from JSI_JOB_STREAM_INSTANCES where PLAN_ID is not null;

COUNT(*)
----------
      123 

delete from JSI_JOB_STREAM_INSTANCES where PLAN_ID is not null;
commit;

On the next run "MAKEPLAN" & "UPDATESTATS" will decrease, in some cases the new runtime could be ~60-80% less.