Tuesday, March 31, 2009

Tips: Run and call System i stored procedures

Use these tips for running and calling System i™ stored procedures.

Running a System i stored procedure

ODBC provides a standard interface for calling stored procedures. The implementation of stored procedures differs significantly across various databases.
This simple example follows the recommended approach for running a System i stored procedure.

1.)Set up a create procedure statement for the stored procedure and create it. The creation of the stored procedure only needs to be done once and it does not have to be done through ODBC. The definition that it provides is available to all ODBC as well as integrated i5/OS® applications.
2.)Prepare the stored procedure call.
3.)Bind the parameters of the procedure, indicating whether each parameter is to be used for input to the procedure, output from the procedure, or input/output.
4.)Call the stored procedure.


Example:

CREATE PROCEDURE MYLIB.MYPROC (INOUT PARM1 CHAR(10)) EXTERNAL NAME MYLIB.MYPGM LANGUAGE COBOL GENERAL

In the above example, the procedure name is MYLIB.MYPROC.

This procedure references the COBOL program MYLIB.MYPGM. The program takes one input parameter called PARM1 which is a char field of length 10. This procedure does not return a result set.

STORED PROCEDURE : Very IMP For SQL Lovers

Defination

A stored procedure is a set of SQL commands that has been compiled and stored on the database server.

Once the stored procedure has been "stored", client applications can execute the stored procedure over and over again without sending it to the database server again and without compiling it again.

Stored procedures improve performance by reducing network traffic and CPU load

Some Details

Typical uses for stored procedures include data validation (integrated into the database) or access control mechanisms. Furthermore, stored procedures are used to consolidate and centralize logic that was originally implemented in applications. Large or complex processing that might require the execution of several SQL statements is moved into stored procedures and all applications call the procedures only.

Stored procedures are similar to user-defined functions (UDFs). The major difference is that UDFs can be used like any other expression within SQL statements, whereas stored procedures must be invoked using the CALL statement

CALL procedure(…)

or

EXECUTE procedure(…)

Stored procedures can return result sets, i.e. the results of a SELECT statement. Such result sets can be processed using cursors by other stored procedures by associating a result set locator, or by applications. Stored procedures may also contain declared variables for processing data and cursors that allow it to loop through multiple rows in a table. The standard Structured Query Language provides IF, WHILE, LOOP, REPEAT, CASE statements, and more. Stored procedures can receive variables, return results or modify variables and return them, depending on how and where the variable is declared

Difference between Stored Procedures and Functions

a. Only function can Return a value (to be precise using the Return keyword)

b. Procedures can use ‘Return’ keyword but without any value being passed

c. Functions could be used in select statements, provided they don’t do any data manipulation inside and also should not have any OUT, IN OUT parameters

Comparison with Dynamic SQL

Because stored procedure statements are stored directly in the database, this can remove the compilation overhead that is typically required in situations where software applications send inline (dynamic) SQL queries to a database. However, most database systems implement statement caches to avoid repetitive compilation of dynamic SQL statements. In addition, pre-compiled SQL statements, while avoiding some overhead, add to the complexity of creating an optimal execution plan because not all arguments of the SQL statement are supplied at compile time. Depending on the specific database implementation and configuration, mixed performance results will be seen from stored procedures versus generic queries or user defined functions.

Programming Tip: HIDING LINES WHILE EDITING ** Especially for those Who work in companies where Implementation is carried out Mostly.

When you are working with source members that have many source lines, it is useful to exclude certain lines from the displayed member, allowing you to see lines from different areas of the source on the screen at the same time. Place X (Exclude) on any line you want to exclude from the display. This doesn't delete the line from the source member; it simply causes the excluded line(s) to be temporarily removed from the SEU display.
You can also use the X command in block format (XX). The example below shows how to exclude lines 3 through 6 (I entered a blank after the XX command to make it more readable):

*************** Beginning of data **************************
0001.00 111111111111111
0002.00 222222222222222
XX 3.00 333333333333333
0004.00 444444444444444
0005.00 555555555555555
XX 6.00 666666666666666
0007.00 777777777777777
****************** End of data *****************************

The result below shows that lines 3 through 6 have been hidden from view:

*************** Beginning of data **************************
0001.00 111111111111111
0002.00 222222222222222
- - - - ------------- 4 data records excluded ----------------------
0007.00 777777777777777
****************** End of data *****************************

To redisplay the lines, press F5 (Refresh) key, or use the SF or SL commands. SF (Show first) command shows the first excluded line, and SL (Show last) shows the last excluded line. You can also use SFn or SLn to show the first n lines or the last n lines of the excluded group of lines. The example below shows how to use the SF2 command to show the first two excluded lines:

*************** Beginning of data **************************
0001.00 111111111111111
0002.00 222222222222222
SF2 - - ------------- 4 data records excluded ----------------------
0007.00 777777777777777
****************** End of data *****************************

Notice below that the display shows the first two excluded lines and the text has changed to "2 data records excluded":

*************** Beginning of data **************************
0001.00 111111111111111
0002.00 222222222222222
0003.00 333333333333333
0004.00 444444444444444
- - - - ------------- 2 data records excluded ----------------------
0007.00 777777777777777
****************** End of data *****************************

DETERMINING WHETHER A JOB IS RUNNING INTERACTIVE OR BATCH IN CL

Use RTVJOBA command to find it out . Below is the small Program i made in order to find it out .
If anybody have some other technique also then he can kindly mail me .
PGM
DCL VAR(&JOBTYPE) TYPE(*CHAR) LEN(1)
RTVJOBA TYPE(&JOBTYPE)
IF COND(&JOBTYPE *EQ '0') THEN(GOTO START)
/* Interactive Program Section */
SBMJOB CMD(CALL PGM(ITSELFCL)) JOB(SBMITSELF)
SNDPGMMSG MSG('Tell user program Itself Submitted')
RETURN
START:
/* Mainline Batch Program */
If the Job Type is 0, it's running in batch, and if it's 1, it's interactive.

PRINTING A LIST OF ALL IBM SOFTWARE INSTALLED ON AS400 SERVER

You probably already know that if you enter GO LICPGM and select option 10, you can display a list of IBM software packages installed on your system. Unfortunately, this method might not display all IBM software packages installed, and it also doesn't let you print this list. You could, of course, simply use the Print Screen key, but you might have to print 15 different screens with messy formats, and you could inadvertently truncate data or forget to print a screen. There's a better solution. The following DSPSFWRSC (Display Software Resources) command

DSPSFWRSC OUTPUT(*PRINT)

not only prints out all your software package names, but it also prints the library name in which each package is located.

FINDING DEFAULT IBM PASSWORDS ON I- SERIES

Q. What command or utility checks for IBM-supplied user IDs that haven't had their passwords changed from their default values?

A. The command is ANZDFTPWD. You can either enter the command or enter GO SECTOOLS and select menu option 1. When run, ANZDFTPWD prints a report named QPSECPWD that shows all the user profiles on the system with default passwords. ANZDFTPWD optionally lets you disable or expire the password for user profiles with default passwords.

MANAGING DISK USE


To help you manage disk use on your AS/400, OS/400 includes the RTVDSKINF (Retrieve Disk Information) and PRTDSKINF (Print Disk Information) commands. You can use these two commands to monitor the utilization of your disks, or you can write your own queries over the data captured by RTVDSKINF to analyze changes in disk use.

You use command RTVDSKINF to gather information about all the objects on your system. The command outputs the information to member QCURRENT in file QAEZDISK in library QUSRSYS. For a large system with many thousands of objects, running RTVDSKINF can take many hours, so IBM requires you to run the command in batch. The easiest way to do this is to use the SBMJOB (Submit Job) command:

SBMJOB CMD(RTVDSKINF)
You use command PRTDSKINF to print the information that command RTVDSKINF generates in file QAEZDISK. PRTDSKINF lets you print a summary of your system information or print details of disk use by library, folder, owner, or object. For example, to print a list of libraries that are more than 1,000 K in size in descending order by size, you run the command

PRTDSKINF RPTTYPE(*LIB) +
OBJ(*NONE) +
MINSIZE(1000) +
SORT(*SIZE)


The online help for PRTDSKINF explains all the available options.
If the standard PRTDSKINF report options don't meet your needs, you can write your own queries over file QAEZDISK. In addition, you can save the data in member QCURRENT in QAEZDISK to a file and write queries to compare the output from different runs of RTVDSKINF.

DEBUGGING BATCH JOBS

Steps to debug a batch job -
1. SBMJOB ... HOLD(*YES)

2. STRSRVJOB JOB(jobnbr/user/jobnam)

3. STRDBG
When source is displayed, press F12

4. RLSJOB JOB(jobnbr/user/jobnam)
When Start Serviced Job display appears, press F10

5. When command entry display is shown, DSPMODSRC
When source is displayed, set a breakpoint, then press F12
When command entry display is shown, press F12

6. When Start Serviced Job display reappears, press Enter
Program will stop at breakpoint, and can be debugged interactively

7. After serviced job ends
ENDDBG
ENDSRVJOB

In detail, some explanations -


1.Submit the batch job using the Submit Job (SBMJOB) command or a program that automatically submits the job with HOLD(*YES).
--->
SBMJOB HOLD(*YES) Determine the qualified job name (number/user/name) that is assigned to the job using the Work with Submitted Jobs (WRKSBMJOB) command or the Work with Job Queues (WRKJOBQ) command. The Submit Job (SBMJOB) command also displays the name in a completion message when the command finishes processing. The WRKJOBQ (Work With Job Queue) command displays all the jobs waiting to start in a particular job queue. You can show the job name from this display by selecting option 5 for the job.

2. Enter the Start Service Job (STRSRVJOB) command from the display
---->
STRSRVJOB JOB(qualified-job-name)

3. Enter the STRDBG command and provide the names of all programs to be debugged. (No other debug commands can be entered while the job is waiting on the job queue. )

4. Use the Release Job Queue (RLSJOBQ) command to release the job queue. A display appears when the job is ready to start, indicating that you may begin debugging the job.

5. Press F10 to show the Command Entry display. DSPMODSRC. Use the Command Entry display to enter any debug commands, such as the Add Breakpoint (ADDBKP) or Add Trace (ADDTRC) commands.
Press F3 to leave the Command Entry display, and then press Enter to start the batch job.
When the job stops at a breakpoint, you see the normal breakpoint display. When the job finishes, you cannot add breakpoints and traces, or display or change variables. However, you can display any trace data using the Display Trace Data (DSPTRCDTA) command.
If you want to debug another batch job, first end debugging using the End Debug (ENDDBG) command and then end servicing the job using the End Servicing Job (ENDSRVJOB) command.

Installing IBM i on a Power Blade: Tips and Techniques


Follow the life cycle of an IBM Power Blade installation

Power blades, the IBM BladeCenter JS12 and JS22, have increased the number of hardware platforms for IBM i applications. Using proven PowerVM technologies such as logical partitioning (LPAR) and dynamic resource movement, the JS12 and JS22 provide a novel approach to workload consolidation, efficiency, and power cost reduction for IT environments.

Here, I provide tips and techniques on making the BladeCenter solution work, drawing on experience from the front line of planning for, implementing, troubleshooting and helping design the next stage of IBM i on a Power blade. Together, we'll trace the life cycle of an implementation to help you navigate any challenging terrain.



The Planning Stage

The Planning Stage
This phase begins with the simple question, “Is IBM i on a Power blade right for this environment?” Alternatives to this solution are to deploy IBM i on a POWER6 processor-based IBM Power rack server, and to implement Windows applications on x86-architecture blade servers with an Internet SCSI (iSCSI) connection to IBM i on a rack server. Considerations include

the number, type and size of IBM i servers (AS/400, iSeries, System i)
the number and size of Windows servers
operating system levels and plans to upgrade
type of existing storage (integrated vs. SAN)
existing skills (IBM i, Power hardware, Windows, SAN, AIX/VIOS)
potential power and cooling savings with the BladeCenter
Almost all IBM i and BladeCenter implementations involve Windows integration on blade servers as well. Frequently, migrating IBM i to a Power blade is the final step of an ongoing BladeCenter consolidation project. The closest equivalent to running IBM i on a traditional Power server is the BladeCenter S because of its integrated SAS storage. This type of implementation is best suited to a small IT environment with several servers. For larger installations, including Storage Area Network (SAN) and a BladeCenter H is most appropriate. Keep in mind that in both cases, the necessary skill set includes non-IBM i storage management (BladeCenter S or SAN) as well as working with BladeCenter hardware and Virtual I/O Server (VIOS)-based virtualization.

For more details visit http://systeminetwork.com/article/installing-ibm-i-power-blade-tips-and-techniques

Sunday, March 29, 2009

COMPANIES USING AS400 SERVERS

Here is a partial list of companies that use AS/400-iSeriesMany Casinos in Nevada and N.J. (Harrahs, Ameristar Casinos, American Casino, Boyd Gaming, Borgata Casino, Table Mountain Casino)
AAFES
Absolute Data Access
Affiliated Computer Services (ACS)
Alfa Laval Indutries
Atlas Copco
Sandwik Asia
Adidas
Affiliated Computer (ACS)
AIG Insurance
Alcoa Inc
Alcon Laboratories
All England Lawn Tennis Club (Wimbledon)
Allied Waste
Ashley Furniture
Bally Technologies
Barclays
Bank of america
Merryl Lynch
Bass Pro Shops
Bed Bath and Beyond
Blockbuster Video
Blue Cross Blue Shield of NC
Brinks Home Security
Brooks Brothers
Brookstone
Cabela Outfitters
Cardell Kitchen Cabinets
Cardinal Health
CargillChildrens Hospital of Philadelphia
Citigroup
Coldwater Creek
CompUSA
ConAgra Foods
Costco Wholesale
Countrywide Mortgage
Cox Communications
Dick's Sporting Goods
Discount Tire
Dean Foods
Dolby Laboratories
Dollar General
E & J Gallo Winery
Eaton Corp
EDS
FedEx Ground
GamestopGuitar
CenterHarley-Davidson Motor Co
Harte-Hanks
Home Depot
HSBC
Honeywell
Aerospacehotels.com
International Truck
Jos A Bank Clothiers
JP Morgan Chase
Linens n Things
LL Bean
Lockheed Martin
Major League Baseball (http://www.mlb.com/)
Massachusetts Eye and Ear - a teaching hospital of Harvard Medical School
MervynsMidway Amusement Games (Video Games)
Missouri Farm Bureau
Motel 6Mrs
Fields Cookies (also owns TCBY, Pretzeltime)
NBC Universal (the TV / Movie company)
Nintendo of America
Nordstrom Retail
O'Charleys Restaurants
Pacific Sunwear
Palm Harbor Homes
Penske Truck Leasing
Pepsico
Perot Systems
Pilgrims Pride
Pizza Inn
PC Connection (PC computer sales)
Polo
Ralph Lauren
Proctor and Gamble
Ricoh Electronics
Royal Caribbean Cruises
Sally Beauty
Sammons Trucking
Sbarro Restaurant
ScottTrade Inc
Sonic Drive-In
Suddenlink Communications
StaplesState Farm Insurance
Superior AirTime Warner Cable
Transplace
TransWorld Entertainment
Travelers InsuranceTurtle Wax,
IncUnion Bank of California
Wachovia Corporation
WalgreensWalker International Transport
Westfleet
Yellow Book USA
and many more .....

INTERESTING FACTS OF AS400 SERVER





  • Largest IT install base and has more than 750,000 system installed since 1988. The System i is the world's most popular multi-user business computer system
  • Has more than 18 million users sign-on every day
  • Is installed in over 16,000 banks worldwide, infact Practically Every bank uses AS400 Servers.
  • Is installed in 95% of the FORTUNE 100 and 85% of the Fortune 500
  • Most Manufacturing and Logistics Companies uses AS400 Server .
    25,000 applications run on System i, as well as 3,000 client/server applications. Additional application are being added as software vendors from other platforms migrate their code to the AS/400
  • IBM has invested $1B over the past 3 years in System i innovation
  • Is sold in more countries than McDonald's hamburgers
  • Is the only server that allows customers to run applications from four different operating system environments – i5/OS, AIX 5L, Windows Server and Linux – simultaneously on a single server.
  • Has more than 8,000 IBM Business Partner and Independent Software Vendors Worldwide
  • Bill Gates commented that the only part of IBM that Microsoft would be interested in was the AS/400 division. (At the time, many of Microsoft's internal systems ran on the AS/400 platform.
  • Programming languages available for the AS/400 include RPG, assembly language, C, C++, Pascal, Java, EGL, Perl, Smalltalk, COBOL, SQL, BASIC, PHP, PL/I, Python and REXX. Several CASE tools are available: AllFusion Plex (see *Plex Wiki), ADELIA, Synon, AS/SET, IBM Rational Business Developer Extension, LANSA and ProGen Plus.The IBM System i fully supports the Java language, including a 32-bit Java Virtual Machine (JVM) and a 64-bit JVM making it Multifunctional and useful in most of the Environments .

AS400 PRODUCTS AVAILABLE IN MARKET

IT Productivity Products
GZip/400™ - File compression/decompression utility
MSNTP/400™ - Time synchronizer
X5250/400™ - Terminal emulator
GUI Development Tools
Graphical Extensions/400™ for WebSphere Development Studio - Graphical User Interface toolkit for Wireless and Desktop "Application Specific Solutions"Tcl/Tk/400™ - Universal scripting languageX Window/400™ - Software libraries for iSeries, AS/400, Linux, and UNIX cross-platform applications
Development Services:
Application or component software development using iSeries & AS/400 ILE languages.Modernization of AS/400 ILE RPG or ILE C Language applications.Porting of applications from Unix to the iSeries & AS/400, complete with the User's Interface, such as database query tools or cross-platform agents that provide common access mechanisms for remote systems.
Some More Products ..
Movex
Jd Edwards - oneworld
Live400 by CSC
Many Insurance products
Turnover
Implementor by Aldon