IBM Support

Defining a Hex Constant in RPG

Troubleshooting


Problem

This document describes how to declare a Hex constant in RPG/400 and ILE RPG IV

Resolving The Problem

In OPM RPG, define a hex constant as follows:
 
     I              X'0000000000000000000-C         HEXDTA
     I              '0'
     C                     MOVE HEXDTA    CHAR   20
     C                     MOVELHEXDTA    CHAR   20
     C                     SETON                     LR   

In ILE RPG IV, you can define a hex constant as follows:
 
**FREE
Dcl-C HEXDTA          CONST(X'00000000000000000000');
Dcl-S CHAR            Char(20);
%Subst(CHAR:11:10) = HEXDTA;
%Subst(CHAR:1:10) = HEXDTA;
*INLR = *ON;
      

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Historical Number

23993351

Document Information

Modified date:
14 November 2024

UID

nas8N1017280