04
Mon, Nov
5 New Articles

Diploma/C

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

ASNA's C Compiler produces much faster programs than does IBM's C.

by Lance Gillespie

Amalgamated Software of North America (ASNA), noted for their excellent RPGIII compiler for the System/36, has introduced a C compiler for the AS/400. ASNA's DIPLOMA/C is not the first C compiler for the AS/400 (IBM beat them by a few weeks) but it is the first to resolve external function calls at compile time, which, as we will see later, is a major performance advantage.

The first question that comes to mind is "Who would use C on an AS/400?" Sure, maybe some PC bigot or UNIX nerd who doesn't know (and therefore scoffs at) the joys of RPG, but what self-respecting IBM midrange professional would want to dirty his keyboard using a language that is famous for producing "write only" code and crashing in ways that RPG and COBOL don't even have ("uninitialized pointer", "memory allocation error" - what are those?). Well, there are a couple of reasons we should be interested in this development. C provides a lot of features that RPG lacks that make programming easier, such as string handling, multi-dimensional arrays, extensive math functions, and a free-format syntax that makes for more readable program listings. C is taught in virtually all computer science curricula so there is a larger pool of formally trained C programmers than RPG programmers. The C language is not controlled by a single vendor in the way RPG is controlled by IBM, so there is some competition among compiler vendors. This results in better compilers, more features, and (sometimes) lower prices. The nature of C is such that third- party vendors can sell pre-tested routines (such as date routines, math routines, or screen design aids) for inclusion in your programs. This lessens the amount of work you have to do and makes coding more productive.

Even if you do not use C yourself, the existence of a C compiler on the AS/400 may still change the way you do things. There are any number of data processing tools (spreadsheets, word processors, program editors, relational data base managers, documentation aids) written in C and available on other platforms. No doubt some of these will be ported to the AS/400, thus widening the range of choices available in each product category.

Documentation

DIPLOMA/C comes with two 8-1/2 x 11", 3-ring-punched unbound manuals, a 53- page Reference Manual, and a 182-page User's Guide. The Reference Manual contains the installation instructions and an overview of the steps and commands required to enter, compile, and link a C program.

The User's Guide contains a detailed explanation of the structure of a C program; it covers how to declare variables and functions, how to use the operators and create expressions, how to use statements to control the program flow, and gives a description of each of the 160 library routines, including the purpose, syntax, use, and return value for each routine.

The documentation seems a bit sparse, especially compared to the massive, multi-volume tomes we've come to associate with the AS/400, but it is readable and accurate. ASNA assumes throughout that you are already familiar with C and just want to know how this C does things. If you do not know C, they direct your attention to some suggested reading. Even though they are making no attempt to provide a C tutorial, the documentation could use more code examples. Still, the overall quality of the documentation is very good.

Installation

Installation is about as easy as it could be. Just put the cartridge (or diskette) in, restore the INSTALL command, and run it. The INSTALL command creates a library called DIPLOMAC and adds some program objects to the QSYS library. The compiler requires 1.7MB of disk storage. ASNA gets high marks for their well thought-out installation program.

Using DIPLOMA/C

A C program consists largely of subtasks called function calls. Everything from printing or displaying a character to sorting an array is done via a function call. Some functions come with the compiler, some are purchased from a third party, and some are written by the programmer. Once a function is written, other programs can use it simply by calling it. In RPG, program calls are made at run time, which causes some overhead because the system has to find the called program and check parameters each time the program is called. This is not usually a problem, because calls are not a big part of most RPG programs and the called program could be converted to a subroutine if performance suffered too much. If a C compiler worked that way (and IBM's does) the system would spend most of its time finding programs and checking parameters. This is why IBM does not recommend using their C compiler in performance-critical applications. DIPLOMA/C allows you to join all of your functions into a single program when you link.

Creating a program with DIPLOMA/C is a three-step process. First, create a source member for each of the program's parts, using SEU. Then compile each source member using the Create DIPLOMA/C Translation Unit (CRTDCTU) command. This command checks the source code and creates a relocatable intermediate object called a translation unit, which is stored in a data area object (*DTAARA type). Then link all of the translation units together using the Create DIPLOMA/C Program (CRTDCPGM) command. This command finds all of the translation units, makes sure all the parameters on the calls match, and creates a program which can then be run.

This process is well-documented in the manual. The error messages are fairly self-explanatory, which is good because ASNA followed IBM in not providing a separate error message manual. SEU does not have on-line support for C the way it does for RPG, and you have to write your own user- defined options in PDM for the CRTDCTU and CRTDCPGM commands, but on the whole it works smoothly.

Functionality

The AS/400 is fundamentally different from the kind of machine for which C was developed. C deals with I/O in streams (an unstructured string of data that must be broken into fields and records by the program) and the AS/400 deals with I/O as externally described records in files. In order to be compatible with other C compilers, DIPLOMA/C tries to emulate stream I/O, but programs that use I/O don't act in quite the way expected by people familiar with C on other platforms. The documentation explains this and basically says you have to live with it - there is no way around this artifact of the AS/400. The area where this will make the biggest difference is in the design of interactive programs. Programmers usually have access to each keystroke as soon as the user enters it, but on the AS/400 keystrokes are not returned until the user presses enter or a function key. This makes it impossible to port some of the razzle-dazzle features of PC programs over to the AS/400.

Within the above limitations, DIPLOMA/C supports most of the functions required by ANSI, and so if you view it as an implantation of C, it is about as complete as you could expect. However, viewed as an AS/400 programming tool, it has a few limitations. First and foremost, it does not support externally described data, display, or printer files. You can use them, but you have to have internal descriptions and you have to modify those descriptions every time the file changes. ASNA said they intend to provide externally described file support in a later release, but going back to internally described files is a giant step backward for anyone accustomed to the AS/400. Another problem is that program file size is about twice that of equivalent RPG programs. This could be a problem in undersized AS/400's (which seem to be most of them). The program's size problem can be overcome via a process called dynamic linking and binding, which is covered in the manual, but dynamically linked programs seem to use a bit more resources and run more slowly.

Conclusions

Overall, ASNA's DIPLOMA/C is a solid product, worthy of their reputation and a good implementation of C. It seems to be more focused on compatibility with other computers than on exploiting the unique data processing capabilities of the AS/400, but it may provide more access to those capabilities in a later release.

-------------------------------------------------------------------------------

DIPLOMA/C

Amalgamated Software of North America

Inc. (ASNA)

42011 Big Bear Blvd.

P.O. Box 1668

Big Bear Lake, CA 92315

ASNA (800) 321-ASNA

Phone: (714) 866-9000

FAX: (714) 866-9009

Europe (UK) 483-570-666

Canada (416) 792-6900

Hardware: AS/400

List Price: Tiered pricing from $2000 to $8000 depending on model size.

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: