Thursday, May 29, 2008

Corrective Action Report (CAR):

CAR is a procedure used in response to a defect. This implies that you are reporting on a detected Non Conformance (NCR or NCMR) and have determined root cause to correct this from reoccurring.

Objective:

To avoid repeating mistakes.

Justification:
• Consider the costs of NOT taking the time to create a Corrective Action Report.
• Costs can be lost customers, dissatisfied customers, ineffective products, unhappy staff and opportunities foregone while discussing a repeating problem.

Outcomes:
• Fewer mistakes. At least, fewer repeated mistakes.
• Forces a manager to examine the Who, What, Where, When and Why of operational systems.
• Progress toward flawless operational systems.
• Better staff morale.
• Develops a better attitude, mindset and style in all participants.
• Manager has greater efficacy and pride in managing well, the essence of managing.
• Prepares an organization for the ultimate mark of excellence, ISO certification.

Sample Format:

Description of problem:
Brief outline of details without a lengthy narrative.
Such things as background, records of conversations and related events can be placed in an appendix.
Main reason for nonconformity / corrective action / preventive action:
Nonconformity is a common term in most Quality Control Systems. Corrective action to be taken, responsibility & date for completion:
Dependent of the severity of the problem. May require input of well-considered options by vested interests.
Preventive action to be taken, responsibility & date for completion:
This is the main benefit derived and that which justifies initiating and continuing the exercise.
Management representative (Quality Control Person) approval signature & date of effective resolution:
This is a requirement when a Quality Control System is in place.

Date:___________________ Signature:______________________

Wednesday, May 28, 2008

Preventing Subfiles from folding back:

Sometimes when a subfile that has a fold/unfold feature is filled a page at a time, the subfile will revert back to the default fold/unfold status when the roll keys are pressed. There is a way to stop this.
You can control the way the subfile is filled with an indicator, but the trick is letting the program know if the user pressed the command key to fold or unfold.
The answer to this problem is using the SFLMODE keyword in the control format of the subfile. The keyword is used like this SFLMODE(&FOLD). The &FOLD can be any variable you want to use, but this field name is easy to remember, so we'll use it. You also have to define FOLD as a hidden field in your record. Notice that when using it with the keyword, there is an & in front of it.
Put both the SFLDROP and SFLFOLD keywords in the control format and and condition them with indicators. For this example, we'll use indicator 88.
So if 88 is on SFLDROP(CF06), if N88 then SFLFOLD(CF06). This allows the user to toggle by pressing the F6 key.
Now to the RPG Code.
Initialize the FOLD variable with a 1 or 0, depending on if you want the default mode to be folded or unfolded on the subfile, then right before you WRITE the subfile, move FOLD to *IN88.

This will allow the user to toggle back and forth, roll, and still maintain the view the way they left it.

Display Documents on your iSeries:

We can navigate around the DLO system with i5/OS DLO commands, but we are much limited to displaying just the names of the DLO objects – commonly known as "documents" and "folders."
We usually had two basic choices:
1. Open the document in Windows NotePad or other similar text editor on your PC. This approach works just fine if the document is in ASCII format, and you have your AS/400-iSeries's IFS system shared and configured for use with Windows.
2. Copy the document to an OS/400-i5/OS physical file.Use the CPYFRMPCD to copy the document to either a regular physical file or a source physical file. This approach is workable under certain conditions but you must know ahead of time if you are dealing with EBCDIC or ASCII data because you may need to translate it.

A much simpler approach to quickly display the contents of a document (or any IFS object) is to use the Work with Object Links (WRKLNK) command.
For example, say you have a document named "MSG0006" in folder "TEMP." The IFS link to that document would be "/Qdls/temp/msg0006". Note that most of the IFS file systems are not case-sensitive; this is true for the QDLS file system, which is the IFS file system associated (i.e., linked) with the DLO system. So, the link "/Qdls/temp/msg0006" is broken down like this:
• The beginning slash (/) tells IFS to start at the root.
• The "Qdls" says to use the DLO system (if you have you IFS systems mapped as a network drive on you PC, you will see "Qdls" as a folder).
• The "temp" says to look in the DLO first-level folder named "TEMP" (this will also appear as a folder on you PC).
• Finally, the "msg0006" is the name of the DLO document.
To work with a specific document like the one just discussed, we can issue the following command:
WRKLNK OBJ('/Qdls/temp/msg0006')
You can also use wildcards to work with a several documents (or links) at once. For example:
WRKLNK OBJ('/Qdls/temp/*')
This command lists the available documents in the specified folder. There is an option titled "5=Display." Simply type a '5' next to the document and press Enter, and you will see the data contained in that document. And the nice thing about it is you don't have to worry about what character set (or CCSID) it is in; the Display function will figure it out.
Also note that there is an Edit function as well. The Work with Object Links screen allows you to edit the data in the document, a great feature for a quick change. Use option '2'. You can even navigate through the IFS by using option '5' next to items of type FLR, DIR, and other directory-type objects.

Tuesday, May 20, 2008

Lean Six Sigma:

LEAN SIX SIGMA is a business improvement methodology which combines (as the name implies) tools from both Lean Manufacturing and Six Sigma. Lean manufacturing focuses on speed and traditional Six Sigma focuses on quality. By combining the two, the intended result is better quality faster.

This strives to mitigate significant failure modes of "Quality only" Six Sigma when it is applied to reducing variation in a single process step (sub-optimizing), or to processes which are not value added to the customer.

Typical application of Lean Six Sigma is,
1. Identify the processes (in a functional department or business) most important to delivering customer value.
2. Map these processes using Value Stream Mapping.
3. Identify the bottlenecks / constraints in the value stream.
4. Apply variation reduction through DMAIC/DMAD(O)V to standardize the relevant process steps.

Many companies such as Textron with mature Six Sigma implementations added lean manufacturing tools to the existing toolbox. Others such as Caterpillar brought on consultants to develop a comprehensive program others such as Honeywell developed their own methodology upon a merger where one partner (Allied Signal) was mature in Six Sigma and the other in Lean. And General Electric, developed Lean Sigma in conjunction with their Customer Satisfaction process (Net Promoter Score or NPS) to get the most benefit from DFSS and Lean. The United States Department of Defense considers Lean Six Sigma its "tool of choice" for "business transformation.

Monday, May 19, 2008

Print Spool in Both sides of a paper:

Do you want your users to print large spool files on both sides of the paper? Here is something you can do to support that:
Assumptions:
1. You have a laser printer, which supports printing on both sides of the page. (Most laser printers do support these days.)
2. The laser printer is already defined as an iSeries printer and has a particular OUTQ name. For example: PRINT01
Follow the Steps:
1. Create a new DTAQ by the following command:
CRTDTAQ DTAQ(QGPL/ZDTAQ1) MAXLEN(64512)
2. Create a OUTQ with the following command:
CRTOUTQ OUTQ(QGPL/DUPLEX) DTAQ(QGPL/ZDTAQ1)
3. Compile the following CL program after making necessary modifications to it. (You probably need to change the out queue name in the last CL command CHGPLFA)
Note 1:
The program needs to be running all the time in the system. The program doesn't take any CPU resource as it waits in DEQW status until a spool file comes in the OUTQ.
Note 2:
You may want to add the CALL to this program in the system startup program, so that it gets executed automatically, after every IPL.
So, from now on, whenever you need to print the spool file on the both sides of a paper, just send the spool file to the OUTQ DUPLEX instead of the regular OUTQ (PRINT01 in this case). The output will appear on PRINT01 (your actual existing OUTQ) only.
To print regular one-sided spool files simply send the spool files to PRINT01 (your actual existing OUTQ).
PGM
DCL VAR(&FLDLEN) TYPE(*DEC) LEN(5 0) VALUE(128)
DCL VAR(&FIELD) TYPE(*CHAR) LEN(128)
DCL VAR(&ERR) TYPE(*CHAR) LEN(50)
DCL VAR(&SPLNBR) TYPE(*DEC) LEN(9 0)
DCL VAR(&USER) TYPE(*CHAR) LEN(10)
DCL VAR(&SPLNM) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNM) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNBR) TYPE(*CHAR) LEN(6)
DCL VAR(&ERR) TYPE(*CHAR) LEN(50)
DCL VAR(&TNAME) TYPE(*CHAR) LEN(50)
DCL VAR(&FM) TYPE(*CHAR) LEN(32)
DCL VAR(&SNAME) TYPE(*CHAR) LEN(8)
DCL VAR(&WAIT) TYPE(*DEC) LEN(5 0)
LOOP: CHGVAR VAR(&WAIT) VALUE(-1) /* wait for new entry +
on the data queue */
CHGVAR VAR(&FIELD) VALUE(' ')
CALL PGM(QRCVDTAQ) PARM(ZDTAQ1 QGPL &FLDLEN &FIELD +
&WAIT)
/* Get the Spool file number for the spool file */
CHGVAR VAR(&SPLNBR) VALUE(%BIN(&FIELD 49 4))
/* Get the Job name for the spool file */
CHGVAR VAR(&JOBNM) VALUE(%SST(&FIELD 13 10))
/* Get the user ID for the spool file */
CHGVAR VAR(&USER) VALUE(%SST(&FIELD 23 10))
/* Get the Job Number for the spool file */
CHGVAR VAR(&JOBNBR) VALUE(%SST(&FIELD 33 6))
/* Get the spool file name */
CHGVAR VAR(&SPLNM) VALUE(%SST(&FIELD 39 10))

CHGSPLFA FILE(&SPLNM) JOB(&JOBNBR/&USER/&JOBNM) +
SPLNBR(&SPLNBR) DUPLEX(*YES)
MONMSG CPF0000
CHGSPLFA FILE(&SPLNM) JOB(&JOBNBR/&USER/&JOBNM) +
SPLNBR(&SPLNBR) OUTQ(PRINT01)
/* PRINT01 is used as an example. Instead of PRINT01, you will use the name
of an existing OUTQ */

GOTO CMDLBL(LOOP)
ENDPGM

Sunday, May 18, 2008

Balanced Scorecard:

The Balanced Scorecard (BSC) began as a concept for measuring whether the smaller-scale operational activities of a company are aligned with its larger-scale objectives in terms of vision and strategy. By focusing not only on financial outcomes but also on the human issues, the Balanced Scorecard helps provide a more comprehensive view of a business, which in turn helps organizations act in their best long-term interests.
Implementing Balanced Scorecards typically includes four processes:
1. Translating the vision into operational goals;
2. Communicating the vision and link it to individual performance;
3. Business planning;
4. Feedback and learning, and adjusting the strategy accordingly.

The grouping of performance measures in general categories (perspectives) is seen to aid in the gathering and selection of the appropriate performance measures for the enterprise. Four general perspectives have been proposed by the Balanced Scorecard:
• Financial perspective;
• Customer perspective;
• Internal process perspective;
• Learning and growth perspective.

The financial perspective examines if the company’s implementation and execution of its strategy are contributing to the bottom-line improvement of the company.
The customer perspective defines the value proposition that the organization will apply in order to satisfy customers and thus generate more sales to the most desired (i.e. the most profitable) customer groups.
The internal process perspective is concerned with the processes that create and deliver the customer value proposition.
The learning and growth perspective is the foundation of any strategy and focuses on the intangible assets of an organization, mainly on the internal skills and capabilities that are required to support the value-creating internal processes.

Wednesday, May 14, 2008

Make a CL job to send data using FTP:

Create a physical file of 50 to 80 characters to hold the FTP commands. Name it something like FTPIN.
Then use DFU to enter the FTP commands. The first record should be your user ID and password. Then the following records have the remaining FTP commands.
For example, to sign on as davidmount with password of as400, then change directory to UPLOAD and then PUT a file, the records should look like:
davidmount as400
cd UPLOAD
put xyzzy.txt abc.csv
quit
You may also create a file for the output. Say... FTPOUT
Then, the CL to execute overides the specially named INPUT file and OUTPUT file.
The CL looks like:

OVRDBF FILE(INPUT) TOFILE(FTPIN)
OVRDBF FILE(OUTPUT) TOFILE(FTPOUT)
FTP '123.12.12.123'

What would normally be displayed on the screen as output is written to the FTPOUT file. This is very powerful. You can (with some effort), use FTP to get a directory of the files on a remote system. Then, you can read thru the directory (it's in the FTPOUT file) and then build other FTP scripts to GET specific files and even delete specific files.
In a related matter, to check to see if a transfer is complete, you must read through the FTPOUT file to see if you find the phrase "Transfer complete" in a record somewhere.
OS/400 will NOT return an error if you do not successfully transfer the data. It will simply write the output display to the OUTPUT file and consider this a successful execution of the FTP.

Preventing Job Logs:

To prevent a job log from being produced at the completion of a batch job, you can specify *NOLIST for the message level text of the LOG parameter on the,
Batch Job (BCHJOB),
Submit Job (SBMJOB),
Change Job (CHGJOB),
Create Job Description (CRTJOBD), or
Change Job Description (CHGJOBD) command.
If you specify *NOLIST for the message text value of the LOG parameter, the job log is not produced at the end of a job unless the job end code is 20 or greater. If the job end is 20 or greater, the job log is produced. For an interactive job, the value specified for the LOG parameter on the SIGNOFF command takes precedence over the LOG parameter value specified for the job.

Tuesday, May 13, 2008

Using SQL to color Source Code:

For all those programmers using emulators other than Client Access (and other similar advanced emulators), you can color your source code/inline comments using SQL. The color codes for some are as given below:
Red X'28'
White X'22'
Blue X'3A'
Pink X'38'
Turquoise X'34'
Code:
In SQL/400, create an alias of the source member you want to color in QTEMP. If I want to color source member PGM1 in QRPGSRC my SQL statement would be something like:
Query 1: CREATE ALIAS QTEMP/ALIAS# FOR LIB/QRPGSRC (PGM1)
The alias would enable us to access different members of file using SQL.
Query 2: UPDATE QTEMP/ALIAS# SET SRCDTA = SUBSTR(SRCDTA,1,4)||X'22'||SUBSTR(SRCDTA,6,94) WHERE SUBSTR(SRCDTA,7,1) = '*'
We are updating the source line by including hex color code in sixth byte of the source.
This query would change the color of all comment line to white.
Condition your query as you like based on any field SRCDTA, SRCSEQ, SRCDAT.
Query 3: DROP ALIAS QTEMP/ALIAS#
This drops the alias file created in QTEMP.

Monday, May 12, 2008

FIX:

The Financial Information eXchange (FIX) protocol is an electronic communications protocol developed for international real-time exchange of information related to the securities transactions and markets.
FIX is widely used by both the buy side (institutions) as well as the sell side (brokers/dealers) of the financial markets. FIX is the standard for front office messaging. FIX is the standard for front office messaging.
There are two main groups of messages - admin and application. The admin messages handle the basics of a FIX session. They allow for a session to be started and terminated and for recovery of missed messages. The application messages deal with the sending and receiving of trade-related information such as an order request or information on the current state and subsequent execution of that order.

FIX Message Layout:
The message fields are delimited using the ASCII 01 character. They're composed of a header, a body and a trailer. The header must contain the 8 (BeginString), 9 (BodyLength), 35(MsgType) tags. The trailer is always terminated by a 10 tag, a checksum.
Header+Body+Trailer : FIX Content
Example of a FIX message : Execution Report
8=FIX.4.2 | 9=67 | 35=8 | 49=PHLX | 56=PERS | 11=ATOMNOCCC9990900 | 52=20071123-05:30:00.000 | 20=3 | 150=E | 39=E | 55=MSFT | 167=CS | 54=1 | 38=15 | 40=2 | 44=15 | 58=PHLX EQUITY TESTING | 59=0 | 47=C | 32=0 | 31=0 | 151=15 | 14=0 | 6=0 | 10=102 |

Friday, May 9, 2008

Recursive Call in RPGLE:

RPG does not allow recursive calls. Actually ILE RPG does allow recursion. A program cannot call itself, but it can call a subprocedure that calls itself.
The procedure call should not use the CALLP opcode, rather it should use the EVAL opcode and treat the procedure as a function. For example, a procedure name CALCS would use the following code:
RETURN CALCS(value02)
The sample code calculates the n'th number in a Fibonacci sequence. A Fibonacci sequence is a sequence whereby any number is equal to the previous two numbers in the sequence:
Nbr(n) = Nbr(n-1) + Nbr(n-2).
In the sequence, the first number is 1, preceded by an implied zero so that the second number has an "n-2" to use.
The first few elements then calculate to:
1 1 2 3 5 8 13 21 34
It is an interesting exercise to run this procedure in DEBUG and observe its action.
The subprocedure CALCS would be called from an ILE RPG program using a statement such as:
EVAL RESULT = CALCS(Nbr)
Note that if the recursion proceeds through too many recursive calls, that performance drastically slows down. In this example, anything over 30 calls really ran slowly. If the job ends abnormally while into a deep call stack, the end job process takes a very long time.
Code
* Procedure Prototype

DCALCS PR 9P 0
D 9P 0
* * * * * * * * * * * * * * * * * * * Procedure Definition
P CALCS B
*
D CALCS PI 9P 0
D NBR 9P 0
*
* Procedure variables
D NM1 S 9P 0
D NM2 S 9P 0
*
C SELECT
* Endpoint if inbound parm = 0
C WHEN NBR = 0
C RETURN 1
* Endpoint if inbound parm = 1
C WHEN NBR = 1
C RETURN 1
* Endpoint if inbound parm = 2
C WHEN NBR = 2
C RETURN 1
* Recursive call
C OTHER
C EVAL NM1 = NBR - 1
C EVAL NM2 = NBR - 2
C RETURN CALCS(NM1)+ CALCS(NM2)
C ENDSL

Wednesday, May 7, 2008

Copy/Format AS/400 Screen to Text:

Cut and paste iSeries green-screen text into Microsoft word/email in a lined-up, neat and more readable fashion.
On any iSeries green screen, click on the iSeries Access (Client Access) Copy to Clipboard icon to copy the entire screen text, or draw a box around selected portion you want to copy and then click on the icon.
Start your e-mail/MS Word, and paste the text into the desired position.
Highlight the text you just pasted and click Format, then Font.
Select Courier New font and click OK.
Your pasted text is now lined up neatly in a much more readable fashion.
Note: You can copy the entire screen image, color and all into Outlook with ALT/PrintScreen. However, when we need to edit and show the content it is really helpful.

Tuesday, May 6, 2008

Proxy Server:

In computer networks, a proxy server is a server (a computer system or an application program) which services the requests of its clients by forwarding requests to other servers. A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource, available from a different server. The proxy server provides the resource by connecting to the specified server and requesting the service on behalf of the client. A proxy server may optionally alter the client's request or the server's response, and sometimes it may serve the request without contacting the specified server. In this case, it would 'cache' the first request to the remote server, so it could save the information for later, and make everything as fast as possible.
A proxy server that passes all requests and replies unmodified is usually called a gateway or sometimes tunneling proxy.
A proxy server can be placed in the user's local computer or at specific key points between the user and the destination servers or the Internet.
Type of Proxy Server:

Caching Proxy Server - A proxy server can service requests without contacting the specified server, by retrieving content saved from a previous request, made by the same client or even other clients. This is called caching. Caching proxies keep local copies of frequently requested resources, allowing large organizations to significantly reduce their upstream bandwidth usage and cost, while significantly increasing performance.

Web Proxy - A proxy that focuses on WWW traffic is called a "web proxy". The most common use of a web proxy is to serve as a web cache.
Content Filtering Web Proxy - A content filtering web proxy server provides administrative control over the content that may be relayed through the proxy. It is commonly used in commercial and non-commercial organizations (especially schools) to ensure that Internet usage conforms to acceptable use policy.
Anonymizing Proxy Server - An anonymous proxy server (sometimes called a web proxy) generally attempts to anonymize web surfing. These can easily be overridden by site administrators, and thus rendered useless in some cases.

Hostile Proxy - Proxies can also be installed by online criminals, in order to eavesdrop upon the dataflow between the client machine and the web.
Intersepting Proxy Server - An intercepting proxy (also known as a "transparent proxy") combines a proxy server with a gateway. Connections made by client browsers through the gateway are redirected through the proxy without client-side configuration (or often knowledge).
Transparent and Non-Transparent Proxy - A 'transparent proxy' is a proxy that does not modify the request or response beyond what is required for proxy authentication and identification. A 'non-transparent proxy' is a proxy that modifies the request or response in order to provide some added service to the user agent, such as group annotation services, media type transformation, protocol reduction, or anonymity filtering.

Reverse Proxy - A reverse proxy is a proxy server that is installed in the neighborhood of one or more web servers. All traffic coming from the Internet and with a destination of one of the web servers goes through the proxy server.

Monday, May 5, 2008

Window Title Bars:

Real estate on windows can be tight enough, without having to worry about adding the title in the window. Using the WDWTITLE keyword in you DDS allows you to put the title of the window directly in the border of the window itself.

Here's an example:
A R WINDOW
A WINDOW(5 10 13 50 *NOMSGLIN)
A WDWTITLE((*TEXT ' Window Title ') *LEFT)
A 12 2'F6=Fold/Unfold'
A DSPATR(HI)
A 12 19'F12=Cancel'
A DSPATR(HI)

This can also work with a variable as the title text. Just place a variable in your WDWTITLE keyword in place of the text in quotes. For example, &TITLE. Your variable needs to be defined in the DDS as a program to system variable.
A R WINDOW
A WINDOW(1 2 22 75 *NOMSGLIN)
A WDWTITLE((*TEXT &TITLE) *LEFT)
A TITLE R P REFFLD(MYFORMAT/MYFIELD *LIBL/MYFILE)
A 21 2'F12=Cancel'
A DSPATR(HI)
A COLOR(BLU)

The Last parameter is where do you want the title to appear. *LEFT means it's left justified, *RIGHT is right justified, and *CENTER is Centered.

Just a note, this doesn't show up in SDA.

Sunday, May 4, 2008

Check IFS object existence:

The need of objects that exist on the IFS increases daily. Using CHKOBJ to determine the existence of an object is limited to HFS objects, and the ability to use that command on the IFS is non-existent.

The excerpt below is a nice little program, which is limited to a 30 alpha string in this example that uses the CHKIN and CHKOUT commands to determine the existence of an object. If the CHKOUT command is successful, then the object must be checked back in via the CHKIN to prevent object locks.
Code
PGM PARM(&STMF &CODE)

DCL VAR(&STMF) TYPE(*CHAR) LEN(30)

DCL VAR(&CODE) TYPE(*CHAR) LEN(1)

CHKOUT OBJ(&STMF)
MONMSG MSGID(CPFA0A9) EXEC(CHGVAR VAR(&CODE) +
VALUE('0')) /* NOT FOUND */
MONMSG MSGID(CPF0000) EXEC(DO) /* ANY OTHER ERROR +
(IN USE) */
CHGVAR VAR(&CODE) VALUE('1') /* IT ALREADY EXISTS */
CHKIN OBJ(&STMF) /* RELEASE USE */
MONMSG MSGID(CPF0000)
ENDDO
ENDPGM

Thursday, May 1, 2008

Cone of uncertainty:


Early in a project, specific details of the nature of the software to be built, details of specific requirements, details of the solution, project plan, staffing, and other project variables are unclear. The variability in these factors contributes variability to project estimates -- an accurate estimate of a variable phenomenon must include the variability in the phenomenon itself. As these sources of variabiility are further investigated and pinned down, the variability in the project diminishes, and so the variability in the project estimates can also diminish. This phenomenon is known as the “Cone of Uncertainty” which is illustrated in the following figure. As the figure suggests, significant narrowing of the Cone occur during the first 20-30% of the total calendar time for the project.


The horizontal axis contains common project milestones such as Initial Concept, Approved Product Definition, Requirements Complete, and so on. The vertical axis contains the degree of error that has been found in estimates created by skilled estimators at various points in the project. The estimates could be for how much a particular feature set will cost and how much effort will be required to deliver that feature set, or it could be for how many features can be delivered for a particular amount of effort or schedule.

As you can see from Figure 1, estimates created very early in the project are subject to a high degree of error. Estimates created at Initial Concept time can be inaccurate by a factor of 4x on the high side or 4x on the low side (also expressed as 0.25x, which is just 1 divided by 4). The total range from high estimate to low estimate is 4x divided by 0.25x, or 16x.


The Cone narrows only as you make decisions that eliminate variability. As Figure 2 illustrates, defining the product vision (including committing to what you will not do), reduces variability. Defining requirements—again, including what you are not going to do—eliminates variability further. Designing the user interface helps to reduce the risk of variability arising from misunderstood requirements. Of course, if the product isn’t really defined, or if the Product Definition gets redefined later, then the Cone will get wider, and estimation accuracy will be poorer.