Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
IBM RPG
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Data types== RPG supports the following data types. '''Note:'''<br />The character in the ''data type'' column is the character that is encoded on the Definition Specification in the column designated for data type. To compare, in a language like C where definitions of variables are free-format and would use a keyword such as '''int''' to declare an integer variable, in RPG, a variable is defined with a fixed-format Definition Specification. In the Definition Specification, denoted by a letter '''D''' in column '''6''' of a source line, the data type character would be encoded in column '''40'''. Also, if the ''data type'' character is omitted, that is, left blank, the default is '''A''' if no decimal positions are specified, P when decimal positions are specified for stand-along fields, and '''S''' (ZONED) when decimal positions are specified within a data structure. {| class="wikitable sortable" style="width:100%;" |- !style="width:10%"| Data type !style="width:20%"| Name !style="width:25%"| Length !style="width:45%"| Description |- | style="text-align:center"|<code>A</code> | Alphanumeric character | 1 to 16,773,104 bytes (fixed)<br />1 to 16,773,100 bytes (varying-length) | Alphanumeric character |- | style="text-align:center"|<code>B</code> | Binary numeric | 1 byte (8-bit)<br />2 byte (16-bit)<br />4 bytes (32-bit)<br />8 bytes (64-bit) | Signed binary integer |- | style="text-align:center"|<code>C</code> | UCS-2 character | 1 to 8,386,552 characters (fixed)<br />1 to 8,386,550 characters (varying) | 16-bit UCS-2 character ([[DBCS]] or EGCS) |- | style="text-align:center"|<code>D</code> | Date | 10 bytes | Date: year, month, day |- | style="text-align:center"|<code>F</code> | [[Floating point]] numeric | 4 bytes (32-bit)<br />8 bytes (64-bit) | Signed binary floating-point real |- | style="text-align:center"|<code>G</code> | Graphic character | 1 to 8,386,552 characters (fixed)<br />1 to 8,386,550 characters (varying) | 16-bit graphic character ([[DBCS]] or EGCS) |- | style="text-align:center"|<code>I</code> | Integer numeric | 1 byte (8-bit)<br />2 bytes (16-bit)<br />4 bytes (32-bit)<br />8 bytes (64-bit) | Signed binary integer |- | style="text-align:center"|<code>N</code> | [[Character indicator]] | 1 byte | '1' = TRUE<br />'0' = FALSE |- | style="text-align:center"|<code>O</code> | Object | Size undisclosed | Object reference |- | style="text-align:center"|<code>P</code> | [[Packed decimal]] numeric | 1 to 63 digits,<br />2 digits per byte plus sign | Signed fixed-point decimal number with integer and fraction digits |- | style="text-align:center"|<code>S</code> | [[Zoned decimal]] numeric | 1 to 63 digits,<br />1 digit per byte | Signed fixed-point decimal number with integer and fraction digits |- | style="text-align:center"|<code>T</code> | Time | 8 bytes | Time: hour, minute, second |- | style="text-align:center"|<code>U</code> | Integer numeric | 1 byte (8-bit)<br />2 bytes (16-bit)<br />4 bytes (32-bit)<br />8 bytes (64-bit) | Unsigned binary integer |- | style="text-align:center"|<code>Z</code> | [[Timestamp]] | 26 bytes | [[System time|Date and time]]:<br /> year, month, day, hour, minute, second, microseconds |- | style="text-align:center"|<code>*</code> | [[Pointer (computer programming)#Based pointer|Basing-Pointer]]<br />[[Pointer (computer programming)#Function pointer|Procedure-Pointer]]<br />[[System-Pointer]] | 16 bytes | Address to Data<br />Address to Activated Procedure<br />Address to Object |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)