RPG Built In Functions
From MidrangeWiki
Note | Function | Description | Type |
---|---|---|---|
%ABS | Absolute Value of Expression | Evaluate | |
%ADDR | Get Address of Variable | Pointer | |
%ALLOC | Allocate Storage | ||
%ABS | Absolute Value of Expression | Evaluate | |
%ADDR | Get Address of Variable | Pointer | |
%ALLOC | Allocate Storage | ||
%BITAND | Bitwise AND Operation | Binary | |
%BITNOT | Invert Bits | Binary | |
%BITOR | Bitwise OR Operation | Binary | |
%BITXOR | Bitwise Exclusive-OR Operation | Binary | |
• | %BIT examples | Bit Operations | Binary |
%CHAR | Convert to Character Data | Format | |
%CHECK | Check Characters | ||
%CHECKR | Check Reverse | ||
%DATE | Convert to Date | Date | |
%DAYS | Number of Days | Date | |
%DEC | Convert to Packed Decimal Format | Format | |
• | %DECH | Convert to Packed Decimal Format with Half Adjust | Format |
%DECPOS | Get Number of Decimal Positions | ||
%DIFF | Difference Between Two Date, Time, or Timestamp Values | Date | |
%DIV | Return Integer Portion of Quotient | Evaluate | |
%EDITC | Edit Value Using an Editcode | Format | |
%EDITFLT | Convert to Float External Representation | Format | |
%EDITW | Edit Value Using an Editword | Format | |
%ELEM | Get Number of Elements | ||
%EOF | Return End or Beginning of File Condition | Pointer | |
%EQUAL | Return Exact Match Condition | Flag | |
%ERROR | Return Error Condition | Flag | |
%FIELDS | Fields to update | ||
%FLOAT | Convert to Floating Format | Format | |
%FOUND | Return Found Condition | Flag | |
%GRAPH | Convert to Graphic Value | Format | |
%HOURS | Number of Hours | Time | |
%INT | Convert to Integer Format | Format | |
• | %INTH | Convert to Integer Format with Half Adjust | Format |
%KDS | Search Arguments in Data Structure | ||
%LEN | Get or Set Length | ||
• | %LEN | Used for its Value | |
• | %LEN | Used to Set the Length of Variable-Length Fields | |
%LOOKUPxx | Look Up an Array Element | Search | |
%MINUTES | Number of Minutes | Time | |
%MONTHS | Number of Months | Date | |
%MSECONDS | Number of Microseconds | Time | |
%NULLIND | Query or Set Null Indicator | Flag | |
%OCCUR | Set/Get Occurrence of a Data Structure | Pointer | |
%OPEN | Return File Open Condition | Flag | |
%PADDR | Get Procedure Address | Pointer | |
• | %PADDR | Used with a Prototype | |
%PARMS | Return Number of Parameters | ||
%REALLOC | Reallocate Storage | ||
%REM | Return Integer Remainder | Evaluate | |
%REPLACE | Replace Character String | ||
%SCAN | Scan for Characters | Search | |
%SECONDS | Number of Seconds | Time | |
%SHTDN | Shut Down | ||
%SIZE | Get Size in Bytes | ||
%SQRT | Square Root of Expression | Evaluate | |
%STATUS | Return File or Program Status | Flag | |
%STR | Get or Store Null-Terminated String | ||
• | %STR | Used to Get Null-Terminated String | |
• | %STR | Used to Store Null-Terminated String | |
%SUBDT | Extract a Portion of a Date, Time, or Timestamp | Date | |
%SUBST | Get Substring | ||
• | %SUBST | Used for its Value | |
• | %SUBST | Used as the Result of an Assignment | |
%THIS | Return Class Instance for Native Method | ||
%TIME | Convert to Time | Time | |
%TIMESTAMP | Convert to Timestamp | Date | |
%TLOOKUPxx | Look Up a Table Element | Search | |
%TRIM | Trim Blanks at Edges | ||
%TRIML | Trim Leading Blanks | ||
%TRIMR | Trim Trailing Blanks | ||
%UCS2 | Convert to UCS-2 Value | Format | |
%UNS | Convert to Unsigned Format | Format | |
• | %UNSH | Convert to Unsigned Format with Half Adjust | Format |
%XFOOT | Sum Array Expression Elements | Evaluate | |
%XLATE | Translate | ||
%YEARS | Number of Years | Date | |
%BITAND | Bitwise AND Operation | Binary | |
%BITNOT | Invert Bits | Binary | |
%BITOR | Bitwise OR Operation | Binary | |
%BITXOR | Bitwise Exclusive-OR Operation | Binary | |
• | Examples | Bit Operations | Binary |
%CHAR | Convert to Character Data | Format | |
%CHECK | Check Characters | ||
%CHECKR | Check Reverse | ||
%DATE | Convert to Date | Date | |
%DAYS | Number of Days | Date | |
%DEC | Convert to Packed Decimal Format | Format | |
• | %DECH | Convert to Packed Decimal Format with Half Adjust | Format |
%DECPOS | Get Number of Decimal Positions | ||
%DIFF | Difference Between Two Date, Time, or Timestamp Values | Date | |
%DIV | Return Integer Portion of Quotient | Evaluate | |
%EDITC | Edit Value Using an Editcode | Format | |
%EDITFLT | Convert to Float External Representation | Format | |
%EDITW | Edit Value Using an Editword | Format | |
%ELEM | Get Number of Elements | ||
%EOF | Return End or Beginning of File Condition | Pointer | |
%EQUAL | Return Exact Match Condition | Flag | |
%ERROR | Return Error Condition | Flag | |
%FIELDS | Fields to update | ||
%FLOAT | Convert to Floating Format | Format | |
%FOUND | Return Found Condition | Flag | |
%GRAPH | Convert to Graphic Value | Format | |
%HOURS | Number of Hours | Time | |
%INT | Convert to Integer Format | Format | |
• | %INTH | Convert to Integer Format with Half Adjust | Format |
%KDS | Search Arguments in Data Structure | Search | |
%LEN | Get or Set Length | ||
• | %LEN | Used for its Value | |
• | %LEN | Used to Set the Length of Variable-Length Fields | |
%LOOKUPxx | Look Up an Array Element | Search | |
%MINUTES | Number of Minutes | Time | |
%MONTHS | Number of Months | Date | |
%MSECONDS | Number of Microseconds | Time | |
%NULLIND | Query or Set Null Indicator | Flag | |
%OCCUR | Set/Get Occurrence of a Data Structure | Pointer | |
%OPEN | Return File Open Condition | Flag | |
%PADDR | Get Procedure Address | Pointer | |
• | %PADDR | Used with a Prototype | Pointer |
%PARMS | Return Number of Parameters | ||
%REALLOC | Reallocate Storage | ||
%REM | Return Integer Remainder | Evaluate | |
%REPLACE | Replace Character String | ||
%SCAN | Scan for Characters | Search | |
%SECONDS | Number of Seconds | Time | |
%SHTDN | Shut Down | ||
%SIZE | Get Size in Bytes | ||
%SQRT | Square Root of Expression | Evaluate | |
%STATUS | Return File or Program Status | Flag | |
%STR | Get or Store Null-Terminated String | ||
• | %STR | Used to Get Null-Terminated String | |
• | %STR | Used to Store Null-Terminated String | |
%SUBDT | Extract a Portion of a Date, Time, or Timestamp | Date | |
%SUBST | Get Substring | ||
• | %SUBST | Used for its Value | |
• | %SUBST | Used as the Result of an Assignment | |
%THIS | Return Class Instance for Native Method | ||
%TIME | Convert to Time | Time | |
%TIMESTAMP | Convert to Timestamp | Date | |
%TLOOKUPxx | Look Up a Table Element | Search | |
%TRIM | Trim Blanks at Edges | ||
%TRIML | Trim Leading Blanks | ||
%TRIMR | Trim Trailing Blanks | ||
%UCS2 | Convert to UCS-2 Value | Format | |
%UNS | Convert to Unsigned Format | Format | |
• | %UNSH | Convert to Unsigned Format with Half Adjust | Format |
%XFOOT | Sum Array Expression Elements | Evaluate | |
%XLATE | Translate | ||
%YEARS | Number of Years | Date |