Stop Limiting Yourself to 10 Character Field Names in RPG Files

At POWERUp18 this May, someone asked me “When will RPG’s native file access support long names from databases and display files?” The answer is: it already does and has for quite some time! Originally it required reading into data structures, but that’s not even true anymore. Today, RPG’s native file access fully supports long names!

Since having that conversation, I’ve been asking around. It seems that not many RPGers know about this very useful feature. So in today’s post, I’ll show you how it works.

What I Found Out When Asking Around

I didn’t do any sort of official survey, and these statistics weren’t achieved scientifically, but…while I was informally asking around, here’s what I discovered:

  • “Everyone” knows you can create column (field) names longer than 10 characters using SQL
  • “Everyone” knows you can read, insert, update and delete using long field names in SQL
  • About half of the people know that DDS also supports long field names
  • About 25% thought RPG could use long names if you use data structures for I/O
  • Only a few people (maybe 5%) knew RPG supports long names without data structures

We can do it with or without data structures! The data structure support has been around for a long time, and perhaps that’s why more people are familiar with it. (But, it can be awkward to code.)

The ability to use long names without data structures was added in 2014. If you have the latest PTFs for RPG on IBM i 7.1 or 7.2, then you have this support already. It was also included in the RPG compiler that was shipped with IBM i 7.3 in 2016. If you’re running 7.3, PTFs aren’t even needed.

Defining Tables with Long Names in SQL

Defining a field name longer than 10 characters is very natural in SQL. You simply define your table with a statement like this:

What may not be obvious, however, is that when a field is longer than 10 characters, there are actually two names assigned to it. The regular “column name” and what SQL refers to as the “system name”, which is limited to 10 characters for compatibility with older tools like CPYF, OPM languages or CL programs. In the above example, the system will generate names like CUSTO00001 for CUSTOMER_NUMBER and COMPA00001 for COMPANY_NAME.

Since there are still a lot of places where you might want to use the shorter system names, I recommend explicitly naming them. That way your short names can be meaningful. For example:

When you are working on modernizing your databases, this dual-name approach is really handy because it lets you keep the old, short (and often ugly) names that you’ve always used, keeping the files compatible with older programs. New programs can use the longer names and be more readable. Eventually, you can rewrite all the programs to use the long names, so this is a great tool for modernizing!

Long Names in DDS (Including Displays and Printers!)

DDS also supports long names using the ALIAS keyword. The name “alias” makes sense if you think about it, since any time you have a field longer than 10 characters, there are two names and either can be used. In other words, they are aliases for each other.

The DDS equivalent would be coded like this:

Mind you, I don’t recommend defining your new physical files using DDS, but for existing files, it may be easier to simply add the ALIAS keyword than to re-do the file using SQL.

Another reason why it’s important to know about the ALIAS keyword in DDS is because it also supports externally defined display, printer and even ICF files. Since all of these types of files support long names and have a great mechanism for backward compatibility with programs that must use short names, there’s no reason not to take advantage of this!

Long Names in RPG Programs

Like DDS, RPG uses the term “alias” when referring to long names. Starting with IBM i 7.1, RPG was able to use this long name support in qualified external data structures. This original support also required you to qualify the record format names (by using the QUALIFIED keyword on the F-spec) because without this keyword, RPG generates input specs. At the time 7.1 was released, I-specs did not support long names.

This support that shipped with 7.1 could be somewhat awkward. For example, the code to update the last paid date for customer 1000 would look like this:

I found this awkward because you had to use separate data structures for input and output (though, a PTF was released later that relaxed that rule) and you had to qualify both the field and record format names. I don’t know if everyone agrees, but I found that cumbersome!

The 2014 update added full support for long names, without any need to use data structures at all! So, if you’re up-to-date on PTFs and are running IBM I 7.1 or newer (which you really should be), you can do this instead:

Naturally, the alias keyword works in free format code as well. Here’s an example:

Don’t forget that alias support extends to display files and printer files, too!  There’s no reason to use short cryptic field names anymore. Take advantage of the long ones. You’ll love it!

How Blockchain Is Relevant to Modern Business

It’s a digital world, and we’re all throwing around terms like “bitcoin” and “cloud computing” without really understanding what’s going on behind the scenes. But these background details are exactly what’s revolutionizing modern industry. Blockchain is one of these critical background features.

What is Blockchain?

Blockchain is a technology that has arrived to shake up digital records as we know them. A type of database, blockchain contains each record, transaction or dataset within a single block, linking all of these blocks to each other with a peer-to-peer network. Each block is dependent on the one before it, and therefore no block can be retroactively edited without drastically editing the rest of the chain, an impossible task.

This is critical because the ledger is both public and completely secure, making it ideal for storage of medical records, monetary transactions or account details. Bitcoin was the first to successfully integrate a blockchain and triumphantly solved the double spending problem (in which a digital currency file is duplicated and counterfeited).

Blockchain Revolution

Currently, the most promising applications of the blockchain are finance applications such as digital wallets and identities. Banks and digital transaction providers would benefit from cutting out middle men, and users would place greater trust in a system that can’t be corrupted.

The beauty of blockchain lies in this: imagine a stock payment. The money can change hands within seconds, but the actual ownership takes longer to determine since the two parties are unable to access each other’s ledger and must instead rely on a middle man to confirm the existence of the stock and update the individual ledgers. But with blockchain, each involved party is part of a larger ledger and confirms ownership immediately. It opens the door to a world of possibilities.


IBM is one of many companies stepping into the world of public ledgers. It currently offers the ability to form an IBM Blockchain network and create ways to take advantage of its offerings through business solutions.

Blockchain

IBM Power Systems Benefits

IBM Power Systems provides one of the leading IT management systems in the market. In the past, it was primarily focused on simply running a smooth operating system and solving key problems. However today it has migrated to new applications. In particular, the IBM Power Systems Linux based servers, called the OpenPOWER LC servers, are a hardware solution that many managers will find intriguing.

IBM Power Systems

Speed and Storage

OpenPOWER LC servers have two key benefits. The first is simply the speed and storage capabilities. The key specs are:

  • Up to 20 cores (2.9-3.3Ghz)
  • 2 sockets
  • 512 GB memory (16 DIMMs)
  • 115 GB/sec max sustained memory bandwidth
  • 12 3.5” SATA drives, 96 TB storage
  • 5 PCIe slots, 2 CAPI enabled
  • 2 Nvidia K80 GPU capable

That means that the analytical and big data capabilities are off the chart. In fact, MongoDB runs twice as fast and EDB Postgress runs 1.8 times as fast on the system.

Companies are dealing with more complex problems that require even more power than ever before. Firms are dealing with analytics issues such as supply chain optimization, agile asset management, fraud prevention and enterprise data management that only can be handled with a powerful big data server like the OpenPOWER LC.

Integration

The second benefit is that the server integrates nicely with existing data systems and other servers. This product is fully compatible to be plugged right into a server farm. There is no need to do extensive customization or back-end fixes.  Instead, IT managers can add it into the existing stock as a powerful new tool.

COMMON is a leading organization helping Power Systems professionals through educational events, certification, and ongoing training. For more information, please visit our website.

How Predictive Analytics Can Help Businesses Secure Funding and Boost Sales

There are several key factors that contribute to business model success. When businesses are looking for investor financing or when professionals seek to salvage a failing business, they look to see if these factors are in place and working well together.

Once business owners understand what these factors are, they can strengthen any weak areas they find in their business.

Zbig Skiba discussed successful business modeling and the book, Business Model Generation, in a LinkedIn article.

The 9 key elements of a good business model the book outlined were:

  • Knowledge of your customer segment and, “distinct target market;” people with similar desires and needs and the ability to pay for your product or service.
  • Your unique value proposition. What does your single product or service or bundle of products and services offer your customer segment?
  • Having efficient channels. Channels are the way you communicate with your customers. There are sales channels, delivery channels, follow-up channels etc.
  • Customer relationships. What is your experience and interaction with your clients? Are they satisfied with your business?
  • Revenue Streams, money coming in.
  • Key Activities, things you must do to conduct business every day. These might include manufacturing and design, etc.
  • Key Resources, your staff, financial resources, physical and intellectual property etc.
  • Key Partnerships, your vendor relationships and partnerships that make your business better, more affordable and more efficient; and
  • Your Cost Structure, the money you have to spend to run your business, including payroll, loan payments, raw materials, delivery costs, licensing fees and rent etc.

Many business owners and managers have yet to learn that comprehensive data analysis or predictive analytics can help strengthen weak areas in their business models.

How?

  1. Predictive analytics organizes big data. This helps businesses clearly see what their target market needs, wants and can afford to pay for.
  2. Once business owners and managers understand their target market at this level, their value proposition becomes clearer.
  3. Businesses can then start using communication and delivery channels that are convenient to their best prospects and therefore the most effective.
  4. Customers feel heard when businesses meet their needs and provide the products and services they desire. Satisfied customers turn into long-term clients and brand advocates.

Predictive analytics can also boost sales by helping businesses:

  • Identify their best revenue streams
  • Understand what activities they should continue and which ones to stop
  • Know which employees are right for each job
  • Know which vendors to partner with to satisfy their target market better
  • Budget more efficiently and stop wasting money on expenses they don’t need

What’s New in DB2 for i

DB2 Video

Speaker: Scott Forstie

During this 40 minute recording, Scott explains the new and enhanced DB2 for i features being delivered on March 31, 2017 to IBM i 7.2 and IBM i 7.3.

Database enhancements are delivered via the DB2 PTF Group SF99702 (IBM i 7.2) and SF99703 (IBM i 7.3), scheduled to coincide with Technology Refreshes (TRs).

DB2 for i continues to deliver new SQL programming capabilities, DBE improvements, IBM i Services and other high priority enhancements.

About the Speaker

Scott ForstieScott Forstie is the DB2 for i Business Architect at IBM. He has worked on IBM operating system development since joining the company in 1989. In addition to his development responsibilities, he is the IBM i developerWorks content manager and IBM i Technology Updates wiki owner.