04
Mon, Nov
6 New Articles

ASCII and the AS/400: Bringing Them Together

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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 company’s 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 computer’s 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 computer’s runtime environment doesn’t 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 doesn’t 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 isn’t 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 world’s largest vendors of business software, SAP AG’s 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/400’s 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)


BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: