Sunday, August 31, 2008
OCT – Operation Cost Target:
This value represents the maximum expenditure for material, labor, outsourcing, overhead, and all other costs associated with that project. This figure can then be divided between the various operations comprising the manufacturing process, in order to control costs at each step.
Tuesday, August 26, 2008
Calendar Coloring in Lotus Notes:
Lotus Notes 8 has added two new coloring features to calendar. Now in addition to defining the colors for the different meeting types, we can now define how we want unprocessed meetings and cancellations to appear on the calendar.
In Preferenes -> Calendar & To Do -> Colors, there is a option to set colors for the New meetings and Cancelled meetings.
Here is an example where we invite a person to a meeting.
He has not yet accepted the calendar invite that is in his in-box, but Notes 8 now displays the unprocessed meeting on his calendar anyway.
After he accepts, it is displayed as we would expect.
Then as the chairperson we have to unfortunately cancel the meeting. The person has not had the time to open the cancellation notice in his email, but Notes 8 automatically changes the way the meeting is displayed on his calendar, visually informing him that the meeting has been cancelled.
In Preferenes -> Calendar & To Do -> Colors, there is a option to set colors for the New meetings and Cancelled meetings.
Here is an example where we invite a person to a meeting.
He has not yet accepted the calendar invite that is in his in-box, but Notes 8 now displays the unprocessed meeting on his calendar anyway.
After he accepts, it is displayed as we would expect.
Then as the chairperson we have to unfortunately cancel the meeting. The person has not had the time to open the cancellation notice in his email, but Notes 8 automatically changes the way the meeting is displayed on his calendar, visually informing him that the meeting has been cancelled.
Monday, August 25, 2008
Quick method to find the name of the Calling Program:
Infinitely, IBM has kindly provided us with QWVRCSTK at V5.
D GetCaller PR Extpgm('QWVRCSTK')
D 2000
D 10I 0
D 8 CONST
D 56
D 8 CONST
D 15
D Var DS 2000
D BytAvl 10I 0
D BytRtn 10I 0
D Entries 10I 0
D Offset 10I 0
D EntryCount 10I 0
D VarLen S 10I 0 Inz(%size(Var))
D ApiErr S 15
D JobIdInf DS
D JIDQName 26 Inz('*')
D JIDIntID 16
D JIDRes3 2 Inz(*loval)
D JIDThreadInd 10I 0 Inz(1)
D JIDThread 8 Inz(*loval)
D Entry DS 256
D EntryLen 10I 0
D PgmNam 10 Overlay(Entry:25)
D PgmLib 10 Overlay(Entry:35)
D
C CallP GetCaller(Var:VarLen:'CSTK0100':JobIdInf
C :'JIDF0100':ApiErr)
C Do EntryCount
C Eval Entry = %subst(Var:Offset + 1)
C Eval Offset = Offset + EntryLen
C Enddo
C Eval *InLR = *on
D GetCaller PR Extpgm('QWVRCSTK')
D 2000
D 10I 0
D 8 CONST
D 56
D 8 CONST
D 15
D Var DS 2000
D BytAvl 10I 0
D BytRtn 10I 0
D Entries 10I 0
D Offset 10I 0
D EntryCount 10I 0
D VarLen S 10I 0 Inz(%size(Var))
D ApiErr S 15
D JobIdInf DS
D JIDQName 26 Inz('*')
D JIDIntID 16
D JIDRes3 2 Inz(*loval)
D JIDThreadInd 10I 0 Inz(1)
D JIDThread 8 Inz(*loval)
D Entry DS 256
D EntryLen 10I 0
D PgmNam 10 Overlay(Entry:25)
D PgmLib 10 Overlay(Entry:35)
D
C CallP GetCaller(Var:VarLen:'CSTK0100':JobIdInf
C :'JIDF0100':ApiErr)
C Do EntryCount
C Eval Entry = %subst(Var:Offset + 1)
C Eval Offset = Offset + EntryLen
C Enddo
C Eval *InLR = *on
Sunday, August 24, 2008
Tips for faster Query Access:
Faster is better when accessing large volumes of data. There are many ways to improve SQL performance, but here are four tips that are especially useful for high volume, read-only database access.
• Code a Set Option AlwCpyDta = *Optimize SQL statement (or the AlwCpyDta(*Optimize) parameter on the appropriate CL command). This lets the optimizer choose whether to create a new index or use a sort for a temporary copy of the data.
• Note that AlwCpyDta=*Yes actually means "use a copy only when it's required to perform the query." This allows the optimizer less latitude than the *Optimize option provides.
• Code a Set Option AlwBlk = *AllRead SQL statement (or the AlwBlk(*AllRead) parameter on the appropriate CL command). This maximizes system blocking when possible.
• Use a CL OvrDbF (Override with Database File) command with the SeqOnly(*Yes, mm) and/or the NbrRcds(nn) parameter(s) to specify system blocking for batch sequential Fetch's.
Use multi-row fetches to read a set of records with each Fetch statement.
• Code a Set Option AlwCpyDta = *Optimize SQL statement (or the AlwCpyDta(*Optimize) parameter on the appropriate CL command). This lets the optimizer choose whether to create a new index or use a sort for a temporary copy of the data.
• Note that AlwCpyDta=*Yes actually means "use a copy only when it's required to perform the query." This allows the optimizer less latitude than the *Optimize option provides.
• Code a Set Option AlwBlk = *AllRead SQL statement (or the AlwBlk(*AllRead) parameter on the appropriate CL command). This maximizes system blocking when possible.
• Use a CL OvrDbF (Override with Database File) command with the SeqOnly(*Yes, mm) and/or the NbrRcds(nn) parameter(s) to specify system blocking for batch sequential Fetch's.
Use multi-row fetches to read a set of records with each Fetch statement.
Friday, August 22, 2008
V5R3 Enhancement in SQL:
SQL's INSERT command adds records to a table (physical file) or view (logical file). There are three forms of INSERT. The VALUES form allows you to create a record from constants. For example, assume a table PLANT with two columns (fields)--ID and NAME.
create table qtemp/Plants (ID char(4),Name char(12))
To create rows (records) for two factories, you could use two insert commands.
insert into qtemp/plants values('1492', 'Lost Angeles')
insert into qtemp/plants values('2001', 'New Yolk')
In V5R3, IBM enhanced the VALUES form of INSERT to permit you to insert more than one row at a time. The following INSERT command inserts two rows.
insert into qtemp/plants values ('1492', 'Lost Angeles'), ('2001', 'New Yolk')
Each row's values are enclosed in parentheses and separated from other rows with commas.
This is not an IBM-only feature. Other SQL platforms support it as well.
create table qtemp/Plants (ID char(4),Name char(12))
To create rows (records) for two factories, you could use two insert commands.
insert into qtemp/plants values('1492', 'Lost Angeles')
insert into qtemp/plants values('2001', 'New Yolk')
In V5R3, IBM enhanced the VALUES form of INSERT to permit you to insert more than one row at a time. The following INSERT command inserts two rows.
insert into qtemp/plants values ('1492', 'Lost Angeles'), ('2001', 'New Yolk')
Each row's values are enclosed in parentheses and separated from other rows with commas.
This is not an IBM-only feature. Other SQL platforms support it as well.
Thursday, August 21, 2008
Right Justify Character data using SQL:
There is no "right-justify" string function built into SQL, but it can still be done: Taking a character string of variable size and right-justifying within a target column containing a maximum of 12 characters. The example below does a bit more but it illustrates well what can be done, effectively concatenating blanks (up to 12) for a length of 12 - the length of the source column.
INSERT INTO TARGET_TABLE
SITE_CODE_RIGHT_JUSTIFED
SELECT
SUBSTR(' ', 1, 12 -
LENGTH( TRIM( CHAR_COLUMN_NAME)))
|| TRIM( CHAR_COLUMN_NAME )
FROM TABLE
FROM SOURCE_DATA
INSERT INTO TARGET_TABLE
SITE_CODE_RIGHT_JUSTIFED
SELECT
SUBSTR(' ', 1, 12 -
LENGTH( TRIM( CHAR_COLUMN_NAME)))
|| TRIM( CHAR_COLUMN_NAME )
FROM TABLE
FROM SOURCE_DATA
Tuesday, August 19, 2008
Various Date format conversions:
**********************************************************************
* character dates
d @chara s 8 inz('04/12/01')
d @charb s 10 inz('12/02/2004')
d @charc s 8 inz('12/03/04')
**********************************************************************
* date field
d @datea s d inz(d'2004-12-04')
**********************************************************************
* numeric dates
d @numa s 6 0 inz(041205)
d @numb s 7 0 inz(1041206)
d @numc s 8 0 inz(20041207)
d @numd s 6 0 inz(120804)
d @nume s 8 0 inz(12092004)
**********************************************************************
/free
//character to character...
@charb = %char(%date(@chara:*ymd/):*usa/); //'yy/mm/dd' to 'mm/dd/ccyy'
@charc = %char(%date(@chara:*ymd/):*mdy/); //'yy/mm/dd' to 'mm/dd/yy'
@chara = %char(%date(@charb:*usa/):*ymd/); //'mm/dd/ccyy' to 'yy/mm/dd'
@charc = %char(%date(@charb:*usa/):*mdy/); //'mm/dd/ccyy' to 'mm/dd/yy'
@chara = %char(%date(@charc:*mdy/):*ymd/); //'mm/dd/yy' to 'yy/mm/dd'
@charb = %char(%date(@charc:*mdy/):*usa/); //'mm/dd/yy' to 'mm/dd/ccyy'
//character to numeric...
@numa = %dec(%char(%date(@chara:*ymd/):*ymd0):6:0); //'yy/mm/dd' toyymmdd
@numb = %dec(%char(%date(@chara:*ymd/):*cymd0):7:0); //'yy/mm/dd' to cyymmdd
@numd = %dec(%char(%date(@chara:*ymd/):*mdy0):7:0); //'yy/mm/dd' to mmddyy
@numa = %dec(%char(%date(@charb:*usa/):*ymd0):6:0); //'mm/dd/ccyy' toyymmdd
@numb = %dec(%char(%date(@charb:*usa/):*cymd0):7:0); //'mm/dd/ccyy' to cyymmdd
@numd = %dec(%char(%date(@charb:*usa/):*mdy0):7:0); //'mm/dd/ccyy' to mmddyy
@numa = %dec(%char(%date(@charc:*mdy/):*ymd0):6:0); //'mm/dd/yy' to yymmdd
@numb = %dec(%char(%date(@charc:*mdy/):*cymd0):7:0); //'mm/dd/yy' to cyymmdd
@numd = %dec(%char(%date(@charc:*mdy/):*mdy0):7:0); //'mm/dd/yy' to mmddyy
//date to character...
@chara = %char(@datea:*ymd/); //d'ccyy-mm-dd' to 'yy/mm/dd'
@charb = %char(@datea:*usa/); //d'ccyy-mm-dd' to 'mm/dd/ccyy'
@charc = %char(@datea:*mdy/); //d'ccyy-mm-dd' to 'mm/dd/yy'
//numeric to character...
@chara = %char(%date(@numa:*ymd):*ymd/); //yymmdd to 'yy/mm/dd'
@charb = %char(%date(@numa:*ymd):*usa/); //yymmdd to 'mm/dd/ccyy'
@charc = %char(%date(@numa:*ymd):*mdy/); //yymmdd to 'mm/dd/yy'
@chara = %char(%date(@numb:*cymd):*ymd/); //cyymmdd to 'yy/mm/dd'
@charb = %char(%date(@numb:*cymd):*usa/); //cyymmdd to 'mm/dd/ccyy'
@charc = %char(%date(@numb:*cymd):*mdy/); //cyymmdd to 'mm/dd/yy'
@chara = %char(%date(@numc:*iso):*ymd/); //d'ccyy-mm-dd' to 'yy/mm/dd'
@charb = %char(%date(@numc:*iso):*usa/); //d'ccyy-mm-dd' to 'mm/dd/ccyy'
@charc = %char(%date(@numc:*iso):*mdy/); //d'ccyy-mm-dd' to 'mm/dd/yy'
@chara = %char(%date(@numd:*mdy):*ymd/); //mmddyy to 'yy/mm/dd'
@charb = %char(%date(@numd:*mdy):*usa/); //mmddyy to 'mm/dd/ccyy'
@charc = %char(%date(@numd:*mdy):*mdy/); //mmddyy to 'mm/dd/yy'
@chara = %char(%date(@nume:*usa):*ymd/); //mmddccyy to 'yy/mm/dd'
@charb = %char(%date(@nume:*usa):*usa/); //mmddccyy to 'mm/dd/ccyy'
@charc = %char(%date(@nume:*usa):*mdy/); //mmddccyy to 'mm/dd/yy'
//numeric to date...
@datea = %date(@numa:*ymd); //yymmdd to d'ccyy-mm-dd'
@datea = %date(@numb:*cymd); //cyymmdd to d'ccyy-mm-dd'
@datea = %date(@numc:*iso); //ccyymmdd' to d'ccyy-mm-dd'
@datea = %date(@numd:*mdy); //mmddyy to d'ccyy-mm-dd'
@datea = %date(@nume:*usa); //mmddccyy to d'ccyy-mm-dd'
//numeric to numeric...
@numb = %dec(%char(%date(@numa:*ymd):*cymd0):7:0); //yymmdd to cyymmdd
@numc = %dec(%char(%date(@numa:*ymd):*iso0):8:0); //yymmdd to ccyymmdd
@numd = %dec(%char(%date(@numa:*ymd):*mdy0):6:0); //yymmdd to mmddyy
@nume = %dec(%char(%date(@numa:*ymd):*usa0):8:0); //yymmdd to mmddccyy
@numa = %dec(%char(%date(@numb:*cymd):*ymd0):6:0); //cyymmdd to yymmdd
@numc = %dec(%char(%date(@numb:*cymd):*iso0):8:0); //cyymmdd to ccyymmdd
@numd = %dec(%char(%date(@numb:*cymd):*mdy0):6:0); //cyymmdd to mmddyy
@nume = %dec(%char(%date(@numb:*cymd):*usa0):8:0); //cyymmdd to mmddccyy
@numa = %dec(%char(%date(@numc:*iso):*ymd0):6:0); //ccyymmdd to yymmdd
@numb = %dec(%char(%date(@numc:*iso):*cymd0):7:0); //ccyymmdd tocyymmdd
@numd = %dec(%char(%date(@numc:*iso):*mdy0):6:0); //ccyymmdd to mmddyy
@nume = %dec(%char(%date(@numc:*iso):*usa0):8:0); //ccyymmdd to mmddccyy
@numa = %dec(%char(%date(@numd:*mdy):*ymd0):6:0); //mmddyy to yymmdd
@numb = %dec(%char(%date(@numd:*mdy):*cymd0):7:0); //mmddyy to cyymmdd
@numc = %dec(%char(%date(@numd:*mdy):*iso0):8:0); //mmddyy to ccyymmdd
@nume = %dec(%char(%date(@numd:*mdy):*usa0):8:0); //mmddyy to mmddccyy
@numa = %dec(%char(%date(@nume:*usa):*ymd0):6:0); //mmddccyy to yymmdd
@numb = %dec(%char(%date(@nume:*usa):*cymd0):7:0); //mmddccyy to cyymmdd
@numc = %dec(%char(%date(@nume:*usa):*iso0):8:0); //mmddccyy to ccyymmdd
@numd = %dec(%char(%date(@nume:*usa):*mdy0):6:0); //mmddccyy to mmddyy
*inlr = *on;
/end-free
* character dates
d @chara s 8 inz('04/12/01')
d @charb s 10 inz('12/02/2004')
d @charc s 8 inz('12/03/04')
**********************************************************************
* date field
d @datea s d inz(d'2004-12-04')
**********************************************************************
* numeric dates
d @numa s 6 0 inz(041205)
d @numb s 7 0 inz(1041206)
d @numc s 8 0 inz(20041207)
d @numd s 6 0 inz(120804)
d @nume s 8 0 inz(12092004)
**********************************************************************
/free
//character to character...
@charb = %char(%date(@chara:*ymd/):*usa/); //'yy/mm/dd' to 'mm/dd/ccyy'
@charc = %char(%date(@chara:*ymd/):*mdy/); //'yy/mm/dd' to 'mm/dd/yy'
@chara = %char(%date(@charb:*usa/):*ymd/); //'mm/dd/ccyy' to 'yy/mm/dd'
@charc = %char(%date(@charb:*usa/):*mdy/); //'mm/dd/ccyy' to 'mm/dd/yy'
@chara = %char(%date(@charc:*mdy/):*ymd/); //'mm/dd/yy' to 'yy/mm/dd'
@charb = %char(%date(@charc:*mdy/):*usa/); //'mm/dd/yy' to 'mm/dd/ccyy'
//character to numeric...
@numa = %dec(%char(%date(@chara:*ymd/):*ymd0):6:0); //'yy/mm/dd' toyymmdd
@numb = %dec(%char(%date(@chara:*ymd/):*cymd0):7:0); //'yy/mm/dd' to cyymmdd
@numd = %dec(%char(%date(@chara:*ymd/):*mdy0):7:0); //'yy/mm/dd' to mmddyy
@numa = %dec(%char(%date(@charb:*usa/):*ymd0):6:0); //'mm/dd/ccyy' toyymmdd
@numb = %dec(%char(%date(@charb:*usa/):*cymd0):7:0); //'mm/dd/ccyy' to cyymmdd
@numd = %dec(%char(%date(@charb:*usa/):*mdy0):7:0); //'mm/dd/ccyy' to mmddyy
@numa = %dec(%char(%date(@charc:*mdy/):*ymd0):6:0); //'mm/dd/yy' to yymmdd
@numb = %dec(%char(%date(@charc:*mdy/):*cymd0):7:0); //'mm/dd/yy' to cyymmdd
@numd = %dec(%char(%date(@charc:*mdy/):*mdy0):7:0); //'mm/dd/yy' to mmddyy
//date to character...
@chara = %char(@datea:*ymd/); //d'ccyy-mm-dd' to 'yy/mm/dd'
@charb = %char(@datea:*usa/); //d'ccyy-mm-dd' to 'mm/dd/ccyy'
@charc = %char(@datea:*mdy/); //d'ccyy-mm-dd' to 'mm/dd/yy'
//numeric to character...
@chara = %char(%date(@numa:*ymd):*ymd/); //yymmdd to 'yy/mm/dd'
@charb = %char(%date(@numa:*ymd):*usa/); //yymmdd to 'mm/dd/ccyy'
@charc = %char(%date(@numa:*ymd):*mdy/); //yymmdd to 'mm/dd/yy'
@chara = %char(%date(@numb:*cymd):*ymd/); //cyymmdd to 'yy/mm/dd'
@charb = %char(%date(@numb:*cymd):*usa/); //cyymmdd to 'mm/dd/ccyy'
@charc = %char(%date(@numb:*cymd):*mdy/); //cyymmdd to 'mm/dd/yy'
@chara = %char(%date(@numc:*iso):*ymd/); //d'ccyy-mm-dd' to 'yy/mm/dd'
@charb = %char(%date(@numc:*iso):*usa/); //d'ccyy-mm-dd' to 'mm/dd/ccyy'
@charc = %char(%date(@numc:*iso):*mdy/); //d'ccyy-mm-dd' to 'mm/dd/yy'
@chara = %char(%date(@numd:*mdy):*ymd/); //mmddyy to 'yy/mm/dd'
@charb = %char(%date(@numd:*mdy):*usa/); //mmddyy to 'mm/dd/ccyy'
@charc = %char(%date(@numd:*mdy):*mdy/); //mmddyy to 'mm/dd/yy'
@chara = %char(%date(@nume:*usa):*ymd/); //mmddccyy to 'yy/mm/dd'
@charb = %char(%date(@nume:*usa):*usa/); //mmddccyy to 'mm/dd/ccyy'
@charc = %char(%date(@nume:*usa):*mdy/); //mmddccyy to 'mm/dd/yy'
//numeric to date...
@datea = %date(@numa:*ymd); //yymmdd to d'ccyy-mm-dd'
@datea = %date(@numb:*cymd); //cyymmdd to d'ccyy-mm-dd'
@datea = %date(@numc:*iso); //ccyymmdd' to d'ccyy-mm-dd'
@datea = %date(@numd:*mdy); //mmddyy to d'ccyy-mm-dd'
@datea = %date(@nume:*usa); //mmddccyy to d'ccyy-mm-dd'
//numeric to numeric...
@numb = %dec(%char(%date(@numa:*ymd):*cymd0):7:0); //yymmdd to cyymmdd
@numc = %dec(%char(%date(@numa:*ymd):*iso0):8:0); //yymmdd to ccyymmdd
@numd = %dec(%char(%date(@numa:*ymd):*mdy0):6:0); //yymmdd to mmddyy
@nume = %dec(%char(%date(@numa:*ymd):*usa0):8:0); //yymmdd to mmddccyy
@numa = %dec(%char(%date(@numb:*cymd):*ymd0):6:0); //cyymmdd to yymmdd
@numc = %dec(%char(%date(@numb:*cymd):*iso0):8:0); //cyymmdd to ccyymmdd
@numd = %dec(%char(%date(@numb:*cymd):*mdy0):6:0); //cyymmdd to mmddyy
@nume = %dec(%char(%date(@numb:*cymd):*usa0):8:0); //cyymmdd to mmddccyy
@numa = %dec(%char(%date(@numc:*iso):*ymd0):6:0); //ccyymmdd to yymmdd
@numb = %dec(%char(%date(@numc:*iso):*cymd0):7:0); //ccyymmdd tocyymmdd
@numd = %dec(%char(%date(@numc:*iso):*mdy0):6:0); //ccyymmdd to mmddyy
@nume = %dec(%char(%date(@numc:*iso):*usa0):8:0); //ccyymmdd to mmddccyy
@numa = %dec(%char(%date(@numd:*mdy):*ymd0):6:0); //mmddyy to yymmdd
@numb = %dec(%char(%date(@numd:*mdy):*cymd0):7:0); //mmddyy to cyymmdd
@numc = %dec(%char(%date(@numd:*mdy):*iso0):8:0); //mmddyy to ccyymmdd
@nume = %dec(%char(%date(@numd:*mdy):*usa0):8:0); //mmddyy to mmddccyy
@numa = %dec(%char(%date(@nume:*usa):*ymd0):6:0); //mmddccyy to yymmdd
@numb = %dec(%char(%date(@nume:*usa):*cymd0):7:0); //mmddccyy to cyymmdd
@numc = %dec(%char(%date(@nume:*usa):*iso0):8:0); //mmddccyy to ccyymmdd
@numd = %dec(%char(%date(@nume:*usa):*mdy0):6:0); //mmddccyy to mmddyy
*inlr = *on;
/end-free
Subscribe to:
Posts (Atom)