Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
blog:iseries:rpg [2020/03/07 04:22] tom |
blog:iseries:rpg [2020/03/07 04:37] (current) tom [Strings] |
||
---|---|---|---|
Line 80: | Line 80: | ||
* first zero ends zero-suppression (leading zeros after that position are printed) | * first zero ends zero-suppression (leading zeros after that position are printed) | ||
* first asterisk also ends zero-suppression, but causes leading asterisks in the ouput | * first asterisk also ends zero-suppression, but causes leading asterisks in the ouput | ||
- | * 'b*bbbbbb.bb' (each b is a blank/space character) applied to 12345 prints ***123.45 | + | * <nowiki>'b*bbbbbb.bb' (each b is a blank/space character) applied to 12345 prints ***123.45</nowiki> |
* a currency symbol followed by a zero floats | * a currency symbol followed by a zero floats | ||
* 'bb,bbb,b$0.bb' applied to 12 prints $.12 | * 'bb,bbb,b$0.bb' applied to 12 prints $.12 | ||
Line 244: | Line 244: | ||
<code rpgfree> | <code rpgfree> | ||
DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++ | DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++ | ||
- | D custRecKeys ds likerec(custRec : *key)</code> | + | D custRecKeys ds likerec(custRec : *key)</code> |
<code rpgfree>/free | <code rpgfree>/free | ||
Line 258: | Line 258: | ||
chain (’abc’ : ’AB’) custRec custRecDs;</code> | chain (’abc’ : ’AB’) custRec custRecDs;</code> | ||
- | ------------------------------------------------------------------------------- | + | ---- |
===== CHECK & CHECKR ===== | ===== CHECK & CHECKR ===== | ||
Line 734: | Line 734: | ||
==== ACTIVATION GROUPS ==== | ==== ACTIVATION GROUPS ==== | ||
- | * QILE is default activation group for modules | + | * QILE is default activation group for modules |
- | * QSRVPGM is default activation group for service pgms | + | * QSRVPGM is default activation group for service pgms |
- | * default ACTGRPs limit the ILE funcions | + | * default ACTGRPs limit the ILE funcions |
- | * can't bind objects | + | * can't bind objects |
- | * pgm CALLs can only call other pgms, not procedures | + | * pgm CALLs can only call other pgms, not procedures |
- | * allows partitioning of job resources (file overrides, committment definitions, and open files) | + | * allows partitioning of job resources (file overrides, committment definitions, and open files) |
- | * can control job activation and deactivation, improving performance | + | * can control job activation and deactivation, improving performance |
- | * allows use of shared ODPs | + | * allows use of shared ODPs |
- | * if using mixed ILE and non-ILE, use default activation group | + | * if using mixed ILE and non-ILE, use default activation group |
- | * when an ILE pgm ends, the system doesn't always remove the storage for that pgm activation from the job | + | * when an ILE pgm ends, the system doesn't always remove the storage for that pgm activation from the job |
- | * manual use of RCLACTGRP can improve performance | + | * manual use of RCLACTGRP can improve performance |
==== BINDING DIRECTORIES ==== | ==== BINDING DIRECTORIES ==== | ||
Line 948: | Line 948: | ||
===== Literals ===== | ===== Literals ===== | ||
<code rpgfree> | <code rpgfree> | ||
- | H DATFMT(*ISO) | + | H DATFMT(*ISO) |
- | * Examples of literals used to initialize fields | + | * Examples of literals used to initialize fields |
- | DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++ | + | DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++ |
- | D DateField S D INZ(D'1988-09-03') | + | D DateField S D INZ(D'1988-09-03') |
- | D NumField S 5P 1 INZ(5.2) | + | D NumField S 5P 1 INZ(5.2) |
- | D CharField S 10A INZ('abcdefghij') | + | D CharField S 10A INZ('abcdefghij') |
- | D UCS2Field S 2C INZ(U'00610062') | + | D UCS2Field S 2C INZ(U'00610062') |
- | * Even though the date field is defined with a 2-digit year, the | + | * Even though the date field is defined with a 2-digit year, the |
- | * initialization value must be defined with a 4-digit year, since | + | * initialization value must be defined with a 4-digit year, since |
- | * all literals must be specified in date format specified | + | * all literals must be specified in date format specified |
- | * on the control specification. | + | * on the control specification. |
- | D YmdDate S D INZ(D'2001-01-13') | + | D YmdDate S D INZ(D'2001-01-13') |
- | D DATFMT(*YMD) | + | D DATFMT(*YMD) |
- | * Examples of literals used to define named constants | + | * Examples of literals used to define named constants |
- | D DateConst C CONST(D'1988-09-03') | + | D DateConst C CONST(D'1988-09-03') |
- | D NumConst C CONST(5.2) | + | D NumConst C CONST(5.2) |
- | D CharConst C CONST('abcdefghij') | + | D CharConst C CONST('abcdefghij') |
- | * Note that the CONST keyword is not required. | + | * Note that the CONST keyword is not required. |
- | D Upper C 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | + | D Upper C 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
- | * Note that the literal may be continued on the next line | + | * Note that the literal may be continued on the next line |
- | D Lower C 'abcdefghijklmn- | + | D Lower C 'abcdefghijklmn- |
- | D opqrstuvwxyz'</code> | + | D opqrstuvwxyz'</code> |
==== float literals ==== | ==== float literals ==== | ||
Line 1047: | Line 1047: | ||
===== Monitor (for errors) ===== | ===== Monitor (for errors) ===== | ||
<code rpgfree> | <code rpgfree> | ||
- | c monitor * start monitor | + | c monitor * start monitor |
- | c eval ivinue = ivinue + movc95 * eval equation | + | c eval ivinue = ivinue + movc95 * eval equation |
- | c on-error 0103 * field too small | + | c on-error 0103 * field too small |
- | c eval ivinue = *hival * reset | + | c eval ivinue = *hival * reset |
- | c endmon * end monitor | + | c endmon * end monitor |
</code> | </code> | ||
------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ||
Line 1142: | Line 1142: | ||
Create commands create 2 names - an SQL name (128 char max) and a system name (10 char max) | Create commands create 2 names - an SQL name (128 char max) and a system name (10 char max) | ||
Create Table (PF) | Create Table (PF) | ||
- | %%Create Table xxx As Select...%% | + | <code sql>Create Table xxx As Select...</code> |
: creates a table using a subset of field from an existing table | : creates a table using a subset of field from an existing table | ||
- | %%Create Table xxx Like MyTable...%% | + | <code sql>Create Table xxx Like MyTable...</code> |
: all fields in referenced table used in created table | : all fields in referenced table used in created table | ||
Create View | Create View | ||
Line 1182: | Line 1182: | ||
: a set of actions that are run automatically whenever a specified event occurs to a specified base table | : a set of actions that are run automatically whenever a specified event occurs to a specified base table | ||
UDT | UDT | ||
- | <code sql>CREATE DISTINCT TYPE US_DOLLAR AS DECIMAL (9,2)</code> | + | <code sql>CREATE DISTINCT TYPE US_DOLLAR AS DECIMAL (9,2)</code> |
: can then create tables with field types of US_DOLLAR (or string, integer, etc.) | : can then create tables with field types of US_DOLLAR (or string, integer, etc.) | ||
view | view | ||
Line 1374: | Line 1374: | ||
| TRIMR | %TRIMR | | | TRIMR | %TRIMR | | ||
- | ------------------------------------------------------------------------------- | ||
===== Strip Leading Zeros ===== | ===== Strip Leading Zeros ===== | ||