CCSIDs: The International Attribute of Mystery?Part 1

IBM i (OS/400, i5/OS)
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

CCSID (pronounced see-sid) is not just another acronym that you pronounce; it is a very important feature of the AS/400 and the iSeries 400. Yet, as something so important, very few of us programmers fully understand it. This article takes a look at what coded character set IDs are and how they are used. It is intended for anyone looking for a basic under- standing of CCSIDs, but this article is also targeted at software developers. It does not fully explain national language support; IBM provides some really great manuals for that. (See the Reference and Related Materials list at the end of this article.)

All Developers Need CCSIDs
There are many reasons why software developers need to understand CCSIDs, even if they are not developing international software. CCSIDs require consideration when software is being developed under any of the following conditions (this list is not all-inclusive):

  • The software will run on a system with a different primary language than the system on which the software was developed.
  • The software will run on a system with one or more secondary languages installed.
  • The software communicates with other systems, such as ASCII-based Unix systems or systems running with a different primary language.
  • The software ports data to or from other systems using tools such as FTP.
  • The software converts data from EBCDIC to ASCII, or vice versa.

All of the above conditions may require some form of data conversion. In some cases, data conversion is performed implicitly by OS/400; in other cases, the software has to perform an explicit conversion of the data. For example, software that communicates with another system may need to convert data that it sends from EBCDIC to ASCII, and vice versa for data that it receives. Data conversion is performed using CCSIDs, even when converting from EBCDIC to ASCII. This is evident by examining the CCSID attribute of the TCP/IP servers (such as FTP and SMTP). These servers have a CCSID attribute with a default value of 00819, which represents the most common version of ASCII. The point here is that all developers need to understand how CCSIDs work—their use is not exclusive to international software authors. Now, take a look at the specifics of why you need to understand this stuff.

Character Sets, Code Pages, and Code Points

As with any technical subject matter, national language support has its own terminology. At the basic level, there are character sets, code pages, and code points.

A character set is simply a group of letters, numbers, or other characters. By itself, a character set does not have an encoding scheme that assigns a numeric value to each character. An example of a character set is the English alphabet used in the United States. Another example is the Danish alphabet, which has some different characters than the English alphabet and is, therefore, a different character set. In and of itself, the English alphabet does not have an encoding scheme associated with it, although it is included in the popular EBCDIC and ASCII encoding schemes, among others.

To a computer, all data is just a series of bits. These bits represent binary values. As it is difficult to read binary data, a graphical representation is needed. This is where encoding schemes come into play. An encoding scheme cross-references binary data with character sets. This allows the computer to display its data as graphical characters, a form pleasant to the human eye.

The EBCDIC (extended binary-coded decimal interchange code) encoding scheme, used by IBM, supports many different character sets. The iSeries uses what is known as a code page to allow for different character sets. A code page is a combination of a character set and an encoding scheme, where each character is represented by a unique binary value. The binary value for each character is known as a code point. Code pages contain many code points, not all of which are displayable characters. (Nondisplay characters are referred to as control characters.)

Figure 1: In this excerpt from a hypothetical code page, each cell is a code point.

A code page is displayed as a matrix and usually indicates the hexadecimal value of a code point rather than the binary value, simply because it is easier for developers to work with hexadecimal numbers than binary ones. Code pages exist for many different countries and languages, each one being assigned a unique numeric value. To clarify this, I'll use an analogy: If each character set is assigned a page, and those pages are put into a book, that book would be called EBCDIC. Each page in that book would be a code page. Each code page would be referenced by its page number. There would also be a similar book for the ASCII encoding scheme (American Standard Code for Information Interchange). The iSeries reads both the EBCDIC and the ASCII books, with the former being read more often.

Figure 1 shows an excerpt from a hypothetical code page. Each cell in that matrix is a code point. The hexadecimal value for each code point is determined by combining the value from the column heading as the first hex digit and the value from the row heading as the second hex digit. Thus, code point X'10' in the hypothetical code page is an uppercase B, and code point X'31' is the character $.

Different code pages represent different character sets. The code points for a given character may vary between code pages. For example, in code page 819, code point X'42' is an uppercase B. In code page 37, an uppercase B is at code point X'C2', and X'42' is the character ‚. Therefore, to preserve the integrity of the data when moving between a system that uses code page 37 and one that uses 819, a conversion must take place to convert X'C2' to X'42'. The conversion will preserve the B so that the user on the 819 system sees the same character as the user on the 37 system. See Appendix F of IBM's International Application Development manual for the actual IBM code pages. (Both 37 and 819 are listed.)

A code page is associated with a particular character set, but a character set may be represented by more than one code page. For example, the U.S. English character set is represented by several code pages, including 37 (United States) and 277 (Denmark). On the other hand, code page 37 is only associated with one character set, U.S. English. More precisely, the character set used by code pages 37 and 277 is the Country Extended Character Set, which includes the U.S. English alphabet as well as many characters used in other languages.

Coded Character Set Identifiers

The iSeries supports many languages, character sets, and code pages. In fact, the iSeries even allows different users running on the same system to use different languages. Having this integration of code pages presents a data integrity problem. Figure 2 illustrates this problem.

Figure 2: Here is an example of a data integrity problem resulting from integrating code pages.

Figure 3: CCSIDs solve the data integrity problem by allowing data to be converted.

As shown in Figure 2, the U.S. user writes a record to the database containing the pound sign (#) character. The U.S. code page 37 assigns code point X'7B' to the # character, so a X'7B' is stored in the database. The Danish user then reads the same record from the file, but code point X'7B' on the Danish code page 277 is the [.Delta] character, which is what the Danish user sees. These results are not acceptable.

To address the issue of data conversion between code pages, the coded character set identifier (CCSID) was created. A CCSID is an attribute (or field) of an object that identifies how data inside the object is encoded, indicating the code page and character set of the data. In most cases, the CCSID is actually the same value as the code page. (U.S. CCSID is 37, and the associated code page is also 37). Having data tagged with CCSIDs allows the system to automatically convert between code pages when necessary. This data conversion is generally referred to as CCSID conversion; however, the end result is really a conversion from one code page to another, so it can be thought of as code page conversion.

Figure 3 revisits the example in Figure 2, only this time using CCSIDs to allow for the data to be converted. As in the first example, the U.S. user writes a record to the database containing the #, and a value of X'7B' gets stored. Now, when the Danish user reads the record, the system realizes that the job's CCSID is 277 and the CCSID of the data is 37. So, the system performs an implicit conversion of the data from CCSID 37 to 277. The X'7B' gets converted to X'4A', the code point for the # on the 277 code page. The Danish user sees the # character as he is supposed to. This also works conversely; if the Danish user writes a # character to the database, it gets converted to X'7B' before it is actually stored.

CCSID conversion can be implicit or explicit. Implicit conversions are performed by OS/400 when it determines that it is moving data between two different code pages. Explicit conversions are performed by software when developers require a conversion. Developers can code calls to the CCSID conversion APIs to explicitly perform the conversion. One instance where explicit conversion is required is when writing communications software that talks to a non-iSeries platform, such as UNIX. UNIX systems use ASCII character sets; thus, a conversion to ASCII is required when communicating with those systems. Since the iSeries also supports ASCII code pages, this conversion can be performed using the conversion APIs.

One final thing to note is that a given character may appear in one code page but not another. The system has different ways in which it handles this condition when it occurs. For an explanation of how this is handled, see IBM's International Application Development manual.

CCSIDs, CCSIDs Everywhere

Now that you have an understanding of what CCSIDs are, take a look at where they are used. CCSID attributes appear in a lot of places. I will focus on the most relevant ones: jobs, user profiles, the QCCSID system value, and objects containing data.

One of the more important CCSID attributes is the job CCSID. The job CCSID attribute is used by the system to decide if implicit conversions are needed when objects are accessed. When an object is accessed—for example, when a file is read—the system compares the job CCSID to the object's CCSID. If the two are different, the data is converted to the job CCSID (code page) before the program even gets the data returned to it. This is exactly the case in the example given for Figure 3. The job attribute can also be used for explicit CCSID conversions using conversion APIs.

Job attributes are assigned when a job enters the system. The job CCSID value comes from the user profile of a job. Thus, when a job starts, the system looks at the CCSID attribute of the user profile and then assigns that value to the job attribute. Actually, it's a little more complicated, as the user profile's CCSID may have the special value *SYSVAL. *SYSVAL tells the system to look at the system value QCCSID to get the value for the job attribute. The QCCSID system value defines the default CCSID used on the system. Many, if not all, user profiles will point to the system value for their CCSID.

Many objects also have CCSID attributes. The objects to be most concerned with are ones that contain data, such as database files, message files, and message queues. An object's CCSID attribute identifies how the data inside the object is stored. It is then used by the system to determine if conversion is needed when the object is accessed.

Jobs have another CCSID attribute called the default CCSID. To understand the default CCSID, you first need to look at the special CCSID value 65535. When a CCSID attribute has the value 65535, the system does not perform conversions on that data. This special value is also called *HEX, as it is intended to indicate hexadecimal data (although I prefer to call it binary data, but there is no *BIN). True binary data is not represented by characters, so therefore, no CCSID is necessary. Binary data should not be converted, as a conversion will destroy the data, so it should be tagged with CCSID 65535. I should note that numeric fields are automatically treated as *HEX.

The iSeries ships with the QCCSID system value set to 65535, and many systems actually run this way. This works okay, but it does present a couple of problems. If a job is running with a CCSID of 65535 and it creates an object containing data, what CCSID should that object be assigned? Using 65535 defeats the purpose of even having the CCSID in the first place (refer to Figure 2). What about the case when a CCSID conversion is absolutely required? If a job is talking to an ASCII-based system, a conversion to ASCII is required. However, if the job is running with 65535, you do not know what CCSID to use as the From CCSID on your conversion to ASCII. To solve these problems, the job default CCSID attribute was introduced. This attribute is only used when the job CCSID is 65535. If the job CCSID is 65535, the system determines the default CCSID by looking at the language ID of the job; language IDs have corresponding CCSIDs and are also an attribute of a job.

One other thing to note is that the iSeries does allow for field-level CCSID attributes. A field-level attribute allows an override of the object-level CCSID for a specific field. One use for this is when a file contains some fields with character data and some with binary data. Just use a field-level CCSID attribute set to 65535, and all is well.

See-Sid, See-Sid Run

Hopefully, this article was enough to get you up and running with CCSIDs. Now that you have a basic understanding of how they work, making sense of the manuals should be a little easier. The Native Language System is a complex topic. For a more complete explanation of the iSeries' national language support, see the References and Related Materials list at the end of this article. Also, look for the second part of this article, which will cover using CCSID conversion APIs, among other things, in the August issue of Midrange Computing .

Matt Bresnan is a software engineer and project lead for Help/Systems, Inc. He lives in Chaska, Minnesota, where the winters are cold but the iSeries is hot! He can be reached by email at This email address is being protected from spambots. You need JavaScript enabled to view it..




Support MC Press Online





  • White Paper: Node.js for Enterprise IBM i Modernization

    SB Profound WP 5539

    If your business is thinking about modernizing your legacy IBM i (also known as AS/400 or iSeries) applications, you will want to read this white paper first!

    Download this paper and learn how Node.js can ensure that you:
    - Modernize on-time and budget - no more lengthy, costly, disruptive app rewrites!
    - Retain your IBM i systems of record
    - Find and hire new development talent
    - Integrate new Node.js applications with your existing RPG, Java, .Net, and PHP apps
    - Extend your IBM i capabilties to include Watson API, Cloud, and Internet of Things

    Read Node.js for Enterprise IBM i Modernization Now!


  • Profound Logic Solution Guide

    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 companyare not aligned with the current IT environment.

    Get your copy of this important guide today!


  • 2022 IBM i Marketplace Survey Results

    Fortra2022 marks the eighth edition of the IBM i Marketplace Survey Results. Each year, Fortra captures data on how businesses use the IBM i platform and the IT and cybersecurity initiatives it supports.

    Over the years, this survey has become a true industry benchmark, revealing to readers the trends that are shaping and driving the market and providing insight into what the future may bring for this technology.

  • Brunswick bowls a perfect 300 with LANSA!

    FortraBrunswick is the leader in bowling products, services, and industry expertise for the development and renovation of new and existing bowling centers and mixed-use recreation facilities across the entertainment industry. However, the lifeblood of Brunswick’s capital equipment business was running on a 15-year-old software application written in Visual Basic 6 (VB6) with a SQL Server back-end. The application was at the end of its life and needed to be replaced.
    With the help of Visual LANSA, they found an easy-to-use, long-term platform that enabled their team to collaborate, innovate, and integrate with existing systems and databases within a single platform.
    Read the case study to learn how they achieved success and increased the speed of development by 30% with Visual LANSA.


  • The Power of Coding in a Low-Code Solution

    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:

    • Discover the benefits of Low-code's quick application creation
    • Understand the differences in model-based and language-based Low-Code platforms
    • Explore the strengths of LANSA's Low-Code Solution to Low-Code’s biggest drawbacks



  • Why Migrate When You Can Modernize?

    LANSABusiness 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.
    In this white paper, you’ll learn how to think of these issues as opportunities rather than problems. We’ll explore motivations to migrate or modernize, their risks and considerations you should be aware of before embarking on a (migration or modernization) project.
    Lastly, we’ll discuss how modernizing IBM i applications with optimized business workflows, integration with other technologies and new mobile and web user interfaces will enable IT – and the business – to experience time-added value and much more.


  • UPDATED: Developer Kit: Making a Business Case for Modernization and Beyond

    Profound Logic Software, Inc.Having trouble getting management approval for modernization projects? The problem may be you're not speaking enough "business" to them.

    This Developer Kit provides you study-backed data and a ready-to-use business case template to help get your very next development project approved!

  • What to Do When Your AS/400 Talent Retires

    FortraIT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators is small.

    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:

    • Why IBM i skills depletion is a top concern
    • How leading organizations are coping
    • Where automation will make the biggest impact


  • Node.js on IBM i Webinar Series Pt. 2: Setting Up Your Development Tools

    Profound Logic Software, Inc.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. In Part 2, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Attend this webinar to learn:

    • Different tools to develop Node.js applications on IBM i
    • Debugging Node.js
    • The basics of Git and tools to help those new to it
    • Using as a pre-built development environment



  • Expert Tips for IBM i Security: Beyond the Basics

    SB PowerTech WC GenericIn this session, IBM i security expert Robin Tatam provides a quick recap of IBM i security basics and guides you through some advanced cybersecurity techniques that can help you take data protection to the next level. Robin will cover:

    • Reducing the risk posed by special authorities
    • Establishing object-level security
    • Overseeing user actions and data access

    Don't miss this chance to take your knowledge of IBM i security beyond the basics.



  • 5 IBM i Security Quick Wins

    SB PowerTech WC GenericIn today’s threat landscape, upper management is laser-focused on cybersecurity. You need to make progress in securing your systems—and make it fast.
    There’s no shortage of actions you could take, but what tactics will actually deliver the results you need? And how can you find a security strategy that fits your budget and time constraints?
    Join top IBM i security expert Robin Tatam as he outlines the five fastest and most impactful changes you can make to strengthen IBM i security this year.
    Your system didn’t become unsecure overnight and you won’t be able to turn it around overnight either. But quick wins are possible with IBM i security, and Robin Tatam will show you how to achieve them.

  • Security Bulletin: Malware Infection Discovered on IBM i Server!

    SB PowerTech WC GenericMalicious programs can bring entire businesses to their knees—and IBM i shops are not immune. It’s critical to grasp the true impact malware can have on IBM i and the network that connects to it. Attend this webinar to gain a thorough understanding of the relationships between:

    • Viruses, native objects, and the integrated file system (IFS)
    • Power Systems and Windows-based viruses and malware
    • PC-based anti-virus scanning versus native IBM i scanning

    There are a number of ways you can minimize your exposure to viruses. IBM i security expert Sandi Moore explains the facts, including how to ensure you're fully protected and compliant with regulations such as PCI.



  • Encryption on IBM i Simplified

    SB PowerTech WC GenericDB2 Field Procedures (FieldProcs) were introduced in IBM i 7.1 and have greatly simplified encryption, often without requiring any application changes. Now you can quickly encrypt sensitive data on the IBM i including PII, PCI, PHI data in your physical files and tables.
    Watch this webinar to learn how you can quickly implement encryption on the IBM i. During the webinar, security expert Robin Tatam will show you how to:

    • Use Field Procedures to automate encryption and decryption
    • Restrict and mask field level access by user or group
    • Meet compliance requirements with effective key management and audit trails


  • Lessons Learned from IBM i Cyber Attacks

    SB PowerTech WC GenericDespite the many options IBM has provided to protect your systems and data, many organizations still struggle to apply appropriate security controls.
    In this webinar, you'll get insight into how the criminals accessed these systems, the fallout from these attacks, and how the incidents could have been avoided by following security best practices.

    • Learn which security gaps cyber criminals love most
    • Find out how other IBM i organizations have fallen victim
    • Get the details on policies and processes you can implement to protect your organization, even when staff works from home

    You will learn the steps you can take to avoid the mistakes made in these examples, as well as other inadequate and misconfigured settings that put businesses at risk.



  • The Power of Coding in a Low-Code Solution

    SB PowerTech WC GenericWhen 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:

    • Discover the benefits of Low-code's quick application creation
    • Understand the differences in model-based and language-based Low-Code platforms
    • Explore the strengths of LANSA's Low-Code Solution to Low-Code’s biggest drawbacks



  • Node Webinar Series Pt. 1: The World of Node.js on IBM i

    SB Profound WC GenericHave 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.
    Part 1 will teach you what Node.js is, why it's a great option for IBM i shops, and how to take advantage of the ecosystem surrounding Node.
    In addition to background information, our Director of Product Development Scott Klement will demonstrate applications that take advantage of the Node Package Manager (npm).
    Watch Now.

  • The Biggest Mistakes in IBM i Security

    SB Profound WC Generic The Biggest Mistakes in IBM i Security
    Here’s the harsh reality: cybersecurity pros have to get their jobs right every single day, while an attacker only has to succeed once to do incredible damage.
    Whether that’s thousands of exposed records, millions of dollars in fines and legal fees, or diminished share value, it’s easy to judge organizations that fall victim. IBM i enjoys an enviable reputation for security, but no system is impervious to mistakes.
    Join this webinar to learn about the biggest errors made when securing a Power Systems server.
    This knowledge is critical for ensuring integrity of your application data and preventing you from becoming the next Equifax. It’s also essential for complying with all formal regulations, including SOX, PCI, GDPR, and HIPAA
    Watch Now.

  • Comply in 5! Well, actually UNDER 5 minutes!!

    SB CYBRA PPL 5382

    TRY 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.

    Request your trial now!

  • Backup and Recovery on IBM i: Your Strategy for the Unexpected

    FortraRobot automates the routine 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:
    - Simplified backup procedures
    - Easy data encryption
    - Save media management
    - Guided restoration
    - Seamless product integration
    Make sure your data survives when catastrophe hits. Try the Robot Backup and Recovery Solution FREE for 30 days.

  • Manage IBM i Messages by Exception with Robot

    SB HelpSystems SC 5413Managing messages on your IBM i can be more than a full-time job if you have to do it manually. 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:
    - Automated message management
    - Tailored notifications and automatic escalation
    - System-wide control of your IBM i partitions
    - Two-way system notifications from your mobile device
    - Seamless product integration
    Try the Robot Message Management Solution FREE for 30 days.

  • Easiest Way to Save Money? Stop Printing IBM i Reports

    FortraRobot 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:

    - Automated report distribution
    - View online without delay
    - Browser interface to make notes
    - Custom retention capabilities
    - Seamless product integration
    Rerun another report? Never again. Try the Robot Report Management Solution FREE for 30 days.

  • Hassle-Free IBM i Operations around the Clock

    SB HelpSystems SC 5413For over 30 years, Robot has been a leader in systems management for IBM i.
    Manage your job schedule with the Robot Job Scheduling Solution. Key features include:
    - Automated batch, interactive, and cross-platform scheduling
    - Event-driven dependency processing
    - Centralized monitoring and reporting
    - Audit log and ready-to-use reports
    - Seamless product integration
    Scale your software, not your staff. Try the Robot Job Scheduling Solution FREE for 30 days.