RPG Built In Functions
From MidrangeWiki
(Redirected from Built In Functions)
RPG IV Concepts As of V5R2 IC2924 at the IBM iSeries Information Center
Note | Function | Description | Type |
---|---|---|---|
%ABS | Absolute Value of Expression | Evaluate | |
%ADDR | Get Address of Variable | Pointer | |
%ALLOC | Allocate Storage | Memory | |
%BITAND | Bitwise AND Operation | Binary | |
%BITNOT | Invert Bits | Binary | |
%BITOR | Bitwise OR Operation | Binary | |
%BITXOR | Bitwise Exclusive-OR Operation | Binary | |
• | %BITxxx examples | Bit Operations | Binary |
%CHAR | Convert to Character Data | Format | |
%CHECK | Check Characters | Flag | |
%CHECKR | Check Reverse | Flag | |
%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 | Numeric | |
%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 | Tally | |
%EOF | Return End or Beginning of File Condition | Pointer | |
%EQUAL | Return Exact Match Condition | Flag | |
%ERROR | Return Error Condition | Flag | |
%FIELDS | Fields to update | Flag | |
%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 | Evaluate | |
• | %LEN | Used for its Value | Evaluate |
• | %LEN | Used to Set the Length of Variable-Length Fields | Evaluate |
%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 | Numeric | |
%REALLOC | Reallocate Storage | Memory | |
%REM | Return Integer Remainder | Evaluate | |
%REPLACE | Replace Character String | String | |
%SCAN | Scan for Characters | Search | |
%SECONDS | Number of Seconds | Time | |
%SHTDN | Shut Down | "*LR" | |
%SIZE | Get Size in Bytes | String | |
%SQRT | Square Root of Expression | Evaluate | |
%STATUS | Return File or Program Status | Flag | |
%STR | Get or Store Null-Terminated String | String | |
• | %STR | Used to Get Null-Terminated String | String |
• | %STR | Used to Store Null-Terminated String | String |
%SUBDT | Extract a Portion of a Date, Time, or Timestamp | Date | |
? | %SUBARR | Move contiguous array elements to contiguous elements of another array | Array |
%SUBST | Get Substring | String | |
• | %SUBST | Used for its Value | String |
• | %SUBST | Used as the Result of an Assignment | String |
%THIS | Return Class Instance for Native Method | Memory | |
%TIME | Convert to Time | Time | |
%TIMESTAMP | Convert to Timestamp | Date | |
%TLOOKUPxx | Look Up a Table Element | Search | |
%TRIM | Trim Blanks at Edges | String | |
%TRIML | Trim Leading Blanks | String | |
%TRIMR | Trim Trailing Blanks | String | |
%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 | String | |
%YEARS | Number of Years | Date |
As of V7R1:
Note | Function | Description | Type |
---|---|---|---|
%PARMNUM | Return Parameter Number | Numeric | |
%SCANRPL | Scan and Replace Characters | String |
As of V7R2:
Note | Function | Description | Type |
---|---|---|---|
%DATA | Parameter for DATA-INTO | HTTP | |
%HANDLER | Parameter for DATA-INTO, XML-INTO, or XML-SAX | HTTP | |
%MAX | Maximum Value | Evaluate | |
%MIN | Minimum Value | Evaluate | |
%PARSER | Parameter for DATA-INTO | HTTP | |
%PROC | Return Name of Current Procedure | String | |
%XML | Parameter for XML-INTO or XML-SAX | HTTP |
As of V7R3:
Note | Function | Description | Type |
---|---|---|---|
%SCANR | Scan Reverse for Characters | String |