The 21st century has opened with the biggest technology revolution ever. Newer, better, and faster technology appears nearly every day. As computers, cell phones, appliances, and other devices perform more and more tasks, it seems as if every activity can somehow be automated to make life simpler. However, with all of this technology aiming to simplify tasks, many things still remain quite complicated and complex. Nowhere is this more evident than within the hardware and software industries. Businesses are faced with the daunting task of choosing the correct solution for their needs; perhaps an even more difficult task is to integrate the technologies that are chosen. One system, however, does not seem to be following this trend. The IBM AS/400 is known for its reliability, security, and ease of use, but sometimes overlooked is the newer and better technology that has been seamlessly integrated into this midrange computer throughout its life.
Pushing the Limits with ASCII
As companies begin to embrace e-business, information service departments are pushed to the limit. The rush to transform a companys traditional methods of business to new e- business methods often requires integrating new resources with existing resources. This usually means integration to include new software, new hardware, or a combination of both. One thing remains certain: The quicker the process takes place (without sacrificing quality), the better. A rapid-deployment environment drives the need for software to be altered or ported so that it will run on multiple platforms. Porting provides an alternative to totally rewriting a software application to run on a platform for which it was not originally designed. When porting, the code is modified so that it can run on a different operating system platform. Though less work than totally rewriting the software, porting can still be a large job. ASCII C/C++ Run Time for the AS/400, available for OS/400 V4R4x and higher, can improve and simplify the porting of software to the AS/400. ASCII C/C++ Run Time for the AS/400 is offered as an IBM Programming Request for Price Quotation (PRPQ), instead of a Licensed Program Product (LPP). As such, it is not translated and is offered as English-only. The product number is 5799-AAS, and the product is available through regular IBM distribution channels. It is a supported product, and PTFs will be provided if necessary.
ASCII C/C++ Run Time is based on a porting strategy that allows an application to run with an ASCII code page on the AS/400, which utilizes an EBCDIC code page. A code page is used to define the symbols and characters that are used for output. Each symbol has a corresponding numerical value defined in a code page. Different code pages exist that may use a different value for a particular symbol. Two common encoding schemes used by code pages are ASCII and EBCDIC. Most personal computers and UNIX systems use an ASCII encoding scheme or code page, while the AS/400 and many mainframe computers use an EBCDIC encoding scheme or code page. When porting an application from a PC or UNIX platform to the AS/400, the differences in ASCII and EBCDIC code pages must be considered.
Most applications can be compiled and run on the AS/400 using an ASCII code page. If an application needs to interface with an EBCDIC device such as the terminal or the operating system, a timely and sometimes clunky conversion from ASCII values to EBCDIC values must take place. An EBCDIC-to-ASCII conversion is also necessary for input received from an EBCDIC device. ASCII C/C++ Run Time for the AS/400 provides an integrated layer between an ASCII application and an EBCDIC interface. Invisible to the user, this product determines whether conversions are necessary and then performs the operation quickly and efficiently, minimizing drag on performance. The average user cares little about code pages, as long as the information produced by the application is displayed legibly. This means that the characters displayed to the terminal are in a familiar form, namely, the characters of their alphabet.
Not only are the processes carried out by ASCII C/C++ Run Time transparent to the user, but, if implemented correctly, this product should be nearly transparent to the developer. One of the principles in the design of this product is the minimization of impact on developers, thus reducing the porting effort. Correct implementation can eliminate a majority of code changes as related to code page conversions.
Shipped with ASCII C/C++ Run Time are various header files and AS/400 service programs. The header files have identical names to many of the standard runtime header files, such as stdio.h and stdlib.h. It is important to note that the ASCII C/C++ Run Time header files do not replace any of the standard header files; those file are still necessary for a successful compile. During the build process, the ASCII C/C++ Run Time header files must be included before any existing header files with the same name. Depending on your environment, this can be accomplished by changing your library list if you are on an AS/400 or changing your search path if you are doing a PC or UNIX cross-compile. A service program, which contains the conversion routines, is then bound to the application at compile time. If the build process is set up correctly, very few, if any, changes will need to be made to the existing code. Porting your application could be as simple as recompiling the code using ASCII C/C++ Run Time for the AS/400.
Runtime Runaround
The need for a product like ASCII C/C++ Run Time for the AS/400 stems from existing limitations of computers and, more specifically, a computers runtime environment. Computers can be extremely useful tools, but the fact remains that they still must be told exactly what to do. This takes place at many levels, from the user typing commands at the keyboard to the zeroes and ones that make up the machine language. When running a program, instructions found in the runtime are carried out with little regard for the code page of the output or input devices. As long as an operation is legal, the program will run; if a program produces ASCII values, and those values are output to an EBCDIC terminal, the characters displayed will not be useful or legible. A computers runtime environment doesnt take into consideration the code page of the application or the code page of the devices used for input or output, as long as the instructions can be carried out. A user, on the other hand, is only interested in the output and generally doesnt care how the instructions are carried out. ASCII C/C++ Run Time for the AS/400 acts as an interface
layer to ensure that the output being displayed is in a form that is useful to a user. ASCII C/C++ Run Time is not a replacement for the existing C/C++ run-time, but rather an extension. The existing runtime is still an important aspect of running an application using ASCII C/C++ Run Time. The following compilers and their runtime environments are currently supported: the AS/400 ILE C compiler, the IBM VisualAge cross compiler, and the native AS/400 C++ compiler (available as a PRPQ).
Operating between an application and the existing runtime, two steps are carried out to ensure accurate results. The first step, filtering, determines whether conversion is necessary. The second step, translation, is carried out only after the filtering process deems it necessary.
The filtering process determines which output should be translated and which output should be left as is. When running an ASCII application on the AS/400, the output will always be ASCII unless converted.
However, it is not always necessary for the output to be converted. An example would be data written to the database or files that are ASCII; this data should remain in ASCII. Conversion becomes necessary when data is sent to an EBCDIC device, such as the terminal, for user interaction or when performing certain operating system tasks such as opening a file. The filter layer considers where the output is going or where the input is coming from to determine whether conversion is necessary. This strategy of selective translation reduces the number of conversions that take place and helps improve performance by ensuring that conversions are kept to a minimum.
After the filtering process, translation takes place. To provide fast translation each time, a table is automatically created that maps one code page value to another. These tables are stored as permanent objects on the AS/400. Once tables have been created, conversion is very efficient. For functions that only check for certain values (such as isalpha() and isalnum()), conversion isnt necessary. These functions only check for the value of certain characters. In this case, the functions are actually replaced by the ASCII C/C++ Run Time functions. The majority of the runtime functions, however, are not replaced by ASCII C/C++ Run Time. In fact, the product is quite dependent and utilizes the existing runtime. ASCII C/C++ Run Time determines which code page should be used, makes the conversion, and then passes the converted values to the existing runtime in order for the required action to be carried out. Of course, conversion may be bypassed if the filter layer determines that it is unnecessary.
ASCII and Performance
When making conversions from EBCDIC to ASCII or vice versa, effects on performance are always a concern. Conversions are carried through the use of macros instead of a function call. This eliminates extra overhead. Mapping tables are also stored as permanent objects on the AS/400 to increase the performance of the conversion. Using ASCII C/C++ Run Time can increase your performance over other conversion routines such as iconv() when converting short strings numerous times.
One company that is currently implementing this technology is SAP AG. One of the worlds largest vendors of business software, SAP AGs products have been implemented by many businesses throughout the world. In a joint project between SAP and IBM, ASCII C/C++ Run Time for the AS/400 is used to provide Asian language support for the mySAP.com product running on the AS/400. This solution allows mySAP.com to run on the AS/400 with an ASCII code page and utilize the AS/400s advanced Unicode database technology. To enable mySAP.com to run using an ASCII code page, the mySAP.com kernel was changed somewhat and then recompiled using ASCII C/C++ Run Time for the AS/400. The application can then run on the AS/400, producing ASCII data, yet still interface in EBCDIC if necessary.
Although each porting project is different, and different strategies can be implemented, it may be necessary to run an ASCII application on the AS/400. If this is
your strategy, ASCII C/C++ Run Time for the AS/400 is a product that can provide an excellent solution. Through the filtering and translation processes, data is converted as necessary. Output that should be EBCDIC is translated to EBCDIC, and output that should remain ASCII will remain ASCII. The same is true for input; conversion takes place only when necessary.
One computer may never be able to implement all of the technology or do all of the tasks. Some computers, however, are better positioned to take advantage of available technologies and solutions. Even when software is written for other platforms, the AS/400 has proven that it is a capable machine that can be depended on to run mission-critical operations time and time again. ASCII C/C++ Run Time for the AS/400 is a tool that allows the AS/400 to accomplish the tasks that it has done so well for so long.
REFERENCES AND RELATED MATERIALS
ASCII C/C++ Run Time for the AS/400 home page: http://as400.rochester.ibm.com/developer/factory/asciirt/index.html
Asian Language Support for mySAP.com on IBM AS/400, press release, May 2000 (available at www.iseries.ibm.com/news/mysap)
LATEST COMMENTS
MC Press Online