Monday, September 21, 2009

unzipping a file on the iseries

as400 iseries Java ajar tool

The ajar tool is an alternative interface to the jar tool that you use to create and manipulate Java(TM) ARchive (JAR) files. You can use the ajar tool to manipulate both JAR files and ZIP files on the as400.

If you need a ZIP interface or UNZIP interface on the iseries, use the ajar tool instead of the jar tool.

The ajar tool lists the contents of JAR files, extracts from JAR files, creates new JAR files, and supports many of the ZIP formats just as the jar tool does. Additionally, the ajar tool supports adding and deleting files in existing JAR files.

The ajar tool is available using the iseries Qshell Interpreter. For more details, see ajar - Alternative as400 Java archive.

How do you re-enable the user id for STRSST when it has been disabled?

Use the CHGDSTPWD command. Simple!

Connecting from iseries RPG to a web browser

Use hotspots in your as400 Client Access session to do this

A hotspot is an area in the iseries PC5250 display session window where you can use your left mouse button to execute a command or function. Hotspots are generally used for the following functions:
• To simulate function keys with point-and-click technology
• To execute a macro by clicking on a word on your PC5250 display screen
• To execute a word or string on your PC5250 screen as if you had typed it in as an AS/400 command or option
• To provide a point-and-click facility by simulating the Enter key at the current cursor location
• To interface PC5250 with your Web browser by launching Web sites directly from your as400 OS/400 display session

http://www.mcpressonline.com/networking/general/fire-up-your-mouse-with-pc5250s-hotspots-feature.html

More as400 connectivity tips to follow

Difference between SFLINZ and SFLCLR keyword?

One effectively sets all the existing subfile records to blanks and zeros, the other removes existing records

SFLINZ (Subfile Initialize) keyword for display files

Use this record-level keyword on the subfile control record format to specify that the OS/400 program is to initialize all records in the subfile on an output operation to the subfile control record format (identified by the SFLCTL keyword). The fields in each subfile record are initialized to blanks for character type fields, to nulls for floating-point type fields, to zeros for other numeric type fields, or to the constant value specified on input-only fields if the DFT keyword is specified.

When the subfile is displayed (on an output operation to the subfile control record), all records in the subfile are displayed with the same value. Any record previously written is overwritten and no longer has its earlier value

SFLCLR (Subfile Clear) keyword for display files

Use this record-level keyword on the subfile control record format so that your program can clear the subfile of all records. This keyword differs from the SFLDLT keyword in that the subfile is not deleted. It differs from the SFLINZ keyword in that after being cleared, the subfile contains no data. Clearing the subfile does not affect the display. However, after being cleared, the subfile contains no active records.

This keyword has no parameters.

When active records already exist in the subfile and all are to be replaced, your program can send an output operation to the subfile control record format after selecting SFLCLR. This clears the subfile and permits your program to write new records to the subfile (by issuing output operations to the subfile record format while incrementing the relative record number). Issuing an output operation to an already active subfile record causes an error message to be returned to your program.

If SFLCLR is in effect on an output operation and no records exist in the subfile, SFLCLR is ignored

IBM iSeries follows in HP 3000 footsteps?

Start retraining now guys, I think the answer is very much a yes!

http://3000newswire.blogs.com/3000_newswire/2009/08/ibm-iseries-follows-in-3000-footsteps.html

The bottom line is we all need to face the facts of what is happening. IBM i, the OS, is gradually fading away based on IBM not selling it. Since there is no longer an organization to sell IBM i there can be no turn around or return to prominence


the demise of the OS400 community -- and so the iSeries computer line and its vendors -- seems inevitable to Cancilla

"It will simply continue to decline in users and will most definitely be dropped by IBM when the revenue reaches a point where it is no longer feasible to continue supporting it," he wrote in a blog entry last week. Cancilla is getting a strong reaction from iSeries advocates, according to the IT Jungle's Dan Burger. But that probably won't change the sales effort at IBM. This is an aspect of a vendor's disaffection with a platform that was never played out in public for the HP 3000. Right up to the announcement of HP's exit, the vendor and its partners never broached the prospect of HP giving up on the 3000.

But the AS400 (or iSeries or System i) saw a 40 percent decline in sales from '07 to '08, according to the IT Jungle. IBM has reduced the profile of the most i-like parts of the system when it moved System Licensed Internal Code and a Technology Independent Machine Interface into a new Virtualization Engine

iSeries DB2 catalog tables and views

iSeries catalog tables and views

The iSeries™ catalog includes the following views and tables in the QSYS2 schema:


DB2 UDB for iSeries name Corresponding ANSI/ISO name Description
SYSCATALOGS CATALOGS Information about relational databases
SYSCHKCST CHECK_CONSTRAINTS Information about check constraints
SYSCOLUMNS COLUMNS Information about column attributes
SYSCST TABLE_CONSTRAINTS Information about all constraints
SYSCSTCOL CONSTRAINT_COLUMN_USAGE Information about the columns referenced in a constraint
SYSCSTDEP CONSTRAINT_TABLE_USAGE Information about constraint dependencies on tables
SYSFUNCS ROUTINES Information about user-defined functions
SYSINDEXES Information about indexes
SYSJARCONTENTS Information about jars for Java™ routines.
SYSJAROBJECTS Information about jars for Java routines.
SYSKEYCST KEY_COLUMN_USAGE Information about unique, primary, and foreign keys
SYSKEYS Information about index keys
SYSPACKAGE Information about packages
SYSPARMS PARAMETERS Information about routine parameters
SYSPROCS ROUTINES Information about procedures
SYSREFCST REFERENTIAL_CONSTRAINTS Information about referential constraints
SYSROUTINES ROUTINES Information about functions and procedures
SYSROUTINEDEP ROUTINE_TABLE_USAGE Information about function and procedure dependencies
SYSSEQUENCES Information about sequences
SYSTABLEDEP Information about materialized query table dependencies
SYSTABLES TABLES Information about tables and views
SYSTRIGCOL TRIGGER_COLUMN_USAGE Information about columns used in a trigger
SYSTRIGDEP TRIGGER_TABLE_USAGE Information about objects used in a trigger
SYSTRIGGERS TRIGGERS Information about triggers
SYSTRIGUPD TRIGGERED_UPDATE_COLUMNS Information about columns in the WHEN clause of a trigger
SYSTYPES USER_DEFINED_TYPES Information about built-in data types and distinct types
SYSVIEWDEP VIEW_TABLE_USAGE Information about view dependencies on tables
SYSVIEWS VIEWS Information about definition of a view

Need to access MS SQL databases from the as400. Use Microsofts JDBC driver

Overview of the JDBC Driver

The Microsoft SQL Server JDBC Driver is a Java Database Connectivity (JDBC) 4.0 compliant driver that provides robust data access to Microsoft SQL Server 2000, SQL Server 2005, and SQL Server 2008 databases. The JDBC driver can access many of the new features of SQL Server 2005, including database mirroring; the xml, user-defined, and large-value data types; and it supports the new "snapshot" transaction isolation. In addition, the JDBC driver also supports the use of integrated authentication with SQL Server 2000, SQL Server 2005, and SQL Server 2008. Note that the Microsoft SQL Server JDBC Driver version 2.0 can connect to SQL Server 2008 but does not support the new data types or other features that are new in SQL Server 2008.

Using the JDBC Driver
This section provides quick start instructions for making a simple connection to a SQL Server database by using the Microsoft SQL Server JDBC Driver. Before you connect to a SQL Server database, SQL Server must first be installed on either your local computer or a server, and the JDBC driver must be installed on your local computer.

Choosing the Right JAR file

The Microsoft SQL Server JDBC Driver version 2.0 provides sqljdbc.jar and sqljdbc4.jar class library files to be used depending on your preferred Java Runtime Environment (JRE) settings. For more information about which JAR file to choose, see System Requirements for the JDBC Driver.

Setting the Classpath

The JDBC driver is not part of the Java SDK. If you want to use it, you must set the classpath to include the sqljdbc.jar file or the sqljdbc4.jar file. If the classpath is missing an entry for sqljdbc.jar or sqljdbc4.jar, your application will throw the common "Class not found" exception.

The sqljdbc.jar file and sqljdbc4.jar file are installed in the following location:

\sqljdbc_\\sqljdbc.jar

\sqljdbc_\\sqljdbc4.jar

The following is an example of the CLASSPATH statement that is used for a Windows application:

CLASSPATH =.;C:\Program Files\Microsoft SQL Server JDBC Driver\sqljdbc_2.0\enu\sqljdbc.jar

The following is an example of the CLASSPATH statement that is used for a Unix/Linux application:

CLASSPATH =.:/home/usr1/mssqlserverjdbc/Driver/sqljdbc_2.0/enu/sqljdbc.jar

You must make sure that the CLASSPATH statement contains only one Microsoft SQL Server JDBC driver, such as either sqljdbc.jar or sqljdbc4.jar.

Note:
On Windows systems, directory names longer than 8.3 or folder names with spaces may cause problems with classpaths. If you suspect these types of issues, you should temporarily move the sqljdbc.jar file or the sqljdbc4.jar file into a simple directory name such as C:\Temp, change the classpath, and determine whether that addresses the problem.
Applications that are run directly at the command prompt
The classpath is configured in the operating system. Append sqljdbc.jar or sqljdbc4.jar to the classpath of the system. Alternatively, you can specify the classpath on the Java command line that runs the application by using the java -classpath option.

Applications that run in an IDE
Each IDE vendor provides a different method for setting the classpath in its IDE. Just setting the classpath in the operating system will not work. You must add sqljdbc.jar or sqljdbc4.jar to the IDE classpath.

Servlets and JSPs
Servlets and JSPs are run in a servlet/JSP engine such as Tomcat. The classpath must be set according to the servlet/JSP engine documentation. Just setting the classpath in the operating system will not work. Some servlet/JSP engines provide setup screens that you can use to set the classpath of the engine. In that situation, you must append the correct JDBC Driver JAR file to the existing engine classpath and restart the engine. In other situations, you can deploy the driver by copying sqljdbc.jar or sqljdbc4.jar to a specific directory, such as lib, during engine installation. The engine driver classpath can also be specified in an engine specific configuration file.

Enterprise Java Beans
Enterprise Java Beans (EJB) are run in an EJB container. EJB containers are sourced from various vendors. Java applets run in a browser but are downloaded from a Web server. Copy sqljdbc.jar or sqljdbc4.jar to the Web server root and specify the name of the JAR file in the HTML archive tab of the applet, for example, applet ... archive=sqljdbc.jar>.

Making a Simple Connection to a Database

Using the sqljdbc.jar class library, applications must first register the driver as follows:

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

When the driver is loaded, you can establish a connection by using a connection URL and the getConnection method of the DriverManager class:

String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
"databaseName=AdventureWorks;user=MyUserName;password=*****;";
Connection con = DriverManager.getConnection(connectionUrl);
In the JDBC API 4.0, the DriverManager.getConnection method is enhanced to load JDBC drivers automatically. Therefore, applications do not need to call the Class.forName method to register or load the driver when using the sqljdbc4.jar class library.

When the getConnection method of the DriverManager class is called, an appropriate driver is located from the set of registered JDBC drivers. sqljdbc4.jar file includes "META-INF/services/java.sql.Driver" file, which contains the com.microsoft.sqlserver.jdbc.SQLServerDriver as a registered driver. The existing applications, which currently load the drivers by using the Class.forName method, will continue to work without modification.

Note:
sqljdbc4.jar class library requires a Java Runtime Environment (JRE) of version 6.0 or later.

Recover or reset QSECOFR passwords

When IBM ships a server, both a QSECOFR OS/400 user profile and a QSECOFR service tools user ID are supplied. These are not the same. They exist in different locations and are used to access different functions. Your QSECOFR service tools user ID can have a different password from your QSECOFR OS/400 user profile. Service tools user IDs have different password policies than OS/400 user profiles.
If you lose or forget the passwords for both the QSECOFR OS/400 user profile and the QSECOFR service tools user ID, you may need to install your operating system again to recover them. Contact your service provider for assistance. If you know either of these passwords, this information tells you how to recover the password you do not know.
Reset the QSECOFR OS/400 user profile password
If you know the QSECOFR service tools user ID, you can use it to reset the QSECOFR OS/400 user profile to its initial value (QSECOFR). This procedure requires you to perform an initial program load (IPL) on your server. The change does not take affect until after the IPL. Complete the following steps to reset the QSECOFR OS/400 user profile:
Start DST.
Enter the QSECOFR service tools user ID and password on the DST Sign-On display.
Select option 5 (Work with DST environment) from the Use DST menu.
Select option 6 (Work with Service Tools Security Data) from the Work with DST Environment menu. You will see the Work with Service Tools Security Data menu:
+——————————————————————————–+
| Work with Service Tools Security Data |
| System: _____________ |
| Select one of the following: |
| 1. Reset operating system default password |
| 2. Change operating system install security |
| 3. Work with service tools security log |
| 4. Restore service tools security data |
| 5. Save service tools security data |
| 6. Password level |
| Selection |
+——————————————————————————–+
Select option 1 (Reset operating system default password). The Confirm Reset of System Default Password display appears.
Press Enter to confirm the reset. A confirmation message appears telling you that the system has set the operating system password override.
Continue pressing F3 (Exit) to return to the Exit DST menu.
Select option 1 (Exit DST). The IPL or Install the System menu appears.
Select option 1 (Perform an IPL). The system continues with a manual IPL. If you need additional information about performing an IPL, see the Starting and stopping the iSeries topic.
When the IPL completes, return the keylock switch or electronic keystick to the Auto position, if applicable.
Sign on to OS/400 as QSECOFR. Use the CHGPWD command to change the QSECOFR password to a new value. Store the new value in a safe place.
Attention: Do not leave the QSECOFR password set to the default. This is a security exposure because this is the value shipped with every iSeries server and is commonly known.
Reset the QSECOFR service tools user ID and password
If you know the password for the QSECOFR OS/400 user profile, you can use it to reset the password for the IBM-supplied service tools user ID that has service tools security privilege (QSECOFR) to the IBM-supplied default value by completing the following steps:
Ensure that the server is in normal operating mode, not DST.
Sign on at a workstation using the QSECOFR OS/400 user profile.
On a command line, type CHGDSTPWD (Change IBM Service Tools Password). You see the Change IBM Service Tools Password (CHGDSTPWD) display:
+——————————————————————————–+
| Change IBM Service Tools Pwd (CHGDSTPWD) |
| |
|Type choices, press Enter. |
| |
|Password . . . . . . . . . . . . *DEFAULT *SAME, *DEFAULT |
| |
+——————————————————————————–+
Type *DEFAULT and press the Enter key. This sets the IBM-supplied service tools user ID that has service tools security privilege and its password to QSECOFR.
Attention: Do not leave the QSECOFR service tools user ID and password set to the default value. This is a security exposure because this is the value shipped with every iSeries server and is commonly known. See the Recommendations for managing service tools user IDs for more information.

Sunday, September 20, 2009

Parsing An Excel Spreadsheet with as400 RPG and Java

Scott Klement has an article on how to do this on the as400 here...

In the May 15, 2003, issue of Club Tech iSeries Programming Tips, some information was presented on how to use the Jakarta-POI/HSSF Java classes together with an iseries RPG program to create an Excel spreadsheet. In this tip, the same open-source Java classes will be used to do the opposite: to extract data from an existing Excel spreadsheet.

http://www.easy400.net/hssfcgi/documentation/17840.html

The downloadable as400 source code for this tip contains an RPG service program and Java .jar file that work together with the HSSF classes to make parsing an Excel document a snap. All you have to do is provide a as400 rpg subprocedure for character cells and a subprocedure for numeric cells, and the service program will call them back for each cell in the workbook

Unleash the power of i5/os on your windows server using the QNTC File System

Once you have QNTC configured, and you have a user profile that can perform operations on your target Windows file shares, you can use QNTC to read and write stream file data to a Windows server in the same way you would normally use the root (/) directory of the IFS, the QDLS file system, or the OpenSys IFS file systems in application programs. Your Windows file systems merely become targets for ASCII and stream file operations, which gives you the ability to use your Windows servers to read and update Windows data in OS/400 programs or to back up Windows data to an OS/400-based tape drive by using the Save Object (SAV) command


http://www.itjungle.com/fhg/fhg031704-story04.html

Using Reserved Words in as400 sql queries

If your trying to run an SQL statement on the as400, but are getting errors because one of your column names is an DB2/400 SQL reserved word, try the following.

Wrap double quotes around the offending column name, and also make it uppercase. This should resolve the reserved words problem!

Friday, September 18, 2009

Locking down and logging iSeries file access from SQL & FTP commands from windows/unix/java environment

Each server application on the as400, first calls an exit program, if one exists, and then continues to access the data. Eg The exit program for ODBC is QIBM_QZDA_INIT.

The steps to creating an exit program are

Create you exit program

Use WRKREGINF to work with exit programs
Use option 1 to add the program to the list of registered exit programs

This link to an example:

http://publib.boulder.ibm.com/infoce...imstsmprpg.htm


Examples: Create exit programs with RPG

The following example illustrates how to set up a user exit program with RPG*.

Note: Read the Code example disclaimer for important legal information.



**
** OS/400 SERVERS - SAMPLE USER EXIT PROGRAM
**
** THE FOLLOWING RPG PROGRAM UNCONDITIONALLY
** ACCEPTS ALL REQUESTS. IT CAN BE USED AS A SHELL
** FOR SPECIFIC APPLICATIONS. NOTE: REMOVE THE
** SUBROUTINES AND CASE STATEMENT ENTRIES FOR THE SERVERS
** THAT DO NOT REQUIRE
** SPECIFIC EXIT PROGRAM HANDLING FOR BETTER PERFORMANCE.
**
E*
E* NECESSARY ARRAY DEFINITIONS FOR TRANSFER FUNCTION
E* AND REMOTE SQL
E*
E TFREQ 4096 1
E RSREQ 4107 1
I*
I*
IPCSDTA DS
I 1 10 USERID
I 11 20 APPLID
I*
I* SPECIFIC PARAMETERS FOR VIRTUAL PRINTER
I*
I 21 30 VPFUNC
I 31 40 VPOBJ
I 41 50 VPLIB
I 71 750VPIFN
I 76 85 VPOUTQ
I 86 95 VPQLIB
I*
I* SPECIFIC PARAMETERS FOR MESSAGING FUNCTION
I 21 30 MFFUNC
I*
I* SPECIFIC PARAMETERS FOR TRANSFER FUNCTION
I*
I 21 30 TFFUNC
I 31 40 TFOBJ
I 41 50 TFLIB
I 51 60 TFMBR
I 61 70 TFFMT
I 71 750TFLEN
I 764171 TFREQ
I*
I* SPECIFIC PARAMETERS FOR FILE SERVER
I*
I* NOTE: FSNAME MAY BE UP TO l6MB.
I* FSNLEN WILL CONTAIN THE ACTUAL SIZE OF FSNAME.
I*
I B 21 240FSFID
I 25 32 FSFMT
I 33 33 FSREAD
I 34 34 FSWRIT
I 35 35 FSRDWR
I 36 36 FSDLT
I B 37 400FSNLEN
I 41 296 FSNAME
I*
I* SPECIFIC PARAMETERS FOR DATA QUEUES
I*
I 21 30 DQFUNC
I 31 40 DQQ
I 41 50 DQLIB
I 70 750DQLEN
I 76 77 DQROP
I 78 820DQKLEN
I 83 338 DQKEY
I*
I* SPECIFIC PARAMETERS FOR REMOTE SQL
I*
I 21 30 RSFUNC
I 31 40 RSOBJ
I 41 50 RSLIB
I 51 51 RSCMT
I 52 52 RSMODE
I 53 53 RSCID
I 54 71 RSSTN
I 72 75 RSRSV
I 764182 RSREQ
I*
I* SPECIFIC PARAMETERS FOR NETWORK PRINT SERVER
I*
I 21 28 NPFT
I B 29 320NPFID
I* THE FOLLOWING PARAMETERS ADDITIONAL FOR FORMAT SPLF0l00
I 33 42 NPJOBN
I 43 52 NPUSRN
I 53 58 NPJOB#
I 59 68 NPFILE
I B 69 720NPFIL#
I B 73 760NPLEN
I 77 332 NPDATA
I*
I* Data queue server:
I*
I* QIBM_QZHQ_DATA_QUEUE format ZHQ00100
I*
I 21 28 DQOFMT
I B 29 320DQOFID
I 33 42 DQOOBJ
I 43 52 DQOLIB
I 53 54 DQOROP
I B 55 580DQOLEN
I 59 314 DQOKEY
I*
I* Specific PARAMETERS FOR CENTRAL SERVER
I*
I 21 28 CSFMT
I B 29 320CSFID
I* Central server:
I*
I* QIBM_QZSC_LM format ZSCL0l00 for license management calls
I*
I*
I 33 287 CSLCNM
I 288 295 CSLUSR
I 296 302 CSLPID
I 303 306 CSLFID
I 307 312 CSLRID
I B 313 3140CSLTYP
I*
I* Central server:
I*
I* QIBM_QZSC_LM format ZSCS0l00 for system management calls
I*
I*
I 33 287 CSSCNM
I 288 542 CSSCMY
I 543 543 CSSNDE
I 544 798 CSSNNM
I*

I* Central server:
I*
I* QIBM_QZSC_LM format ZSCN0l00 for retrive conversion map calls
I*
I*
I 21 30 CSNXFM
I 29 320CSNFNC
I B 33 360CSNFRM
I B 37 400CSNTO
I B 41 420CSNCNT
I*
I* SPEClFIC PARAMETERS FOR DATABASE SERVER
I*
I 21 28 DBFMT
I B 29 320DBFID
I*
I* THE FOLLOWING PARAMETERS ADDITIONAL FOR FORMAT ZDAD0l00
I 33 160 DBDFIL
I 161 170 DBDLIB
I 171 180 DBDMBR
I 181 190 DBDAUT
I 191 318 DBDBFL
I 319 328 DBDBLB
I 329 338 DBDOFL
I 339 348 DBDOLB
I 349 358 DBDOMB
I*
I* THE FOLLOWING PARAMETERS ADDITIONAL FOR FORMAT ZDAD0200
I B 33 360DBNUM
I 37 46 DBLIB2
I*
I* THE FOLLOWING PARAMETERS ADDITIONAL FOR FORMAT ZDAQ0l00
I 33 50 DBSTMT
I 51 68 DBCRSR
I 69 70 DBOPI
I 71 72 DBATTR
I 73 82 DBPKG
I 83 92 DBPLIB
I B 93 940DBDRDA
I 95 95 DBCMT
I 96 351 DBTEXT
I* THE FOLLOWING PARAMETERS REPLACE DBTEXT FOR FORMAT ZDAQ0200
I 96 105 DBSQCL
I B 133 1360DBSQLN
I 137 392 DBSQTX
I* THE FOLLOWING PARAMETERS ADDITIONAL FOR FORMAT ZDAR0l00
I 33 52 DBLIBR
I 53 88 DBRDBN
I 89 108 DBPKGR
I 109 364 DBFILR
I 365 384 DBMBRR
I 385 404 DBFFT

I* THE FOLLOWING PARAMETERS ADDITIONAL FOR FORMAT ZDAR0200
I 33 42 DBRPLB
I 43 170 DBRPTB
I 171 180 DBRFLB
I 181 308 DBRFTB
I*
I* Remote command and distributed program call server:
I*
I* QIBM_QZRC_RMT format CZRC0100
I* RCPGM AND RCLIB ARE NOT USED FOR REMOTE COMMAND CALLS
I*
I 21 28 RCFMT
I B 29 320RCFID
I 33 42 RCPGM
I 43 52 RCLIB
I B 53 560RCNUM
I 57 312 RCDATA
I*
I* signon server:
I*
I* QIBM_QZSO_SIGNONSRV format ZSOY0l00 for TCP/IP signon server
I*
I 21 28 SOXFMT
I B 29 320SOFID
I*
I***************************************************************
I*
I '*VPRT ' C #VPRT
I '*TFRFCL ' C #TRFCL
I '*FILESRV ' C #FILE
I '*MSGFCL ' C #MSGF
I '*DQSRV ' C #DQSRV
I '*RQSRV ' C #RQSRV
I '*SQL ' C #SQL
I '*NDB ' C #NDBSV
I '*SQLSRV ' C #SQLSV
I '*RTVOBJINF' C #RTVOB
I '*DATAQSRV ' C #DATAQ
I 'QNPSERVR ' C #QNPSV
I '*CNTRLSRV ' C #CNTRL
I '*RMTSRV ' C #RMTSV
I '*SIGNON ' C #SIGN
I*
C*
C* EXIT PROGRAM CALL PARAMETERS
C*
C *ENTRY PLIST
C PARM RTNCD 1
C PARM PCSDTA
C*

C* INITIALIZE RETURN VALUE TO ACCEPT REQUEST
C*
C MOVE '1' RTNCD
C*
C* COMMON PROCESSING
C*
C* COMMON LOGIC GOES HERE
C*
C* PROCESS BASED ON SERVER ID
C*
C APPLID CASEQ#VPRT VPRT
C APPLID CASEQ#TRFCL TFR
C APPLID CASEQ#FILE FILE
C APPLID CASEQ#MSGF MSG
C APPLID CASEQ#DQSRV DATAQ
C APPLID CASEQ#RQSRV RSQL
C APPLID CASEQ#SQL SQLINT
C APPLID CASEQ#NDBSV NDB
C APPLID CASEQ#SQLSV SQLSRV
C APPLID CASEQ#RTVOB RTVOBJ
C APPLID CASEQ#DATAQ ODATAQ
C APPLID CASEQ#QNPSV NETPRT
C APPLID CASEQ#CNTRL CENTRL
C APPLID CASEQ#RMTSV RMTCMD
C APPLID CASEQ#SIGN SIGNON
C END
C SETON LR
C RETRN
C*
C* SUBROUTINES
C*
C*
C* VIRTUAL PRINT
C*
C VPRT BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* TRANSFER FUNCTION
C*
C* THE FOLLOWING IS AN EXAMPLE OF SPECIFIC PROCESSING
C* THAT THE EXIT PROGRAM COULD DO FOR TRANSFER FUNCTION.
C*

C* IN THIS CASE, USERS ARE NOT ALLOWED TO SELECT
C* DATA FROM ANY FILES THAT ARE IN LIBRARY QIWS.
C*
C TFR BEGSR
C TFFUNC IFEQ 'SELECT'
C TFLIB ANDEQ'QIWS'
C MOVE '0' RTNCD
C END
C ENDSR
C*
C*
C* FILE SERVER
C*
C FILE BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* MESSAGING FUNCTION
C*
C MSG BEGSR
C* SPECIFIC LOGIC GOFS HERE
C ENDSR
C* DATA QUEUES
C*
C DATAQ BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* REMOTE SQL
C*
C RSQL BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* SERVERS
C*
C*
C* DATABASE INIT
C*
C SQLINT BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* DATABASE NDB (NATIVE DATABASE)
C*
C NDB BEGSR
C* SFECIFIC LOGIC GOES HERE
C ENDSR
C*

C* DATABASE SQL
C*
C SQLSRV BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* DATABASE RETRIEVE OBJECT INFORMATION
C*
C RTVOBJ BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* DATA QUEUE SERVER
C*
C ODATAQ BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* NETWORK PRINT
C*
C NETPRT BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* CENTRAL SERVER
C*
C*
C* THE FOLLOWING IS AN EXAMPLE OF SPECIFIC PROCESSING
C* THAT THE EXIT PROGRAM COULD DO FOR LICENSE MANAGEMENT.
C*
C* IN THIS CASE, THE USER "USERALL" WILL NOT BE ALLOWED
C* TO EXECUTE ANY FUNCTIONS THAT ARE PROVIDED BY THE
C* CENTRAL SERVER FOR WHICH THIS PROGRAM IS A REGISTERED
C* EXIT PROGRAM - LICENSE INFORMATION, SYSTEM MANAGEMENT
C* OR RETRIVE A CONVERSION MAP.
C*
C CENTRL BEGSR
C USERID IFEQ 'USERALL'
C MOVE '0' RTNCD
C ENDIF
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*

C* REMOTE COMMAND AND DISTRIBUTED PROGRAM CALL
C*
C* IN THIS CASE, THE USER "USERALL" WILL NOT BE ALLOWED
C* TO EXECUTE ANY REMOTE COMMANDS OR REMOTE PROGRAM CALLS
C*
C RMTCMD BEGSR
C USERID IFEQ 'USERALL'
C MOVE '0' RTNCD
C ENDIF
C ENDSR
C*
C* SIGNON SERVER
C*
C SIGNON BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR

Automating a process to run every 10 minutes

If you need to run a as400 job, say a database query or report on a regular schedule, heres and example of how to do this. Lets say you needed to run a query every 10 mins...

You could submit a CL program, MYJOB to do this, to batch, with a 10 minute delay and a data area to terminate the job externally...


MYJOB:
Loop:
Run database query
Print Report
FTP data
etc

dlyjob 10 minutes
check kill dataarea and exit if set
goto loop

The problem here is that the job will could run for almost 10 minutes after, if the kill data area is set just after its checked. If you operator needs to shut down the system in a hurry you dont want him waiting an extra 10 minutes for a DLYJOB.

A better way to do the is to replace the read of a data area with a read of a data queue. The CL can then wait the required time for a kill entry to appear on the data queue. If it does you end processing runs immediately, if not you core processing runs again, then the check again. The most you will have to wait is the length of time it takes to run your core processing! So no DLYJOB required, just a QRCVDTAQ (and a QSNDDTAQ to set it of course)


MYJOB:
Loop:
Run database query
Print Report
FTP data
etc

check and wait on kill dataqueue for 10 mins and exit if set
goto loop

Using free-form RPG program to call another RPG program

If you get RNF3751 'External procedure on prototype for main procedure is not the same as actual external name' when trying to call an RPG using free format, check you procedure interface. Your PR and your PI need to match!

eg

For program myrpg01

d myrpg01 pr
d parm 1A

d myrpg01 pi
d parm 1A

then to call

either CALLP myrpg01('MYPARM');

or just

myrpg01('MYPARM');

Trying to find out as400 library size

To find out your as400 library sizes run

DSPLIB LIB(*All) OUTPUT(*PRINT)

in a batch job.

This will show you the size of all objects in the as400 libraries and the total library size including the objects at the bottom of each library in the report.

Tuesday, September 15, 2009

Creating an AS/400 passthrough query in MS Access

Passthrough queries can be efficient for AS/400 ODBC connections because they let you bypass the JET engine and take advantage of the AS/400's query processor.

To create a passthrough query in Access, open the Queries windows and then double-click the "Create query in design view" icon. Close the New Tables dialog box that automatically appears. Then, on the Query menu, select SQL Specific and then Pass-Through option. Next, set the ODBC connection string by selecting the Properties icon in the toolbar and then clicking on the ellipsis next to the ODBC Connect Str property. You're then prompted to select an existing data source to the AS/400, or you can create a new data source if an AS/400 data source doesn't already exist. After setting the connection properties, type your passthrough query in the SQL Pass-Through Query window and click the Execute icon to run the query

Saturday, September 12, 2009

Typical settings for MS OLE DB Provider for IBM DB2

Example settings for configuring MS OLE DB provider for DB2 for as400 iseries
Affiliate Application
Alternate TP Name
APPC Local LU Alias
APPC Mode Name              QPCSUPP
APPC Remote LU Alias
APPC Security Type          Program
Auth Encrypt    False
Cache Authentication        False
Client Application Name 
Connection Pooling          False
Data Source                 myas400.mydomain.com
DateTime As Char            False
DateTime as Date            False
DBMS Platform               DB2/AS400
Default Qualifier
Default Schema              MYDATA (note, this is the library name containing the files to access on as400)
Defer Prepare               False
Derive Parameters           False
Extended Properties  
Host CCSID                  37
Initial Catalog             MY400
Integrated Security
Mode                        ReadWrite
Network Address             myipaddress
Network Port                446
Network Transport Library   TCPIP
New Password
Package Collection          SQLPKG (library to contain the packages created for pulling/pushing data from/to this box)
PC Code Page                1252
Persist Security Info       False
Principle Name
Process Binary as Character false
Rowset Cache Size           0
Units of Work               RUW
Use Early Metadata          False
Locale Identifier           1033
Mode                        3
Protection Level            1
Connection Pooling          false

More as400 settings to follow

Saturday, August 29, 2009

Display Command Line Window (QUSCMDLN) API

The Display Command Line Window (QUSCMDLN) API displays a window containing a command line. A window is an area on the display that is treated as a separate display. Windows have visible boundaries and appear to overlay the display from which they are requested.

The QUSCMDLN API has no parameters

Friday, July 24, 2009

Reno County is preparing to move from an AS400 computer system to a personal-computer-based system

Information Services director Mike Mathews said the county has operated from the same basic computer platform since 1986, and maintenance and upgrades became concerns


I hope they mean of their software? If they were worried about maintenance and upgrade of their iseries, someone was obviously giving them some very bad advice.

http://www.hutchnews.com/Localregional/flushots2009-07-22T20-54-47

Calling an RPG program from Groovy

DON DENONCOURT shows how to call RPG from Groovy, via an sql stored procedure call

I've been integrating Java applications with AS400/iSeries/Systemi RPG programs for over ten years. I've covered it in my book (Java Application Strategies for the iSeries) as well as in many of my articles. Calling RPG from Java can be complex. There are 4 or so options but I've been fairly emphatic about using JDBC callable statements as it is the simplest approach. To do that you need to create a stored produce "wrapper" for the RPG. But the Java code still can be quite verbose. Not so with Groov


http://denoncourt.blogspot.com/2009/07/calling-rpg-program-from-groovy.html

"We found out the hard way that turning the terminal off doesn’t necessarily end the job"

From http://techblog.livingatrandom.com/2005/08/20/newbie-blunders-part-i/

Since this is my first article, I decided to look back at my career. Starting out in 1996 with a small IT company, I was a fresh graduate and like other graduates, I had no idea what an AS/400 (which is what they called the iSeries back then) was. Naturally, I was pretty excited. When I say this big refrigerator in the middle of the room, I said to myself, “Cool! I get to program using a mainframe!” The other trainees and I were told later that day however, that it was a midrange.

“Huh? A mid-what?”

Since our exposure in college was focused on PC’s and DOS (Yeah, yeah, yeah. It was that long ago), we only had a rough idea of what other platforms were. Heck, we thought mainframes belonged to musuems even then. The dumb terminals that were assigned to us were really big…about the size of a microwave oven.

Eventually, the other trainees and I went through…well…training. We were all coding happily one day when one of us suddenly had an endless loop in a piece of code. No problem! Just press Ctrl-C or Ctrl-Break. But how? There isn’t even a Ctrl key!

Since it was almost time to go home anyway, we all suggested to our colleague, “Just turn the terminal off and we’ll go home. You can find the bug tomorrow.”

Imagine our suprise when we were all called down to our boss’ office the following day. We found out the hard way that turning the terminal off doesn’t necessarily end the job. We all were given a long lecture on how to use the System-Request key.

Exploring NFS on AS/400

This redbook explores the Network File System on the AS400 system.

The OS/400 Network File System (NFS) Support, which was introduced with V3R7 as part of TCP/IP Utility, provides a new system function for the AS400 system that allows you to construct a distributed network system where all users can access the data they need. This redbook will help you use the features of the NFS to share data across sytems. It explains the security considerations to be aware of while using NFS. It then goes on to explore the National Language Support features offered by NFS. Further on, it describes the enhancements in the NFS when compared to the File Server Support/400, which was made available for versions of OS/400 earlier than V3R7. This book also includes the steps involved to migrate from FSS/400 to NFS. The final chapter in this redbook covers a few common problems that you might come across while using the NFS and how to solve them. The intended audiences for this redbook are system administrators building up and maintaining a distributed network using NFS and AS/400 customers or programmers working with the Network File System. It is assumed that the reader has basic working experience with the AS/400 system

Chapter 1. Integrated File System Overview 1.0
Chapter 2. Network File System Overview 2.0
Chapter 3. Operating and Using NFS 3.0
Chapter 4. NFS Security 4.0
Chapter 5. National Language Support 5.0
Chapter 6. Migrating from FSS/400 to NFS 6.0
Chapter 7. Common Problems Encountered in NFS 7.0
Appendix A. Layout and Rules of the /etc/exports File A.0
Appendix B. Layout and Rules of the /etc/netgroup File B.0
Appendix C. NLS Code Page Example C.0
Appendix D. Installation of the Edit File (EDTF) command D.0
Appendix E. CHOWN() API Description E.0
Appendix F. PC NFS Client Considerations F.0
Appendix G. Displaying Exported Files G.0
Appendix H. Special Notices H.0
Appendix I. Related Publications I.0

http://www.redbooks.ibm.com/abstracts/sg242158.html

Network File System on the AS400 system

Common High availability issues in an i5/OS High-Availability and Replication Environment

Joe Hertvik discusses the issues that can occur once you have you HA and replication environment up and running on your as400.

The second mistake occurs when administrators don't make sure that replicated data stays in sync. Before a failover, perform further auditing on your data groups to make sure that someone hasn't accidentally removed a library from the replication scheme. My shop ran a test last month where we found a critical library was present on both the target and source systems, but its contents hadn't been replicated in six months. Replication had accidentally been turned off; the programs worked but the data was old. So in addition to making sure that you have the same libraries on both systems, make sure that the data is being kept in sync. Otherwise, you may have replicated the file structure perfectly but your data may not be up to date


http://www.itjungle.com/fhg/fhg060309-story03.html

OnDemand SQL Performance Analysis Simplified on DB2 for i5/OS in V5R4

The goal of database performance tuning is to minimise the response time of your queries. It is also to optimise your servers resources by minimising network traffic, disk IO, and CPU time.
This IBM Redbook helps you to understand the basics of identifying and tuning the performance of Structured Query Language (SQL) statements using IBM DB2 for i5/OS . DB2 for i5/OS provides a comprehensive set of tools that help technical analysts tune SQL queries. The SQL Performance Monitors are part of the set of tools that IBM i5/OS provides for assisting in SQL performance analysis since Version 3 Release 6. These monitors help to analyze database performance problems after SQL requests are run. In V5R4 of i5/OS iSeries Navigator provides a series of new tools to do SQL Performance analysis that we cover in this redbook. Among the new tools that we will covering are:
- Capability of visualizing the contents of the SQE Plan Cache
- SQE Plan Cache Snapshots
- The new reporting tool - Dashboard
- OnDemand Index Advisor
- Evaluators such as Index and Materialized Query Tables
This redbook also presents tips and techniques based on the SQL Performance Monitors and other tools, such as Visual Explain and all the tools provided in V5R4. You’ll find this guidance helpful in gaining the most out of both DB2 for i5/OS and query optimizer when using SQL

Chapter 1. Determining whether you have an SQL performance problem
Chapter 2. DB2 for i5/OS performance basics
Chapter 3. Overview of tools to analyze database performance
Chapter 4. Gathering SQL performance data
Chapter 5. Analyzing SQL performance data using iSeries Navigator
Chapter 6. Custom Database Monitor Analysis
Chapter 7. SQE Plan Cache and SQE Plan Cache Snapshots
Chapter 8. Analyzing database performance data with Visual Explain
Chapter 9. Index Advisor
Chapter 10. SQL Performance Analysis: A Methodology
Chapter 11. Environmental settings that affect SQL Performance
Chapter 12. Tips to pro-actively prevent SQL performance problems
Chapter 13. Using Collection Services data to identify jobs using system resources
Appendix A. Tools to check a performance problem

http://www.redbooks.ibm.com/abstracts/sg247326.html

Four Ways To Encrypt i5/OS Backups

Joe Hertvik discusses techniques that i5/OS users have for encrypting backups for greater protection and to satisfy auditors and government agencies, explores what technologies are available, as well as the advantages and disadvantages of using each technology

You generally have four options to encrypt backup media from your i5/OS systems.
Software encryption through IBM's Backup Recovery and Media Services (BRMS) licensed program (i5/OS V6R1 only)
Software encryption through a third-party product
Hardware encryption through tape drive capabilities
Hardware encryption through an inline encryption backup solution
All of these techniques do the job but they also exact some sort of processing price on your system. In general, software-based encrypt techniques are prone to the following problems:
They force you to rewrite your backup routines to whatever commands or techniques the encryption enabling package uses. This is true whether you're using IBM's BRMS package or whether you're using a third-party package to perform the encryption.
If you're using BRMS to encrypt your data, you have to upgrade to i5/OS V6R1.
Encrypted backups don't take well to media compaction techniques, so backed up files will generally take up more space on your backup media.
Software encrypted backups generally take longer to run, because there is less compaction going on with the backup and because encryption adds another level of processing to your backup routine.


Part I focuses on software techniques

http://www.itjungle.com/fhg/fhg051309-story03.html

Part II focuses on hardward techniques

http://www.itjungle.com/fhg/fhg052009-story03.html


More Ways To Encrypt i5/OS Backups to follow...

i:ASP Data Balancer and IBM's iSeries servers

IBM is continuing its push into SSDs (solid-state drives), announcing flash drives for server and storage platforms as well as new software for allocating data among different types of drives.

Enterprise SSDs allow for faster access to data but cost far more, per bit, than spinning HDDs (hard disk drives). IBM is clearly committed to the emerging technology, as are EMC and other enterprise storage vendors. IBM, though, doesn't believe SSDs will make up more than 5 percent of any average company's total storage capacity.

For the foreseeable future, SSDs will be used as part of tiered storage architectures alongside HDDs, said Charlie Andrews, director of marketing in IBM's Dynamic Infrastructure group. For that reason, the company offers a variety of software to help store "hot" data in SSDs and "cold" data on HDDs. Its latest announcement, the IBM i:ASP Data Balancer, automatically shifts different bits of data to the most appropriate tier in a storage system. The software uses an algorithm that draws upon information such as how often each bit of data has been used, Andrews said. The i:ASP Data Balancer is designed for IBM's iSeries servers, part of the company's Power
line.

From http://www.macvideo.tv/editing/news/index.cfm?newsId=116293&pagType=samechandate

Wednesday, May 27, 2009

Speedware reselling RPG to-.NET Code Converter

Speedware is reselling and servicing Sykora-ML's ML-iMPACT code converter in the North American market. Skykor-ML claims the tool can convert 100 percent of RPG functions into fully maintainable C# or Java. That's quite unusual and special for a code converter, according to Speedware officials, who have decades of experience in the IBM midrange and mainframe migration business.

The tool converts an RPG application's DDS code to WebForms or ASP objects, while printing and other operating system-specific functions, such as batch job management, are also accounted for. What really impresses Koppe, however, is that Sykora-ML built an automated testing tool directly into ML-iMPACT, "so they can guarantee the result is exactly the same as the source platform. That, again, is very rare to see in a tool."


http://www.itjungle.com/fhs/fhs022409-story01.html

Halcyon Software growing its presence in the U.S

U.K.-based Halcyon Software, a developer of systems management software for i OS and other platforms, is growing its presence in the U.S. with the goal of attracting new customers. But instead of concentrating on individual AS/400 shops, Halcyon will primarily target outsourcing firms that run large data centers, which in turn will use Halcyon's software to manage the individual clients' systems. It's a practice that has already provided successful for the software company in the U.S


http://www.itjungle.com/fhs/fhs052609-story01.html

Monday, May 25, 2009

IBM ships SSDs for Power Systems - Unix, Linux, and i5/os

IBM today begins selling its first solid state disks for its Power Systems boxes, the machines it uses to attack the Unix, Linux, and OS/400 installed bases.

The IBM SSD, which comes in a 2.5-inch form factor, has about 220 MB/sec of sustained throughput on reads and about 122 MB/sec of sustained throughput on writes and can perform about 28,000 I/O operations per second (IOPS) on random transactional processing. The SSD has a 3 Gb/sec SAS interface and has an average access time of from 20 to 120 microseconds, the difference depending on where data is located on the SSD. According to IBM's specs, the SSD has about 87 times the I/O operations per second of a 15K RPM SAS drive and yet consumes about one-fifth of the power


Timothy Prickett Morgan in The Register

http://www.theregister.co.uk/2009/05/22/ibm_power_ssds/

Friday, May 22, 2009

AS400 JTOpen 6.5.1 Available

Fixes and enhancements in as400 JTOpen 6.5.1 (released 2009-05-20)

- Data area: Fixed breakage in JTOpen 6.5: NoClassDefFoundError on Sun JVM's.
- Print: Fixed breakage in JTOpen 6.5: NoClassDefFoundError on Sun JVM's.
- User space: Fixed breakage in JTOpen 6.5: NoClassDefFoundError on Sun JVM's.

What is IBMs Toolbox for Java

The IBM Toolbox for Java is a set of Java classes that allow you to
access IBM i, i5/OS, or OS/400 data through a Java program. With these classes,
you can write client/server applications, applets, and servlets that work
with data on your IBM i, i5/OS, or OS/400 system. You can also run Java
applications that use the IBM Toolbox for Java on the IBM i, i5/OS, or
OS/400 Java Virtual Machine.

The Toolbox is available as an installable licensed program for the AS/400
as of OS/400 V4R2 and the iSeries as of OS/400 V5R1. Here is a breakdown of
Toolbox releases versus operating system versions:

Toolbox Installs on Connects to
release LPP release OS/400 version OS/400 version
------- -------------- -------------- --------------
V4R2 5763JC1 V3R2M0 V3R2 and up V3R2 and up
V4R3 5763JC1 V3R2M1 V3R2 and up V3R2 and up
V4R4 5769JC1 V4R2M0 V4R2 and up V4R2 and up
V4R5 5769JC1 V4R5M0 V4R3 and up V4R2 and up
V5R1 5722JC1 V5R1M0 V4R4 and up V4R3 and up
V5R2 5722JC1 V5R2M0 V4R5 and up V4R5 and up
V5R3(*) 5722JC1 V5R3M0 V5R1 and up V5R1 and up
V5R4(**) 5722JC1 V5R4M0 V5R2 and up V5R2 and up
JTOpen 1.x Not applicable Not applicable V4R3 and up
JTOpen 2.x Not applicable Not applicable V4R4 and up
JTOpen 3.x Not applicable Not applicable V4R5 and up
JTOpen 4.0-4.2 Not applicable Not applicable V4R5 and up
JTOpen 4.3-4.7 5722JC1 V5R3M0 V5R1 and up V5R1 and up
JTOpen 4.8+ 5722JC1 V5R4M0 V5R2 and up V5R2 and up
JTOpen 6.1+ 5761JC1 V6R1M0 V5R3 and up V5R3 and up

(*) Note: Toolbox release V5R3 is equivalent to JTOpen 4.3.
(**) Note: Toolbox release V5R4 is equivalent to JTOpen 4.8.

Newer versions of the Toolbox are backwards-compatible with earlier
versions. Upgrading to a newer version is usually recommended, with the one
main exception being that the Toolbox is only supported for connection
to servers running either of the two prior releases of i5/OS or OS/400.


Why Open Source?



We have chosen to make the Toolbox code open source for the following reasons:

1. To obtain new functions and features from the Toolbox user community.

2. To respond with customer and business partners requirements as rapidly
as possible.

3. To improve the ability for our customers to build and debug their own
applications when using the Toolbox functions.

4. To continue the drive to keep the IBM i platform a leader with Java technology
for application development.

Differences between JTOpen and the Toolbox LPP



1. The initial release of the source code for JTOpen used the V4R5
Toolbox codebase. That is, the Java code in the open source repository
is the same code that was used to build the V4R5 Toolbox LPP. JTOpen 2.0x
uses the V5R1 Toolbox as its codebase. The latest release of JTOpen
(JTOpen 6.x) uses the V6R1 Toolbox as its codebase.

2. When bugs are reported, fixes will be committed to JTOpen as soon as
they are realized. When applicable, these same fixes will be committed
to the Toolbox LPP and made available in a future PTF or service pack.

3. Any new functionality that is committed to JTOpen will be subsequently
added, when applicable, into the Toolbox LPP and made available in a
future PTF or service pack.

Note: All changes to JTOpen are made under the control and at the
discretion of the JTOpen Core Team. All changes to the Toolbox LPP
are made under the control and at the discretion of IBM.

4. In general, the Toolbox LPP is supported directly by IBM. JTOpen
is supported by the JTOpen user community, in which IBM participates
and contributes, specifically through developer email, the JTOpen
mailing list, and the JTOpen web forum

5. Pursuant to the IBM Public License, programmers are free to alter the
JTOpen source code and to distribute it with their own applications.

Download and installation of JTOpen



Requirements


Briefly, the requirements for using the JTOpen code are as follows:

1. A Java Virtual Machine (JVM) with a 1.2.x or higher JDK/JRE. The JTOpen
team highly recommends moving to the latest supported release of the JDK/JRE, as
maintaining backwards-compatible code with older releases becomes
increasingly difficult to support over time.

2. Almost all JTOpen functions require a TCP/IP connection to an IBM i server.

a. The server must be IBM i, i5/OS, or OS/400 V4R3 or higher.

b. The server must have the Option 12 Host Servers installed and
running. JTOpen uses the host servers as TCP/IP endpoints to
communicate with the server from a client.

c. If the Java application using JTOpen is being run directly on a server
running IBM i, i5/OS, or OS/400, then certain JTOpen functions might use
native API and/or local socket calls to improve performance.
This will only occur under certain conditions, and only if the file
jt400Native.jar is included in the application's CLASSPATH.

3. For GUI programming, either Java 2 or Swing 1.1 or higher is required.

Files


JTOpen is comprised of the following files:

Jar file Contents
-------- --------


jtopen_x_x_source.zip This is a zip file of all the source files in the repository.
It is not a Java jar file.

jtopen_x_x_javadoc.zip This is a zip file of the javadoc (in HTML format) for
the JTOpen source files. It is not a Java jar file.

jt400.jar(*) This is the main JTOpen jar file. It contains almost all open
source code (except for the few Toolbox classes that could
not be open-sourced), including the utilities package,
and the JDBC driver (JDBC 3.0).

jt400Micro.jar(*) This contains the ToolboxME (Micro Edition) classes for
use on a handheld device.

jt400Native.jar(*) Previously known as jt400Access.zip, this jar does not
contain the vaccess package. It does contain the native
optimization classes necessary for running performance-enhanced
applications on IBM i, i5/OS, or OS/400 JVM.

jt400Proxy.jar(*) This jar contains just the classes needed to run a client
application using the Toolbox proxy server. It is
especially useful in environments where a smaller jar
is needed.

jt400Servlet.jar(*) This jar contains the html and servlet packages.

jui400.jar(*) Contains the PDML runtime packages as provided by
the Graphical Toolbox.

uitools.jar(*) Contains the GUI Builder packages as provided by the
Graphical Toolbox.

util400.jar(*) Contains various utilities.

composer.jar(*) Contains XSL stylesheet composer classes.

reportwriter.jar(*) Contains XSL report processor classes.

outputwriters.jar(*) Contains PDF, PCL, and font classes.

tes.jar(*) Contains the IBM i Graphical Debugger.

jtopen_x_x_jdbc40.zip This zip file contains versions of jt400.jar and
jt400Native.jar (along with source code) that are
compatible for use with JDBC 4.0. This zip file requires
that you be running on Java 6.0 or higher.


(*) Files contained in file jtopen_x_x.zip.


There are other jar files shipped in the download for JTOpen off of the Toolbox
downloads page. Those jar files do not (yet) contain JTOpen code. They are
provided as a convenience to the developer and to mirror the objects that ship
with the Toolbox LPP.


Building and Using JTOpen


Instructions for using JTOpen:
1. Download the JTOpen jt400.jar.
2. Add it to your CLASSPATH.
3. Run your application.

Instructions for building all or part of the as400 JTOpen source code:
Note: Complete build instructions are specified in the commentary in file
/build/build.xml
1. Download the JTOpen jt400.jar.
2. Download any source files you want to change. The src.zip file includes
all of the source in the repository for convenience.
3. Set up your CLASSPATH to include everything in the correct order:
a. Your source files should be in your CLASSPATH first. Note that you
cannot point to src.zip - you must unzip it, since it contains only
source files.
b. Next, add jt400.jar.
c. Your CLASSPATH should look something like this:
CLASSPATH=C:\jt400\MyApp;C:\jt400\jt400.jar;...
4. Compile your source.
5. Run your as400 application that uses JTOpen.

The AS/400 is Dead - All Hail The 'Smart Cube'

Ok, you got me, the as400 will never actually die. Its too good to die. But like Doctor Who, every few years, it changes. This time the metamorphasis of the as400 leaves us with something surprising. The 'Smart Cube'.

From IBM

The Smart Cube is a complete application-ready platform with all server hardware and software needed, pre-configured and ready-to-use, with no manuals required. In a few easy steps, businesses can be up and running with a complete IT solution to run their business, including the operating system, integrated middleware, database, security and back-office functionality such as file, print, backup and recovery, combined with the business application they acquired
(what does that sound like!)

IBM Smart Cube 7277

This product is available separately at a suggested retail price per system starting at $974.00/month or $31,128.00 and may also be included as part of a complete solution


IBM Smart Business Solution – Small Power 520 is a powerful and integrated server that is designed to run all of the business applications a medium sized business needs (e.g. Finance, Accounting, ERP, CRM, IP Telephony) with no IT complexity. The solution includes an IBM Smart Cube – Small Power 520 server with a 1-core Power 6 processor. The Smart Cube remains connected to IBM Smart Market which provides remotely delivered services including help desk and solution support, monitoring, backup and recovery, security and business collaboration. IBM Smart Cube comes with the pre-loaded IBM Smart Business Software Pack, including everything needed to run business applications and workloads. • Application Servers and Java support • Database Servers • Web Servers • File & Print Servers • Network & Application Security: • Directory Servers • Built-In backup and recovery • i Operating System. IBM Smart Cubes provide many serviceability and ease-of-use features designed to enhance the support experience for customers. IBM Smart Business Software Pack includes wizard-based application management and problem solving interfaces that can be extended to vendor application software prepared specifically for this environment. Customers will have the option to configure their solutions to automatically find and install new fixes. The Smart Desk, included in the Smart Cube, provides a single consistent interface to manage, license, administer, and maintain applications

IBM Smart Cubes come with pre-loaded IBM Smart Business Software Pack, pre-configured, ready to use; including operating system, middleware, database, security, backup and recovery and etc;

Business applications are pre-integrated with IBM Smart Business Integration Integrator and ready for automatic download at the customer installation, in simple steps.

The IBM Smart Cubes come with the pre-loaded security software, including firewall/VPN, Antivirus protection, web filtering, anti spam and application protection, to offer preemptive protection for the IT infrastructure for small and medium size companies.

The IBM Smart Support Team will provide a “single point of entry” into the larger IBM technical support structure, as well as into the software vendors’ support teams who handle the technical problems associated with application software.

The IBM Smart Cube provides a single interface and source for fix acquisition and deployment across Customer’s Smart Business solution.

The IBM Smart Cube uses powerful IBM server platforms. The IBM Smart Business customers can start with entry-level IBM Smart Cube and move to the advanced server platform, all with the compatible IBM Smart Business Software Pack.

Thursday, May 21, 2009

User Space APIs

User spaces are objects that used for storing user-defined information. They are permanent objects that are located in either the system domain or the user domain. They have an object type of *USRSPC and a maximum size of 16MB. You can save and restore user spaces to other systems. If, however, the user spaces contain pointers, you cannot restore the pointers even if you want to restore them to the same system.

You can use the user space APIs to:

Create user spaces to be used by list APIs to generate lists of data.
Store pointers.
Store large amounts of data. You can create a user space as large as 16 megabytes. You cannot create a data area larger than 2000 bytes.
Save information in user space objects, and save and restore the object with the information in it using CL commands.
Pass data from job to job or from system to system.

Note: If the allow user domain (QALWUSRDMN) system value contains only the QTEMP library, you can use only the user space APIs to create and manipulate user domain spaces in library QTEMP. You cannot use the Retrieve Pointer to User Space API

The user space APIs allow you to create and delete user spaces, change and retrieve the contents of user spaces, and change and retrieve information about user spaces.

For additional information, see Using User Space APIs.

The user space APIs are:

Change User Space (QUSCHGUS) changes the contents of a user space.

Change User Space Attributes (QUSCUSAT) changes the attributes of a user space object.

Create User Space (QUSCRTUS) creates a user space.

Delete User Space (QUSDLTUS) deletes user spaces created with the QUSCRTUS API.

Retrieve Pointer to User Space (QUSPTRUS) retrieves a pointer to the beginning of a user space for a high-level language (HLL) that supports pointers. HLLs that support pointers can use this pointer to manipulate the contents of a user space directly.

Retrieve User Space (QUSRTVUS) retrieves the contents of a user space. It does not retrieve descriptive information about the user space, such as its size.

Retrieve User Space Attributes (QUSRUSAT) retrieves information about creation attributes and current operational statistics of the user space, such as its size.

Sending and receiving email on i5/os - QtmmSendMail

i5/os QtmmSendMail API

The i5os Send MIME Mail (QtmmSendMail) API lets you to send email from a HLL program and lets you send multiple mail attachments at one time

http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/rzair/rzairsendmime.htm

Using the QtmmSendMail API

os400 - i5os - API Finders

Use the os400 / i5os API finders to find documentation operating system APIs and some APIs for related licensed programs,by category or by name

V6R1 API Finder

V5R4 API Finder

V5R3 API Finder

Striving for Optimal Journal Performance on DB2 Universal Database for iSeries

http://www.redbooks.ibm.com/abstracts/SG246286.html?Open

Journaling is an inherent feature of OS/400 on the iSeries that has been around since the early releases of the System/38. The system employs journals to ensure data integrity and recoverability and this support can further be extended to reduce the duration of an abnormal system end. Journaling also serves as the cornerstone upon which many data replication and data warehouse refresh schemes are built.
The aim of this IBM Redbook is to provide you with an understanding of the factors which influence journal performance on the iSeries and to help you identify which hardware options and software settings you can employ to minimize this impact. We will also share with you some ideas on how to minimize the impact of journaling on your iSeries from an application point of view.
We also explain the remote journal function on the OS/400, which offers a reliable and fast method to transfer journal entries to a remote iSeries server. We performed tests concerning remote journal performance and tested this function in different environments

Raz-Lees new whitepaper - Achieving PCI Compliance with IBM Power i

Check out Raz-Lees new IBM i white paper - Achieving PCI Compliance with IBM Power i.

PCI-DSS consists of 12 requirements within six categories which cover best security practices. This white paper includes a summary of PCI requirements, focusing on the relevant items to Power i security. Each requirement is followed by a guideline specifying how to actually implement the requirement


http://systemisecurity.wordpress.com/2009/05/20/new-white-paper-pci-compliance-with-ibm-power-i/

as400 api - Process Commands (QCAPCMD) API

The as400 Process Commands (QCAPCMD) API is used to check or run CL commands from HLLs as well as check syntax for specific source definition types

You can use the QCAPCMD as400 API to:

Check the syntax of a command string prior to running it
Prompt the command and receive the changed command string
Run a command from an HLL

An advantage of using QCAPCMD over QCMDEXC is the exception handling. An exception that occurs when using QCAPCMD command is trapped and notified via the QUSEC structure. The error is not passed up the call stack so can be handled gracefully in programs.

ILE RPG Example of QCAPCMD API

RPGLE:

fnewfile   if   e           k disk    usropn 
dcommand          s             40    inz(' ') 
dcmdlng           s             10i 0 inz(40) 
docb              ds 
d type                          10i 0 inz(0) 
d DBCSdh                         1    inz('0') 
d prompt                         1    inz('0') 
d cmdsyntax                      1    inz('0') 
d msgrtvkey                      4    inz(x'00000000') 
d reserve1                       9    inz(x'000000000000000000') 
docblength                      10i 0 inz(x'00000014') 
docbfmt                          8    inz('CPOP0100') 
dchgcmd                          1    inz(' ') 
dlngchgcmd                      10i 0 inz(0) 
dlngchgrtn                      10i 0 inz(0) 
d/COPY QSYSINC/QRPGleSRC,QUSEC 
d qused01                17    116 
c                   eval      command = 'OVRDBF NEWFILE SHARE(*YES)' 
c                   Z-ADD     116           QUSBprv 
c                   call      'QCAPCMD' 
c                   parm                    command 
c                   parm                    cmdlng 
c                   parm                    ocb 
c                   parm                    ocblength 
c                   parm                    ocbfmt 
c                   parm                    chgcmd 
c                   parm                    lngchgcmd 
c                   parm                    lngchgrtn 
c                   parm                    QUSEC 
c     QUSBavl       ifgt      0 
c     'Error on API'DSPLY 
c     qusei         dsply 
c                   end 
c                   open      newfile 
c     *loval        setll     fmt1 
c                   read      fmt1                                   30 
c     *in30         ifeq      '0' 
c     fld1          dsply 
c                   else 
c     'No Records'  dsply 
c                   end 
c                   close     newfile 
c                   eval      *INLR = '1' 

DDS for newfile: 

R FMT1                               
FLD1          10                   
FLD2          10                   
K FLD1  

More as400 Command API examples to follow

AS400 API - QCMDEXC - Execute Command

The Execute Command (QCMDEXC) program is an ibm as400 API that runs a single command.

The command runs as if it was not in a program. Therefore, variables cannot be used on the command because values cannot be returned by the as400 command to CL variables. Additionally, commands that can only be used in CL procedures or programs cannot be run by the QCMDEXC program. The format of the call to the QCMDEXC program is the following:

CALL PGM(QCMDEXC) PARM(command command-length)

Enter the command you want to run as a character string on the first parameter. You must specify the command library.

CALL PGM(QCMDEXC ) PARM('QSYS/CRTLIB LIB(TEST)' 22)

Remember that you must enclose the as400 command in single quotation marks if it contains blanks. The maximum length of the character string is 6000 characters; never count the delimiters (the single quotation marks ) as part of the string. The length that is specified as the second value on the PARM parameter is the length of the character string that is passed as the command. Length must be a packed decimal value of length 15 with 5 decimal positions

Example of Using QCMDEXC in an RPGLE Procedure

d Quote           C                   Const(X'7D')   
d StdCmd          S            200A                 
d StdLen          S             15P 5               

D Execute         PR                  ExtPgm('QCMDEXC')             
D     CmdStr                          Like(StdCmd)                 
D                                     Options(*VarSize)             
D                                     Const                         
D     CmdStrLen                       Like(StdLen) Const           
D*    IGCPrcCtl                  3    Options( *NoPass )           
D*                                    Const                         
*--------------------------------------------------               
d var1            S                   Like(StdCmd)                 
d var2            S                   Like(stdLen)                 
d                                     Inz(%size(var1))             

c                   eval      var1 =                               
c                             'CPYTOSTMF' + ' ' +                   
c                             'FROMMBR(' + Quote +                 
c                             '/QSYS.LIB/LIBNAME.LIB' +           
c                             '/QRPGLESRC.FILE/RPG1.MBR' +   
c                             Quote + ') ' +                       
c                             'TOSTMF(' + Quote +                   
c                             '/home/test.txt' +       
c                             Quote + ') ' +                       
c                             'STMFOPT(*REPLACE)'                 

c                   callp     Execute(var1:var2)                   

c                   eval      *inlr = *on

Another example of using QCMDEXC to execute CL commands

*                                                         
d CmdLength       s             15  5                      
d CmdString       s            256                         
 *                                                         
 * Procedure calls                                         
 *                                                         
d Command         pr                  EXTPGM('QCMDEXC')    
d  CmdString                   256                         
d  CmdLength                    15  5                      
 *                                                         
c                   eval      *inlr = *on                  
   //=========================================             
   //  *inzsr - One time run subroutine.                   
   //=========================================             
                                                           
 /free                                                     
   begsr *inzsr;
                                           
   cmdstring = 'dlyjob 10';                                
   cmdlength = %len(%trim(cmdstring));                     
   command(cmdstring : cmdlength);     
                    
   endsr;                      
 /end-free

* Procedure calls
      *
     d RUNCOMMAND      PR                  extpgm('RUNCOMMAND')
     d   CmdString                   30

     d RUNCOMMAND      PI
     d   CmdString                   30
      *
     d Command         pr                  EXTPGM('QCMDEXC')
     d  CmdString                    30
     d  CmdLength                    15  5
      *
      * Definitions
      *
     d CmdLength       s             15  5

      *
     c                   eval      *inlr = *on
        //=========================================
        //  *inzsr - One time run subroutine.
        //=========================================

      /free
        begsr *inzsr;
        cmdlength = %len(%trim(cmdstring));
        command(cmdstring : cmdlength);
        endsr;
      /end-free

QCMDEXC could also be called from CL , for instance to run a command dynamically when certain parameters that would be required are not know at run time. In this case calling QCMDEXC from a CL program would be an option. See the QCMDEXC snippet below

CHGVAR     VAR(&CMD) VALUE('CHGLIBL LIBL(' *CAT &LIBL +   
                          *TCAT ')')                                   
             CALL       PGM(QCMDEXC) PARM(&CMD &LEN) 

Managed as400 hosting

More examples of Using QCMDEXC in an as400 RPGLE Procedure to follow.

Wednesday, May 20, 2009

Managed AS400 Hosting

AS/400 & iSeries Managed Hosting

All these companies offer either management or monitoring as detailed below

iSeries Managed Hosting:
Their iSeries (AS/400) server(s) managed and located in their Data Center

iSeries Managed Collocation:
Your iSeries (AS/400) server(s) managed and located in our Data Center

iSeries Remote Monitoring & Management:
Your iSeries (AS/400) server(s) located in your Data Center, managed remotely by them

US.

Connectria offers iSeries managed hosting including managed services for AS/400, eServer & IBM System i

http://www.connectria.com/as400_hosting.asp


iseries leasing uk

More Managed as400 hosting details to follow...

IBM Announces Replacement for i5/OS

Rochester MN - With the recent announcement of the new IBM Power Systems which will replace the System i hardware, the i5/OS will also be replaced and renamed. Because of the much greater capabilities of the new operating system, IBM has named it the Virtual Universe Operating System – VU/OS.

Running under VU/OS, the individual user appears to have not merely a machine of their own, but an entire universe of their own, in which they can create or remove their own programs, databases, libraries, users, networks, and planetary systems. They need only specify the universe they desire, and the VU/OS system generation program (QGOD) does the rest. This program will reside in the QSYS library. The minimum time for this function is 6 days of activity and 1 day of review. In conjunction with VU/OS, all system programs have been replaced by one program (QPROPHET) which will also reside in the QSYS library. This program has no parameters as it knows what you want to do when it is executed


From http://mid-deranged.com/2009/03/07/ibm-announces-replacement-for-i5os/

Tuesday, May 19, 2009

AS400 API - Retrieve Network Attributes (QWCRNETA)

The Retrieve Network Attributes (QWCRNETA) as400 API lets you retrieve network attributes

Infocenter

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/apis/qwcrneta.htm

Network Attributes
ALRBCKFP Alert backup focal point    
ALRCTLD         Alert controller    
ALRDFTFP Alert focal point    
ALRFTR         Alert filter    
ALRHLDCNT Alert hold count    
ALRLOGSTS Alert logging status    
ALRPRIFP Alert primary focal point    
ALRRQSFP Alert focal point to request    
ALRSTS         Alert status    
ALWADDCLU Allow add to cluster    
ALWANYNET Allow AnyNet support    
ALWHPRTWR Allow HPR tower support    
ALWVRTAPPN Allow virtual APPN support    
VRTAUTODEV Autocreate APPC device limit    
DDMACC         DDM request access    
DFTCNNLST Default ISDN connection list    
DFTMODE         Default mode    
DFTNETTYPE ISDN network type    
DTACPR         Data compression    
DTACPRINM Intermediate data compression    
HPRPTHTMR HPR path switch timers    
JOBACN         Job action    
LCLCPNAME Local control point    
LCLLOCNAME Local location    
LCLNETID Local network ID    
MAXINTSSN Maximum sessions    
MAXHOP         Maximum hop count    
MDMCNTRYID Modem country or region ID    
MSGQ         Message queue    
NETSERVER Server network ID    
NODETYPE APPN node type    
NWSDOMAIN Network server domain    
OUTQ         Output queue    
PNDSYSNAME Pending system name    
PCSACC         Client Access    
RAR         Addition resistance    
SYSNAME         Current system name

More as400 commands to follow

The Laughing Boardroom video...a real world example!

I posted the laughing boardroom video, an old IBM ad that highlights the infrastructure and manpower changes needed when moving away from the as400 platform, as so much is simple and/or automated.

The Laughing Boardroom

Well I have actually stumbled across a real world example. John Will describes what happened when consultants convinced a utility company that they needed to move from iseries to pseries

http://www.johnmwillis.com/other/the-laughing-boardroom-ibm-eserver-iseries/

This regional, rather large, utility company had been running AS/400 for twenty years with a minimal staff. In fact the current CTO was one of the original AS/400 operators and prior to about a year ago he could have still filled in as an operator in a pinch. Other than some simple web front-ends they basically ran one production box that did all their customer care and billing services. About two years ago a team of consultants were brought in to re-deign their customer care and billing systems. The initial design took them from one production AS/400 (they called it a mainframe) to about 10 P5 physical boxes with about 50 lpars of which about 20 lpars eventually became the replacement solution. On the software side they went from a single box that basically handled everything to a very complex infrastructure

After the army of consultants had completed the project (over a year) this utility company went from 3 system administrators to about 10 system administrators and they were still understaffed. They also increased head counts for 2 system architects and a project managers. Of course at least three new managers had to be hired. All told they went from a staff of about 5 (including CTO and operations) to a staff of about 20

L3 Cache Makes All The Difference For Java Apps on IBM i

Timothy Prickett Morgan is talking about the performance of the latest Power6+ system i boxes, and benchmark testing of SAP and Lawson products.

http://www.itjungle.com/tfh/tfh051809-story06.html

A couple of interesting thngs emerge...

One is that in these tests there was very little diference in performance between a 550 and a 570

A Power 520 with a single Power6+ processor with two cores running at 4.7 GHz equipped with 32 GB of memory was able to process 41,090 query navigation steps per hour on the BI-MXL test at 94 percent of CPU utilization on a data warehouse with 300 million records. (That's the smallest database used in the test, which also has 1 million and 3 million record variants.) A Power 550 with two processors and four cores activated running at 5 GHz and with 64 GB of memory was able to handle 90,635 query navigation steps per hour at 98 percent of CPU; for some reason, IBM ran the test again on this box a few weeks later and got a slightly lower 97 percent CPU utilization and only handled 90,492 query navigation steps per hour. (Go figure.) A Power 570 box with four 5 GHz cores and 96 GB of memory did slightly more work, at 93,468 query navigation steps per hour.
The message here is what I have been telling you for years: Don't buy into the Power 570 unless you have to. It is more expensive for modest workloads than a Power 550. If you don't need the expansion that the Power 570 embodies, don't do it


The other was that L3 cache is very important for java app performance

On the M3 tests, Lawson found that the initial Power 520 using that old 1.9 GHz Power5 chip could process about 75,000 invoiced order lines per hour. Moving up to the 4.2 GHz Power6 core boosted performance by 31 percent (not more than 2X as you might expect from the clock speeds because IBM radically changed the instruction pipelines with the Power6 chips), to around 98,250 invoiced order lines per hour. And while the move to the Power6+ chip only boosted the clock speed by 11.9 percent up to 4.7 GHz, the addition of the L3 cache pushed performance up 21 percent to 118,900 invoiced order lines per hour. Which makes you wonder why on Earth IBM ever cropped the L3 cache out of the boxes to artificially crimp performance on the Power 520s and the JS12 and JS22 blades in the first place. That's not a smart move if you are trying to support Java applications

PHP on the as400

Timothy Prickett Morgan discusses the increasing use of PHP on System i.

http://www.itjungle.com/tfh/tfh042009-story01.html

After a year of work in the wake of the alliance, Zend and IBM started shipping a beta version of the Zend Core for i5/OS, which ran in the PASE AIX runtime environment inside i5/OS V5R4. In August of 2006, Zend Core for i5/OS became generally available and in a short time, there were thousands of downloads of the software, which IBM picked up the tab for on behalf of V5R4 shops that wanted to download a PHP engine and integrate it with their i boxes. IBM gave out statistics for downloads every couple of months, but since the creation of the Power Systems division, which converged the System i and System p lines last April, IBM has been pretty mum in terms of Zend Core for i downloads. The latest number that I have heard is that there have been 12,000 cumulative downloads of Zend Core for various i platforms, including machines running OS/400 V5R3, i5/OS V5R4, and i 6.1

According to this Gartner data, the vast majority of PHP developers in 2007 were part-time developers and hobbyists, with a small number of corporate PHP developers. But by 2013, Gartner expects there to be millions of professional PHP developers at software vendors and in IT shops, with the base of hobbyists and part-timers being about the same. And we all know who is going to be spending money on PHP tools, creating real-world, enterprise-class PHP applications, and making a living from PHP