Thursday, January 21, 2010
Display external jobs in PS Process Monitor
Many task schedulers exist to provide complex and powerful features that PS' own Process Scheduler cannot match. For example, IBM's Tivoli Workload Scheduler allows complex definition of jobs (=PS' Process) and Job Streams (= PS' Job), server and workstation setup, sophisticated dependency structure, cross platform support, scheduling calendar and beyond, in a GUI environment. You can define complex dependency in its graphical to drag and link jobs with ease. A drawback of this is these jobs are not displayed in Process Monitor. The following are the steps I took to display them in PS:
Friday, January 15, 2010
Quick PS Util - Get Record Description
This function displays Record Definition under Property for a PS record, the function can be expanded to display LONG field values for any PS record.
EX:
Select gl('psrecdefn','descrlong','vendor') From dual
**** Nice utility to parse PS SQL Trace files : http://devwfb.blogspot.com/2009/11/script-analyzing-tracesql-file-and.html
Get View Definition Text: -----------------------------------------------------------------------
select * from user_views where view_name=upper('')
select DBMS_METADATA.GET_DDL('VIEW',upper('___')) from dual
select * from PSSQLTEXTDEFN where sqlid=upper('___')
Create Or replace Function gl( rec In varchar2, long_fld In varchar2, key_fld In varchar2 )
Return varchar2
As
l_cursor integer Default dbms_sql.open_cursor;
l_n number;
l_long_val varchar2(4000);
l_long_len number;
l_buflen number := 4000;
l_curpos number := 0;
Begin
dbms_sql.parse( l_cursor, 'select ' || long_fld || ' from ' || rec ||' where recname=upper(:x)', dbms_sql.native );
dbms_sql.bind_variable( l_cursor, ':x', key_fld );
dbms_sql.define_column_long(l_cursor, 1);
l_n := dbms_sql.execute(l_cursor);
If (dbms_sql.fetch_rows(l_cursor)>0)
Then
dbms_sql.column_value_long(l_cursor, 1, l_buflen, l_curpos ,l_long_val, l_long_len );
End If;
dbms_sql.close_cursor(l_cursor);
Return l_long_val;
End gl;
/
EX:
Select gl('psrecdefn','descrlong','vendor') From dual
**** Nice utility to parse PS SQL Trace files : http://devwfb.blogspot.com/2009/11/script-analyzing-tracesql-file-and.html
Get View Definition Text: -----------------------------------------------------------------------
select * from user_views where view_name=upper('')
select DBMS_METADATA.GET_DDL('VIEW',upper('___')) from dual
select * from PSSQLTEXTDEFN where sqlid=upper('___')
Thursday, January 7, 2010
Korn Shell Snippets
Numeric Test --
1.
if [[ -z $(echo $2 | sed 's/[0-9]//g') ]]
then
echo "integer only"
fi
if [[ -z $(echo $2 | awk '/^[0-9]+$/') ]]
then
echo "integer only"
fi
if [[ ! -z $(awk -v x=$a 'END{if(x==x+0) print "integer"}' /dev/null) ]]
then
echo "integer only"
fi
Select * From table_name Where Regexp_Like(column_name, '^[0-9]+
Display Shell line number --
typeset -x PS4='[$LINENO] '
ksh -x script)
Alias to display File access/mod/create time --
alias ft='_(){ echo "modify time: \c";ls -l $1; echo "create time: \c"; ls -lc $1; echo "access time: \c";ls -lu $1; }; _'
Display Date Time at prompt:
export SECONDS="$(date '+3600*%H+60*%M+%S')";typeset -Z2 _h; typeset -Z2 _m ; typeset -Z2 _s;_hh="(SECONDS/3600)%24";_mm="(SECONDS/60)%60";_ss="(SECONDS)%60";_time='${_x[(_m=_mm)==(_h=_hh)==(_s=_ss)]}$_h:$_m:$_s';
export PS1=$(echo "${_time}")':$PWD>';
Date math & TZ (AIX): /etc/environment (https://www-304.ibm.com/support/docview.wss?uid=isg3T1000252)
TZ=CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00 (DST enabled)
tz=`echo $TZ | tr -s '[:upper:]' '[\0*]' | cut -d, -f"1"`
# 2 hrs back
((tz_2hr_back=$tz+2))
# date string format = MMDDHHMIYY
TZ=GMT+$tz_2hr_back date +%m%d%H%M%y;
ksh93 Associative Array:
unsert color
set -A color
color=([Application Engine]=1 \
[COBOL SQL]=2 \
[Crystal]=3 \
[SQR Process]=4 \
[SQR Report]=5)
${color[@]} = all elements of the array
${!color[@]} = subscripts of an array
${#color[@]} = # of elements within the array.
${color[@]:offset:length} = Elements within a numeric subscript range
echo ${color[@]}
echo ${!color[@]}
echo ${#color[@]}
echo ${color[@]:1:length}
idx=0
while [ $idx -lt ${#color[@]} ]
do
echo ${color[@]:$idx:1}
((idx=idx+1))
done
1.
if [[ -z $(echo $2 | sed 's/[0-9]//g') ]]
then
echo "integer only"
fi
if [[ -z $(echo $2 | awk '/^[0-9]+$/') ]]
then
echo "integer only"
fi
if [[ ! -z $(awk -v x=$a 'END{if(x==x+0) print "integer"}' /dev/null) ]]
then
echo "integer only"
fi
Select * From table_name Where Regexp_Like(column_name, '^[0-9]+
Display Shell line number --
typeset -x PS4='[$LINENO] '
ksh -x script)
Alias to display File access/mod/create time --
alias ft='_(){ echo "modify time: \c";ls -l $1; echo "create time: \c"; ls -lc $1; echo "access time: \c";ls -lu $1; }; _'
Display Date Time at prompt:
export SECONDS="$(date '+3600*%H+60*%M+%S')";typeset -Z2 _h; typeset -Z2 _m ; typeset -Z2 _s;_hh="(SECONDS/3600)%24";_mm="(SECONDS/60)%60";_ss="(SECONDS)%60";_time='${_x[(_m=_mm)==(_h=_hh)==(_s=_ss)]}$_h:$_m:$_s';
export PS1=$(echo "${_time}")':$PWD>';
Date math & TZ (AIX): /etc/environment (https://www-304.ibm.com/support/docview.wss?uid=isg3T1000252)
TZ=CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00 (DST enabled)
- CST6CDT is the time zone you are in;
- M3 is the third month;
- .2 is the second occurrence of the day in the month;
- .0 is Sunday;
- /2:00:00 is the time.
tz=`echo $TZ | tr -s '[:upper:]' '[\0*]' | cut -d, -f"1"`
# 2 hrs back
((tz_2hr_back=$tz+2))
# date string format = MMDDHHMIYY
TZ=GMT+$tz_2hr_back date +%m%d%H%M%y;
ksh93 Associative Array:
unsert color
set -A color
color=([Application Engine]=1 \
[COBOL SQL]=2 \
[Crystal]=3 \
[SQR Process]=4 \
[SQR Report]=5)
${color[@]} = all elements of the array
${!color[@]} = subscripts of an array
${#color[@]} = # of elements within the array.
${color[@]:offset:length} = Elements within a numeric subscript range
echo ${color[@]}
echo ${!color[@]}
echo ${#color[@]}
echo ${color[@]:1:length}
idx=0
while [ $idx -lt ${#color[@]} ]
do
echo ${color[@]:$idx:1}
((idx=idx+1))
done
Subscribe to:
Posts (Atom)