Thursday, October 30, 2008

Quickly create groups in Lotus Notes:

From the contacts view in your Personal Address Book, you can easily create a group containing names from selected documents.

For example, if I select people in my family, and then choose Tools - Copy Into New Group



Notes create a new Group document, with the values of each contact filled in automatically. All we need to do now is give the group a name, and save and close.




This is very useful if you often find that you are sending emails to the same group of people.

Wednesday, October 29, 2008

Make Subfile Page to retain its page:

If you select a record from a subfile with multiple pages (e.g. selecting an item from a subfile to change), make your change and then return back to your subfile, the subfile would usually reload from record one to the end, making you page down to the record you had changed. To bring you back to the page you were on, add the following code to your display file and program.
Code
Using PDM, in the control section of your display file, add in the line
@pag 4 0H SFLRCDNBR
@pag is in the NAME column, the 4 is the length, the 0 is the decimal position and the SFLRCDNBR is in the functions column.
In your program, initialize @pag to 1.
When you select the line to change, z-add the rrn to @pag, and your program will return you to the subfile page you were on.

Inventory:

Inventory is a list for goods and materials, or those goods and materials themselves, held available in stock by a business.
There are three basic reasons for keeping an inventory:
1. Time - The time lags present in the supply chain, from supplier to user at every stage, requires that you maintain certain amount of inventory to use in this "lead time"
2. Uncertainty - Inventories are maintained as buffers to meet uncertainties in demand, supply and movements of goods.
3. Economies of scale - Ideal condition of "one unit at a time at a place where user needs it, when he needs it" principle tends to incur lots of costs in terms of logistics. So bulk buying, movement and storing brings in economies of scale, thus inventory.
All these stock reasons can apply to any owner or product stage.
• Buffer stock is held in individual workstations against the possibility that the upstream workstation may be a little delayed in long setup or change-over time. This stock is then used while that change-over is happening.
• Distressed inventory is inventory whose potential to be sold at a normal cost has or will soon pass. In certain industries it could also mean that the stock is or will soon be impossible to sell. Examples of distressed inventory include products that have reached its expiry date, or has reached a date in advance of expiry at which the planned market will no longer purchase it (e.g. 3 months left to expiry), clothing that is defective or out of fashion, and old newspapers or magazines. It also includes computer or consumer-electronic equipment that is obsolescent or discontinued and whose manufacturer is unable to support it.

Thursday, October 23, 2008

Pearson’s Correlation:

The Pearson's correlation is used to find a correlation between at least two continuous variables. The value for a Pearson's can fall between 0.00 (no correlation) and 1.00 (perfect correlation). Other factors such as group size will determine if the correlation is significant. Generally, correlations above 0.80 are considered pretty high.

Positive correlation indicates that both variables increase or decrease together, whereas negative correlation indicates that as one variable increases, so the other decreases, and vice versa.

Wednesday, October 22, 2008

Easy way to Sort Subfile data:

Sorting data is something RPG programs often need to do. If it's just a simple single field array you're sorting in order to use the much faster binary search possible with %Lookup, for example, then SORTA works well and is simple. But what if it is a more complex task like sorting the data in a subfile on a user-selected column? Surely you need some more involved techniques, such as retrieving the data from the database again using a different ORDER BY on an SQL SELECT statement or using a different logical file or you could use the qsort C function for sorting the array elements in the program. Something as simple as SORTA can't be used for that, right?
Maybe so. The circumstances where this is effective are limited, for sure, but if your requirements fit, then using SORTA with a group field can be the simplest way and often a faster alternative than other methods you may have tried.
First of all, what's a group field? It's a field in a data structure that is broken down into smaller subfields. For example, group field SflData might be made up of information about products (name, price, quantity) by using the Overlay keyword, such as:
D SflDS Ds Inz
D SflData Like(SflRecData)
D Dim(999)
D Name Like(ProdDS)
D Overlay(SflData)
D Price Like(SellPr)
D Overlay(SflData:*Next)
D Qty Like(STOH)
D Overlay(SflData:*Next)
The effect is similar to nested data structures, except without the requirement to use qualified names. (Likewise, there are many limitations on group fields because of the lack of name qualification.) One additional thing that's nice about group fields compared to nested DSs is that we can use SORTA against any of the subfields in a group field array.
So this means if I wanted to sort the data in the SflData array by product name, I could do that with the following statement: SortA Name;. Much simpler than any of those other options I mentioned above! Of course, in nearly all cases, it would require the use of the built-in function %SubArr (substring array) because I'm not likely to have filled up all 999 elements of SflData. Even so, the entire bit of logic to accomplish sorting this subfile data in the sequence of any of the three fields could be as simple as:
If SortByName;
SortA %SubArr(Name:1:Count);
ElseIf SortByQty;
SortA %SubArr(Qty:1:Count);
ElseIf SortByPrice;
SortA %SubArr(Price:1:Count);
EndIf;
This technique is very simple and in most cases quite a fast way to sort subfile data (or any other kind of repeating data). It does have significant limitations. For example, you can only sort on one subfield at a time. (Of course, you could group two subfields together if they happen to be adjacent in the subfile record.) Also, you must be able to retrieve and store all the data destined for the subfile into an array so that you can sort it all together. For some very large subfiles, that won't be practical. But for those occasions where it works, it couldn't get much simpler.

Tuesday, October 21, 2008

Drop Shipping:

Definition: The process, in which a retailer markets a product, collects payment from the customer and then orders the item from a supplier, to be shipped directly that customer. The retailer's profit is the difference between the amount collected and the amount spent. No inventory is held and the retailer is not involved in the shipping.

Examples: To expand our product listing online, we use several suppliers that offer drop shipping.

Monday, October 20, 2008

Repeating Calendar entries in Lotus Notes:

When you schedule a meeting, click on repeat, and you will see a wide variety of options. You can choose when the meeting should repeat (weekly, monthly, yearly), for how long (duration or to a specific date), and even control things like what happens on weekends (move to Friday or Monday, or don't schedule at all). You can even choose "Custom" to select specific dates if none of the available combinations of parameters accomplishes what you are looking for. The dates are also computed and displayed for you in real time on the right hand side.

Sunday, October 19, 2008

Conditional Insert in SQL:

Sometimes we would like to insert records into database on a conditional basis.

Example:

if not exists (select 1 from table1 where key1 = ?) then
insert into table1
(key1, key2, key3, key4)
values (?, ?, ?, 1);
end if

As DB2 does not support dynamic scripting, this can be achieved by the following query.

insert into table1
(key1, key2, key3, key4)
Select ?,?,?,1
From SysDummy1
Where Not Exists
(Select 1
From table1
Where key1=?)

The question marks represent parameter markers (roughly equivalent to host variables in pre-compiled SQL.) Values need to be assigned to each of these markers before the statement can execute successfully.
Take note that SysDummy1 is a special IBM one row table that can be used as a trick for these one row operation situations! This is because inserting parameter values from a one row table is equivalent to the INSERT/VALUES statement. Placing the NOT EXISTS predicate in the WHERE clause instead of using an IF statement still allows us to condition if the row should be inserted by testing whether the row already exists.
As a side note, SysDummy1 resides in the SysIBM schema so it should be part of the library list when using the *SYS naming convention or fully qualified (SYSIBM.SysDummy1) when using the *SQL naming convention. Alternatively, if you have a one row table in your own schema it can be substituted for SYSDUMMY1 as well.

Thursday, October 16, 2008

Year 2038 Problem:

The Year 2000 problem is understood by most people these days because of the large amount of media attention it received.

Most programs written in the C programming language are relatively immune to the Y2K problem, but suffer instead from the Year 2038 problem. This problem arises because most C programs use a library of routines called the standard time library . This library establishes a standard 4-byte format for the storage of time values, and also provides a number of functions for converting, displaying and calculating time values.

The standard 4-byte format assumes that the beginning of time is January 1, 1970, at 12:00:00 a.m. This value is 0. Any time/date value is expressed as the number of seconds following that zero value. So the value 919642718 is 919,642,718 seconds past 12:00:00 a.m. on January 1, 1970, which is Sunday, February 21, 1999, at 16:18:38 Pacific time (U.S.). This is a convenient format because if you subtract any two values, what you get is a number of seconds that is the time difference between them. Then you can use other functions in the library to determine how many minutes/hours/days/months/years have passed between the two times.

If you have read How Bits and Bytes Work, you know that a signed 4-byte integer has a maximum value of 2,147,483,647, and this is where the Year 2038 problem comes from. The maximum value of time before it rolls over to a negative (and invalid) value is 2,147,483,647, which translates into January 19, 2038. On this date, any C programs that use the standard time library will start to have problems with date calculations.

This problem is somewhat easier to fix than the Y2K problem on mainframes, fortunately. Well-written programs can simply be recompiled with a new version of the library that uses, for example, 8-byte values for the storage format. This is possible because the library encapsulates the whole time activity with its own time types and functions (unlike most mainframe programs, which did not standardize their date formats or calculations). So the Year 2038 problem should not be nearly as hard to fix as the Y2K problem was.

An alert reader was kind enough to point out that IBM PC hardware suffers from the Year 2116 problem. For a PC, the beginning of time starts at January 1, 1980, and increments by seconds in an unsigned 32-bit integer in a manner similar to UNIX time. By 2116, the integer overflows.
Windows NT uses a 64-bit integer to track time. However, it uses 100 nanoseconds as its increment and the beginning of time is January 1, 1601, so NT suffers from the Year 2184 problem.

On this page, Apple states that the Mac is okay out to the year 29,940!

Passion for Action (PFA):

Passion for Action is the outward expression of Highly Motivated Professionals Dedicated to the Improvement of Quality in All Aspects of Service and Manufacturing Companies.

PFA is a characteristic of highly Successful Companies as it permeates all activities at all levels of the business culture. An organization containing PFA will develop an Enterprise-Wide Current that continuously pulls the organization to its next performance level.

The concept was coined by Organizational Change Agent Consultant Rick Carangelo.

Wednesday, October 15, 2008

Bankruptcy Concept:

A very simplistic explanation of how a "bubble" builds up.

If you could read patiently and understand, it's a great knowledge!

Once there was a little island country. The land of this country was the tiny island itself. The total money in circulation was 2 dollars as there were only two pieces of 1 dollar coins circulating around.

1) There were 3 citizens living on this island country. A owned the land.
B and C each owned 1 dollar.

2) B decided to purchase the land from A for 1 dollar. So, now A and C own
1 dollar each while B owned a piece of land that is worth 1 dollar.

* The net asset of the country now = 3 dollars.

3) Now C thought that since there is only one piece of land in the country, and land is non producible asset, its value must definitely go up. So, he borrowed 1 dollar from A, and together with his own 1 dollar, he bought the land from B for 2 dollars.

*A has a loan to C of 1 dollar, so his net asset is 1 dollar.
* B sold his land and got 2 dollars, so his net asset is 2 dollars.
* C owned the piece of land worth 2 dollars but with his 1 dollar debt to A, his net residual asset is 1 dollar.
* Thus, the net asset of the country = 4 dollars.

4) A saw that the land he once owned has risen in value. He regretted having sold it. Luckily, he has a 1 dollar loan to C. He then borrowed 2 dollars from B and acquired the land back from C for 3 dollars. The payment is by 2 dollars cash (which he borrowed) and cancellation of the 1 dollar loan to C. As a result, A now owned a piece of land that is worth 3 dollars. But since he owed B 2 dollars, his net asset is 1 dollar.

* B loaned 2 dollars to A. So his net asset is 2 dollars.
* C now has the 2 coins. His net asset is also 2 dollars.
* The net asset of the country = 5 dollars. A bubble is building up.

(5) B saw that the value of land kept rising. He also wanted to own the land. So he bought the land from A for 4 dollars. The payment is by borrowing 2 dollars from C, and cancellation of his 2 dollars loan to A.

* As a result, A has got his debt cleared and he got the 2 coins. His net asset is 2 dollars.
* B owned a piece of land that is worth 4 dollars, but since he has a debt of 2 dollars with C, his net Asset is 2 dollars.
* C loaned 2 dollars to B, so his net asset is 2 dollars.

* The net asset of the country = 6 dollars; even though, the country has only one piece of land and 2 Dollars in circulation.

(6) Everybody has made money and everybody felt happy and prosperous.

(7) One day an evil wind blew, and an evil thought came to C's mind. "Hey, what if the land price stop going up, how could B repay my loan. There is only 2 dollars in circulation, and, I think after all the land that B owns is worth at most only 1 dollar, and no more."

(8) A also thought the same way.

(9) Nobody wanted to buy land anymore.

* So, in the end, A owns the 2 dollar coins, his net asset is 2 dollars.
* B owed C 2 dollars and the land he owned which he thought worth 4 dollars is now 1 dollar. So his net asset is only 1 dollar.
* C has a loan of 2 dollars to B. But it is a bad debt. Although his net asset is still 2 dollars, his Heart is palpitating.
* The net asset of the country = 3 dollars again.

(10) So, who has stolen the 3 dollars from the country ? Of course, before the bubble burst B thought his land was worth 4 dollars. Actually, right before the collapse, the net asset of the country was 6 dollars on paper. B's net asset is still 2 dollars, his heart is palpitating.

(11) B had no choice but to declare bankruptcy. C as to relinquish his 2 dollars bad debt to B, but in return he acquired the land which is worth 1 dollar now.

* A owns the 2 coins, his net asset is 2 dollars.
* B is bankrupt, his net asset is 0 dollar. ( he lost everything )
* C got no choice but end up with a land worth only 1 dollar

* The net asset of the country = 3 dollars.

************ **End of the story; BUT ************ ********* ******

There is however a redistribution of wealth. A is the winner, B is the loser, C is lucky that he is spared. A few points worth noting -

(1) When a bubble is building up, the debt of individuals to one another in a country is also building up.
(2) This story of the island is a closed system whereby there is no other country and hence no foreign debt. The worth of the asset can only be calculated using the island's own currency. Hence, there is no net loss.
(3) An over-damped system is assumed when the bubble burst, meaning the land's value did not go down to below 1 dollar.
(4) When the bubble burst, the fellow with cash is the winner.. The fellows having the land or extending loan to others are the losers. The asset could shrink or in worst case, they go bankrupt.
(5) If there is another citizen D either holding a dollar or another piece of land but refrains from taking part in the game, he will neither win nor lose. But he will see the value of his money or land go up and down like a see saw.
(6) When the bubble was in the growing phase, everybody made money.
(7) If you are smart and know that you are living in a growing bubble, it is worthwhile to borrow money (like A ) and take part in the game. But you must know when you should change everything back to cash.
(8) As in the case of land, the above phenomenon applies to stocks as well.
(9) The actual worth of land or stocks depend largely on psychology

Tuesday, October 14, 2008

Digital Signage:

Definition: A variety of electronic display devices connected by a network, enabling a retailer to control their promotional messages quickly and effectively.

Also Known As: Captive Audience Networks, Narrowcasting, Electronic Billboards, Electronic Display

Examples: Instead of cluttering our checkout counter with fliers or brochures of printed information on our value-added services, our retail store has a digital signage system with several displays of our staff actually performing these services for customers. These digita signs are strategically placed around the store and run certain services at particular times of the day.

Tuesday, October 7, 2008

Work IP Device-TAA (WRKIPDEV):

If multiple printers are attached with as400 system, and in order to know the names of the OUTQ attached to IP address without looking at each one.

Enter the following command (WRKIPDEV) from Command prompt if TAATOOL available on the system.

Command:

TAATOOL/WRKIPDEV DEVTYPE(*PRT) OUTQ(*ALL/*ALL) OUTPUT(*PRINT)

Once the command is been executed check in spool file. This will give you a list of IP printers, by IP address, on your system with Dev/OutQ name.



If you want to view in display mode and not in spool file execute the below command without providing OUTPUT (*PRINT) value.

TAATOOL/WRKIPDEV DEVTYPE(*PRT) OUTQ(*ALL/*ALL)

Monday, October 6, 2008

Create Hotspot in Lotus Notes:

You could create a link hotspot that contains the link you want to user to click on.



To begin, select the text you wish to turn into a hotspot.
Next choose Create - Hotspot - Link Hotspot.



This brings up the Properties Box, where you can enter the web address, or URL.



If you would like a larger dialog box to enter the information into, you can click on the formula icon and a dialog box will pop-up. This dialog box allows for some very advanced features such as adding Fields or @Functions, but I think most users will not need to use these.



The Hotspot Resource Link dialog box also provides you a "paste" icon , so if you already have the URL on your clipboard you can just click on this icon.

If you would like you can also choose to "Show Border around hotspot", this places a green box around the text where the hotspot exists. This border is only available to Lotus Notes users.



Instead of using the borders, I like to underline my hotspots so they appear similar to links found on web pages. To do this, place your cursor anywhere in the hotspot text (you don't have to highlight the whole thing) and press CTRL+U to underline. (or use the toolbar icon)



If you prefer to use your keyboard as opposed to menus, after selecting the text you want to turn into a hotspot, press ALT+C+H+L.

Sunday, October 5, 2008

Run CL Commands from Windows:

This summary is not available. Please click here to view the post.

Thursday, October 2, 2008

Create physical files on the fly:

CL programmers sometimes need to create physical files (PFs) on the fly. To create a PF that has an external definition, you have to use either DDS or DDL, and for CL programmers, that means having a separate source member that contains the file definition. Or does it have to mean that?
This article demonstrates how you can take advantage of QShell from a CL program to create a PF in which you can embed the source code, including the field definitions, inside the code of the CL program itself.
The trick to producing a PF on the fly from CL is QShell's db2 utility. This utility runs an SQL statement that's passed as a parameter. Because QShell commands can be run from CL's STRQSH command, embedding an SQL statement in a CL program is relatively easy. For example:
PGM
STRQSH CMD('db2 "create table SOMELIB.SOMEFILE ( +
field1 decimal(5,0), +
field2 char(30), +
field3 date +
)"')
ENDPGM