Professional Documents
Culture Documents
iSeries
Note! Before using this information and the product it supports, be sure to read the general information under Notices on page 65.
Third Edition (May 2001) This edition applies to Version 5, Release 1, Modification Level 0, of IBM WebSphere Development Studio for iSeries (5722-WDS), ILE RPG compiler, and to all subsequent releases and modifications until otherwise indicated in new editions. This edition applies only to reduced instruction set computer (RISC) systems. This edition replaces SX09-1315-01. Order publications through your IBM representative or the IBM branch office serving your locality. Publications are not stocked at the address given below. IBM welcomes your comments. You can send your comments to: IBM Canada Ltd. Laboratory Information Development 2G/KB7/1150/TOR 1150 Eglinton Avenue East North York, Ontario, Canada
M3C 1H7
You can also send your comments by facsimile (attention: RCF Coordinator), or you can send your comments electronically to IBM. See How to Send Your Comments for a description of the methods. When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. Copyright International Business Machines Corporation 1989, 2001. All rights reserved. US Government Users Restricted Rights Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
SEU PROMPTS
In the chapters describing the RPG specifications, SEU prompts are given in the caption for each table.
iii
iv
Contents
How to Identify Different Implementations . . . . . . . . . . . iii
SEU PROMPTS . . . . . . . . . . . . . iii
41
Chapter 1. Error Handling . . . . . . . 1 Chapter 2. RPG Character Set . . . . . 5 Chapter 3. Control Specifications . . . . 7 Chapter 4. File Description Specifications. . . . . . . . . . . . 11
Main File Description Line Summary Chart. Continuation Line Summary Chart . . . Continuation Line Options Summary Chart . . . . . . . 11 . 13 . 14
Chapter 15. Edit Codes. . . . . . . . 63 Chapter 7. Definition Specifications . . 21 Notices . . . . . . . . . . . . . . 65 Chapter 8. Input Specifications . . . . 25 Chapter 9. Calculation Specifications 31
Programming Interface Information . How to Send Your Comments . . . Trademarks and Service Marks . . . . . . . . . . . . . . . . 66 . 66 . 67
vi
00000 No exception/error occurred. 00002 Function key used to end display. 00011 End of file on input. 00012 Record not found. 00013 Subfile is full on a write operation. Exception-Error Conditions Codes 01011 01021 Meaning Undefined record type (input record does not match record-identifying indicator). Tried to write a record that already exists (file being used has unique keys and key is duplicate, or attempted to use duplicate relative record number to a subfile). (RPG IV only) Referential constraint error detected on file member. Error in trigger program before file operation performed. (RPG IV only) Error in trigger program after file operation performed. (RPG IV only) Match field out of sequence. Array/table load sequence error. Array/table load sequence error. Alternate collating sequence used. Excess entries in array/table file. Record out of sequence in file. No indicator on the DDS keyword for Print Key. No indicator on the DDS keyword for Roll Up Key. No indicator on the DDS keyword for Roll Down Key. No indicator on the DDS keyword for Clear Key. No indicator on the DDS keyword for Help Key. No indicator on the DDS keyword for Home Key. Record mismatch detected on input. I/O operation to a closed file. OPEN issued to a file already open. Error on an implicit OPEN/CLOSE operation. Error on an explicit OPEN/CLOSE operation. Unable to allocate a record in the file. Update or delete operation attempted without a prior read. Unable to allocate record due to referential constraint error. (RPG IV only) Error on SPECIAL file. Error in PRTCTL space or skip entries. Record number not found. (Record number specified in record address file is not found in controlled file.) Permanent I/O error occurred. Session or device error occurred. Recovery may be possible. Attempt to exceed maximum number of devices defined for file. Attempt to acquire unavailable device. Operation to unacquired or undefined device. Job ending with controlled option. Unable to acquire second device for single device file (RPG IV only)
01022 01023 01024 01031 01041 01042 01051 01071 01121 01122 01123 01124 01125 01126 01201 01211 01215 01216 01217 01218 01221 01222 01231 01235 01241 01251 01255 01261 01271 01281 01282 01284
Table 1. File Error Codes (continued) 01285 Attempt to acquire an allocated device. 01286 Attempt to open shared file with SAVDS or SAVIND options. 01287 Response indicators overlap SAVIND indicators. 01299 I/O error detected. 01331 Wait time exceeded for input operations to WORKSTN file.
00000 No exception/error occurred. 00001 Called program returned with the LR indicator on. 00050 Conversion resulted in substitution. (RPG IV only) Exception-Error Conditions Codes 00100 00101 00102 00103 00104 00112 00113 Meaning Value out of range for string operation. Negative square root. Divide by zero. An intermediate result is not large enough to contain the result. (RPG IV only) Float underflow. An intermediate value is too small to be to contained in the intermediate result field. (RPG IV only) Invalid Date, Time or Timestamp value. (RPG IV only) Date overflow or underflow. (For example, when the result of a Date calculation results in a number greater than *Hival or less than *Loval.) (RPG IV only) Date mapping errors, where a Date is mapped from a 4 character year to a 2 character year and the date range is not 1940-2039. (RPG IV only) Variable length character or graphic field has a current length that is not valid. (RPG IV only) Table or array out of sequence. Invalid array index. OCCUR value is out of range. RESET attempted during initialization. Call to program or procedure ended in error. Error occurred while calling program or procedure. Called program tried to use a parameter not passed to it. (RPG III only) Pointer or parameter error. (RPG IV only) Called program returned with halt indicator on. Halt indicator on in this program. Halt indicator on when RETURN operation run. RPG dump failed. Class or method not found for a method call, or error in method call. Error while converting a Java array to an RPG parameter on entry to a Java native method. Error converting RPG parameter to Java array on exit from an RPG native method. Error converting RPG parameter to Java array in preparation for a Java method call. Error converting Java array to RPG parameter or return value after a Java method. Error converting RPG return value to Java array. Error on DSPLY operation. Data area not found. *PDA not valid for non-prestart job. Data area types or lengths do not match. Data area not allocated for output. An I/O error occurred while processing data area. User not authorized to use data area. User not authorized to change data area. Error while unlocking data area.
00114 00115 00120 00121 00122 00123 00202 00211 00221 00222 00231 00232 00233 00299 00301 00302 00303 00304 00305 00306 00333 00401 00402 00411 00412 00413 00414 00415 00421
| | | | | | | | | |
Table 2. Program Status Codes (continued) 00425 Length requested for storage allocation is out of range. (RPG IV only) 00426 Error encountered during storage management operation. (RPG IV only) 00431 Data area previously allocated to another process. 00432 *LOCK for data area not granted. 00450 Character field not entirely enclosed by SO and SI. (RPG IV only) 00501 Failure to retrieve sort sequence. 00502 Failure to convert sort sequence. 00802 Commitment control not active. 00803 Rollback operation failed. 00804 Error occurred on COMMIT operation. 00805 Error occurred on ROLBK operation. 00907 Decimal data error (invalid digit or sign). 00970 The level numbers of the generating compiler and the run-time subroutines do not match. 09998 Internal failure in RPG compiler or in run-time subroutines. 09999 Program exception in system routine.
| | |
20 21
n/a ALTSEQ n/a FORMSALIGN n/a FTRANS n/a n/a n/a DFTNAME
Table 4. RPG IV Control Specification Summary Chart (H) Positions or Keyword 6 7-80 ACTGRP Name Form type Keywords Activation group *NEW | *CALLER | activationgroup-name {*NONE | *SRC | *EXT} Entry H RPG III 6 n/a n/a
ALTSEQ
26
Table 4. RPG IV Control Specification Summary Chart (H) (continued) Positions or Keyword ALWNULL AUT Name Allow null-capable fields Authority Entry *NO | *INPUTONLY | *USRCTL *LIBRCRTAUT | *ALL | *CHANGE | *USE | *EXCLUDE | authorizationlist-name binding-directory -name {:bindingdirectory-name...} *GRAPH: *IGNORE | *SRC | number *UCS2: number 1-2048 string symbol *{NO}DATETIME *{NO}GRAPHIC *{NO}VARCHAR *{NO}VARGRAPHIC fmt{separator} fmt{separator} {*NO | *YES} *JOBRUN | value *YES | *NO rpg_name *PEP | *ENTRYEXIT | *FULL *MAXDIGITS | *RESDECPOS RPG III n/a n/a
BNDDIR
Binding directories
n/a
Default graphic CCSID Default UCS-2 CCSID Maximum nesting level Copyright string Currency symbol Convert options
Date edit (Y edit code) Date format Debug Decimal notation Default activation group Default name Enable performance collection Expression options
Integer format for {*NO | *YES} externally-described binary fields Fix decimal data Floating point division Forms alignment File Translation Generation level Indent in source listing Integer precision Language identifier *{NO}ZONED *{NO}INPUTPACKED {*NO | *YES} {*NO | *YES} {*NONE | *SRC} 0-20 *NONE | character-value 10 | 20 *JOBRUN | *JOB | languageidentifier
Table 4. RPG IV Control Specification Summary Chart (H) (continued) Positions or Keyword NOMAIN OPENOPT OPTIMIZE OPTION Name Module without main procedure Open printer file option Optimization level Options *{NO}INZOFL Entry RPG III n/a n/a
*NONE | *BASIC | *FULL n/a *{NO}XREF *{NO}GEN *{NO}SECLVL *{NO}SHOWCOPY *{NO}EXPDDS *{NO}EXT *{NO}SHOWSKP *{NO}SRCSTMT *{NO}DEBUGIO *NOCOL | *COL n/a
PRFDTA SRTSEQ
n/a
*HEX | *JOB | *JOBRUN | n/a *LANGIDUNQ | *LANGIDSHR | sort-table-name *SRCMBRTXT | *BLANK | description *SERIALIZE fmt{separator} *YES | *NO *USER | *OWNER n/a n/a n/a n/a n/a
Program information text Multi-thread environment Time format Move truncated value User profile
10
16
File designation
18
32
35
33-34
OFLIND
35-38 39
KEYLOC n/a
11
Table 5. RPG III Main File Description Line Summary Chart (F, FK) (continued) Positions 40-46 Name Device Entry PRINTER DISK WORKSTN SPECIAL SEQ Blank Continuation lines Name of routine Blank K Name of user-supplied routine Blank File addition/unordered Blank A Blank File condition Blank U1-U8 UC Blank Comments Optional EXTIND USROPN RPG IV 36-42
73-74 75-80
n/a 81-100
Table 6. RPG IV File Description Fixed Form Summary Chart (F) Positions or Keyword 6 7-16 17 Name Form type File name File type Entry F Valid file name I O U C Blank P S R T F E Blank Blank A A or Blank D F E 1-32766 L Blank RPG III 6 7-14 15
18
File designation
16
19 20 21 22 23-27 28
End of file File addition/unordered Sequence File format Record length Limits processing
17 66 18 19 24-27 28
12
Table 6. RPG IV File Description Fixed Form Summary Chart (F) (continued) Positions or Keyword 29-33 34 Name Length of key field or record address field Record address type Entry 1-2000 Blank Blank A P K G D T Z F Blank I T PRINTER DISK WORKSTN SPECIAL SEQ Blank RPG III 29-30 31
35
32
36-42
40-46
43 44-80 81-100
n/a n/a
Optional
75-80
Entry F Blank
RPG IV 6 n/a
External name of record RENAME IGNORE format Blank Record number field for Numeric field name SFILE. Continuation line K n/a SFILE n/a n/a Blank Optional n/a 81-100
13
This file is specified for commitment control. COMMIT Positions 60-65 contain the left-justified name DEVID of a 10-character alphanumeric field which does not need to be further defined. This field contains the name of the program device that supplied the record being processed in the file. This option lets you ignore a record format from an externally-described file. Indicators from 01 to the number specified are saved and restored for each device attached to a mixed or multiple device file. This entry lets you define and name a data structure to contain the exception/error information. The data structure name is entered in positions 60 through 65 and left-justified. If INFDS is specified for more than one file, each associated data structure must have a unique name. IGNORE SAVEIND
IGNORE IND
INFDS
INFDS
INFSR
Subroutine name
INFSR The file exception/error subroutine named (left-justified) in positions 60 through 65 may receive control following file exceptions/errors. The subroutine name may be *PSSR, which indicates the user-defined program exception/error subroutine is to be given control for errors on this file. The number specified must be greater than zero and right-justified in positions 60 through 65. MAXDEV
NUM
PASS
Specify PASS *NOIND on the file-description PASS specification continuation line for a program described WORKSTN file if you are taking responsibility for passing indicators on input and output.
PLIST
PLIST Parameter list This entry is valid only when the device name specified in positions 40 through 46 of the main file description line is SPECIAL. Positions 60 through 65 give the left-justified name of the parameter list that is to be passed to the special routine. Data structure name The dynamic printer control option is being PRTCTL used. The data structure specified left-justified in positions 60 through 65 refers to the forms control information and line count value.
PRTCTL
14
Table 8. RPG III Continuation Line Options (continued) Option (54-59) RECNO Entry (60-67) Field name Explanation This entry is optional for disk files to be processed by relative record number. A RECNO field must be specified for output files processed by relative record number, output files that are referenced by a random WRITE calculation operation, or output files that are used with ADD on the output specifications. This entry, which is optional, allows you to rename record formats in an externally described file. Positions 19 through 28 of the continuation line specify the external name of the record format that is to be renamed. Positions 60 through 67 specify the left-justified name of the record as it is used in the program. RPG IV RECNO
RENAME
RENAME
SAVDS
Positions 60-65 contain the left-justified name SAVEDS of the data structure that is saved and restored for each device. SFILE Positions 60 through 67 must specify, left-justified, the RPG name of the record format to be processed as a subfile. Positions 47 through 52 must specify the name of the relative record number field for this subfile. Positions 60-65 contain the left-justified name SLN of a start line number (SLN) field. The SLN field determines where a record format will be written to a display file.
SFILE
SLN
Field name
Table 9. RPG IV File Description Specification Keywords (F) RPG IV Keyword BLOCK COMMIT DATFMT DEVID Name Record blocking Commitment control Date format Program device File name External indicator Member name Form length of printer file Overflow line number Ignore record format Include record format Name an indicator data structure Entry *YES | *NO {rpg_name} fmt{separator} fieldname filename *INU1-*INU8 menbername number number recformat recformat data structure name RPG III n/a COMIT n/a ID n/a 71-72 n/a (L) 15-17, 18-19 (L) 20-22, 23-24 IGNORE n/a n/a
| |
15
Table 9. RPG IV File Description Specification Keywords (F) (continued) RPG IV Keyword INFDS INFSR KEYLOC MAXDEV Name Name a feedback data structure File exception/error subroutine Key field location Maximum number of devices for WORKSTN file Overflow indicator Do not pass indicators SPECIAL device Name of parameter list to be passed to program for SPECIAL file Prefix, partial rename Dynamic printer control Name of RAF data file Processed by relative record number Rename record format from externally described file Save data structure Save indicators Subfiles Start line number Time format User controlled open Entry data structure name subroutine name number *ONLY | *FILE *INOA-*INOG, *INOV, *IN01-*IN99, name *NOIND program name plist name RPG III INFDS INFSR 35-38 NUM 33-34 PASS 54-59 PLIST
| |
prefix string{:number} data structure name{:COMPAT} filename fieldname external_format_name : internal_format_name data structure name number recformat : rrnfield number fmt{separator}
n/a
16
44 45
(D) 41-42 (D) ASCEND DESCEND (D) ALT (D) 7-21 (D) 33-39 (D) EXTFMT
46-51 52-54 55
56 57
17
Table 10. RPG III Extension Specification Summary Chart (E) (continued) Positions 58-80 Name Comments Entry Optional RPG IV (D) 81-100
18
19
20
22 23
Blank E Blank S U Blank C DS PI PR S Blank nnnnnnn Blank nnnnnnn +|-nnnnn Blank A B C D F G I N O P S T U Z * Blank 0-30
24-25
Type of Definition
(I) 19-20, 43
26-32 33-39
40
Decimal Positions Reserved Keywords Align integer, unsigned and float subfields Alternating array
main array_name
21
Table 12. RPG IV Definition Specification (D) (continued) Positions or Keyword ASCEND BASED CCSID Name Sort sequence Basing pointer basing_pointer_name Entry RPG III (E) 45, 57 n/a n/a n/a (I) 21-42, 43 n/a n/a format{separator} n/a (E) 45, 57 numeric constant {data area name} {external name} field name B C F I L P R S U file_name {:format_name} program name {*CL |*CWIDEN |*CNOWIDEN |{*JAVA:classname}} procedure name file_name {external name} {constant|*EXTDFT |*LIKEDS|*NULL |*USER|*JOB|*SYS} rpg_name (E) 36-39 n/a n/a (I) 21-30 (E) 43, 55
Graphic and UCS-2 CCSID number | *DFT Class Constant name Read-only parameter Compile time data Date format Sort sequence Number of elements in array Data area name Field can be exported Rename an externally described subfield External data type *JAVA:classname constant value
CLASS CONST CONST CTDATA DATFMT DESCEND DIM DTAARA EXPORT EXTFLD EXTFMT
EXTNAME EXTPGM
External file with field descriptions External prototyped program name External prototyped procedure name
| | | |
EXTPROC
FROMFILE IMPORT
File pre-run time array is loaded from Field can be imported Initialize data
| | | | |
INZ
Define a data structure like data structure name another No optimization Number of occurrences in multiple occurrence data structure Operational descriptor numeric_constant
(I) 44-47
OPDESC
n/a
22
Table 12. RPG IV Definition Specification (D) (continued) Positions or Keyword OPTIONS Name Parameter passing options for prototyped parameters Overlay data structure subfield Packed field has an even number of digits Number of elements per record Add, replace a prefix to externally described fields Field is a procedure pointer Subfields use qualified names Data item uses static storage, or Java method is static Time format File to write array or table data to Pass prototyped parameter by value Varying length character or graphic field format{separator} file_name numeric constant prefix string{:number} Entry *NOPASS *OMIT *VARSIZE *STRING *RIGHTADJ name{:pos|*NEXT} RPG III n/a
| | | | |
QUALIFIED STATIC
23
24
21-74 75-80
23-80 81-100
Table 14. RPG III Externally Described Files, Field Entries (JX) Positions 7-20 21-30 31-52 53-58 59-60 61-62 63-64 65-70 Field indicators RPG field name Control level Match fields External field name Name Entry Blank Field name Blank Field name Blank L1-L9 Blank M1-M9 Blank Blank 01-99 H1-H9 U1-U8 RT Blank Comments Optional RPG IV 7-20 21-30 31-48 49-62 63-64 65-66 67-68 69-74
71-74 75-80
75-80 81-100
Table 15. RPG III Program Described Files, Record Identification Entries (I) Positions 6 7-14 14-16 15-16 Name Form type File name Logical relationship Sequence Entry I Valid file name AND or OR Any two alphabetic characters Any two-digit number RPG IV 6 7-16 16-18 17-18
25
Table 15. RPG III Program Described Files, Record Identification Entries (I) (continued) Positions 17 Name Number Entry Blank 1 N Blank O 01-99 L1-L9, or LR H1-H9 U1-U8 RT * * Blank 1-9999 Blank N C Z D 30, 38, 46 Blank Comments Optional 47-80 81-100 RPG IV 19
18 19-20
20 21-22
Position
Any character
Table 16. RPG III Program Described Files, Field Description Entries (J) Positions 7-42 43 Data format Name Entry Blank Blank B L P R 1-9999 1-9999 Blank 0-9 Symbolic name Blank L1-L9 Blank M1-M9 Blank 01-99 L1-L9 MR U1-U8 H1-H9 RT RPG IV 7-30 36
From To Decimal positions Field name Control Level Match fields Field record relation
26
Table 16. RPG III Program Described Files, Field Description Entries (J) (continued) Positions 65-70 Name Field indicators Entry Blank 01-99 H1-H9 U1-U8 RT Blank Comments Optional RPG IV 69-74
71-74 75-80
75-80 81-100
Table 17. RPG III Data Structure Statement Specifications (DS) Positions 6 7-12 13-16 17 18 External description Option Name Form Type Data structure name Entry I Blank Data structure name Blank Blank E Blank I S U DS External name of data structure Blank Occurrences Data structure length Blank 1-9999 Blank 1-9999 Blank Comments Optional RPG IV (D) 6 (D) 7-21 n/a (D) 22 (D) 23
(D) 24-25 (D) EXTNAME n/a (D) OCCURS (D) 33-39 n/a 81-100
Table 18. RPG III Data Structure Subfield Specifications (SS) Positions 7 8 9-20 21-30 21-42 31-42 43 Data format External field name Initialization value Initialization option Name Entry Blank Blank I Blank External name of subfield Initial value Blank Blank P B RPG IV n/a (D) INZ n/a (D) EXTFLD (D) INZ n/a (D) 40
27
Table 18. RPG III Data Structure Subfield Specifications (SS) (continued) Positions 44-47 48-51 52 53-58 59-74 75-80 Comments Name From To Decimal position Subfield name Entry 1-9999 1-9999 Blank 0-9 Subfield name Blank Optional RPG IV (D) 26-32 (D) 33-39 (D) 41-42 (D) 7-21 n/a 81-100
Table 19. RPG III Named Constant Specifications (N) Positions 6 7-20 21-42 43 44-52 53-58 59-74 Constant name Constant Data type Name Form type Entry I Blank Constant value C Blank Blank Name Blank RPG IV (D) 6 n/a (D) CONST (D) 24 n/a (D) 7-21 n/a
Table 20. RPG IV Externally Described Files, Record Identification Entries (IX) Positions 6 7-16 17-20 21-22 Record identifying indicators Name Form type Record name Entry I Record format name Blank Blank 01-99 L1-L9, LR H1-H9 U1-U8 RT Blank Comments Optional RPG III 6 7-14 15-18 19-20
23-80 81-100
21-74 75-80
Table 21. RPG IV Externally Described Files, Field Entries (JX) Positions 6 7-20 21-30 31-48 49-62 63-64 RPG field name Control level External field name Name Form type Entry I Blank Field name Blank Field name Blank L1-L9 RPG III 6 7-20 21-30 31-52 53-58 59-60
28
Table 21. RPG IV Externally Described Files, Field Entries (JX) (continued) Positions 65-66 67-68 69-74 Field indicators Name Match fields Entry Blank M1-M9 Blank Blank 01-99 H1-H9 U1-U8 RT Blank Comments Optional RPG III 61-62 63-64 65-70
75-80 81-100
71-75 75-80
Table 22. RPG IV Program Described Files, Record Identification Entries (I) Positions 6 7-16 16-18 17-18 Name Form type File name Logical relationship Sequence Entry I Valid file name AND or OR Any two alphabetic characters Any two-digit number Blank 1 N Blank O Blank 01-99 L1-L9, or LR H1-H9 U1-U8 RT ** Blank 1-32766 Blank N C Z D Any character Blank Comments Optional RPG III 6 7-14 14-16 15-16
19
Number
17
20 21-22
18 19-20
Position
Character
Table 23. RPG IV Program Described Files, Field Description Entries (J) Positions 6 Name Form type Entry I RPG III 6
29
Table 23. RPG IV Program Described Files, Field Description Entries (J) (continued) Positions 7-30 31-34 35 36 Data attributes Date/Time separator Data format Name Entry Blank *VAR or Date/Time external format Any Character Blank A B C D F G I L N P R S T U Z 1-32766 1-32766 Blank 0-30 Symbolic name Blank L1-L9 Blank M1-M9 Blank 01-99 L1-L9 MR U1-U8 H1-H9 RT Blank 01-99 H1-H9 U1-U8 RT Blank Comments Optional RPG III 7-42 n/a n/a 43
From To Decimal positions Field name Control Level Match fields Field record relation
69-74
Field indicators
65-70
75-80 81-100
71-74 75-80
30
9-17
Conditioning indicators Blank 01-99 KA-KN, KP-KY L1-L9 LR MR H1-H9 RT U1-U8 OA-OG, OV Factor 1 Operation Factor 2 Result field Field length Symbolic name or literal Operation code Symbolic name or literal Field name Blank 1-30 1-256 Blank 0-9 Blank P H N Blank 01-99 KA-KN, KP-KY H1-H9 L1-L9 LR OA-OG, OV U1-U8 RT Comments
9-11
52 53
69-70 26-35
54-59
Resulting indicators
71-76
60-80
Comments
81-100
Table 25. RPG IV Calculation Specifications Summary Chart (C) Positions 6 Name Form type Entry C RPG III 6
31
Table 25. RPG IV Calculation Specifications Summary Chart (C) (continued) Positions 7-8 Name Control level Entry Blank L0 L1-L9 LR SR AN, OR RPG III 7-8
9-11
Conditioning indicators Blank 01-99 KA-KN, KP-KY L1-L9 LR MR H1-H9 RT U1-U8 OA-OG, OV Factor 1 Symbolic name or literal
9-17
Operation and extender Operation code and extender Factor 2 Result field Field length Symbolic name or literal Field name Blank 1-30 1-32767 Blank 0-30 Blank 01-99 KA-KN, KP-KY H1-H9 L1-L9 LR OA-OG, OV U1-U8 RT Blank Comments
69-70 71-76
52 54-59
77-80 81-100
Reserved Comments
n/a 60-80
Table 26. RPG IV Calculation Specifications Extended Factor 2 Summary Chart (CX) Positions 6 7-8 Name Form type Control level Entry C Blank L0 L1-L9 LR SR AN, OR RPG III n/a n/a
32
Table 26. RPG IV Calculation Specifications Extended Factor 2 Summary Chart (CX) (continued) Positions 9-11 Name Entry RPG III n/a
Conditioning indicators Blank 01-99 KA-KN, KP-KY L1-L9 LR MR H1-H9 RT U1-U8 OA-OG, OV Factor 1 Operation Extended Factor 2 Reserved Operation code and extender Expression
| | | | | | | | | | | | |
The /FREE (start free-form) and /END-FREE (end free-form) compiler directives delimit calculations in RPG IV free-form syntax.
Table 27. RPG IV Free-Form Calculation Specifications Summary Chart Positions 67 7 880 Start or end free-form specification Free-form calculation statement Name Entry Blank /FREE or /END-FREE delimiter Operation code and extendor, expression ended with a semi-colon (;) // RPG III n/a n/a n/a
680
Comments
n/a
33
34
Table 29. RPG III Externally Described Files, Field Description and Control Entries (P) Positions 6 7-22 23-31 32-37 Name Form type Reserved Field output indicators Field name Entry O Blank See output indicators Valid field name *ALL 38 39 40-74 75-80 Reserved Blank after Reserved Comments Blank Blank B Blank Optional 44 45 46-80 81-100 RPG IV 6 7-20 21-29 30-43
35
Table 30. RPG III Program Described Files, Record Identification and Control Entries (Record Line) (OD) Positions 6 7-14 14-16 15 Name Form type File name Logical relationship Type Entry O Valid file name AND or OR H or D T E ADD DEL Blank F R 0 or blank 1 2 3 0 or blank 1 2 3 01-99 A0-A9 B0-B2 01-99 A0-A9 B0-B2 Blank 01-99 KA-KN, KP-KY L1-L9 H1-H9 U1-U8 OA-OG, OV MR LR RT 1P Record group name Blank Optional RPG IV 6 7-16 16-18 17
16-18 16
18-20 18
17
40-42
18
Space after
43-45
19-20
Skip before
46-48
21-22
Skip after
49-51
23-31
Output indicators
21-29
Table 31. RPG III Program Described Files, Field Description and Control Entries (Field Line) (P) Positions 6 7-22 23-31 Name Form type Reserved Field output indicators Entry O Blank See output indicators RPG IV 6 7-21 21-29
36
Table 31. RPG III Program Described Files, Field Description and Control Entries (Field Line) (P) (continued) Positions 32-37 Name Field name Entry Valid field name PAGE, PAGE1-PAGE7 UDATE, UDAY, UMONTH, UYEAR, *DATE, *DAY, *MONTH, *YEAR *PLACE 38 Edit code Blank 1-4 5-9 A-D, J-Q, X, Y, Z Blank B Blanks, +nnn, nnn, nnnn K1-K8 44 Data Format Blank B L P R Constant or edit word Format name Blank Optional 52 44 RPG IV 30-43
39 40-43
45 47-51
Table 32. RPG IV Externally Described Files, Record Identification and Control Entries (O) Positions 6 7-16 16-18 17 Name Form type Record name Logical relationship Type Entry O Valid record-format name AND or OR H or D T E R ADD DEL RPG III 6 7-14 14-16 15
18 18-20
16 16-18
37
Table 32. RPG IV Externally Described Files, Record Identification and Control Entries (O) (continued) Positions 21-29 Name Output indicators Entry Blank 01-99 KA-KN, KP-KY L1-L9 H1-H9 U1-U8 MR LR RT 1P Record group name Blank Optional RPG III 23-31
Table 33. RPG IV Externally Described Files, Field Description and Control Entries (P) Positions 6 7-20 21-29 30-43 Name Form type Reserved Field output indicators Field name Entry O Blank See output indicators Valid field name *ALL 44 45 46-80 81-100 Reserved Blank after Reserved Comments Blank Blank B Blank Optional 38 39 40-74 75-80 RPG III 6 7-22 23-31 32-37
Table 34. RPG IV Program Described Files, Record Identification and Control Entries (Record Line) (OD) Positions 6 7-16 16-18 17 Name Form type File name AND/OR Type Entry O Valid file name AND or OR H or D T E Blank F R ADD DEL RPG III 6 7-14 14-16 15
18
16
18-20
16-18
38
Table 34. RPG IV Program Described Files, Record Identification and Control Entries (Record Line) (OD) (continued) Positions 21-29 Name Output indicators Entry Blank 01-99 KA-KN, KP-KY L1-L9 H1-H9 U1-U8 OA-OG, OV MR LR RT 1P Record group name 0 or blank 1-255 0 or blank 1-255 1-255 1-255 Blank Optional RPG III 23-31
EXCEPT name Space before Space after Skip before Skip after Reserved Comments
Table 35. RPG IV Program Described Files, Field Description and Control Entries (Field Line) (P) Positions 6 7-21 21-29 30-43 Name Form type Reserved Field output indicators Field name Entry O Blank See output indicators Valid field name PAGE, PAGE1-PAGE7 UDATE, UDAY, UMONTH, UYEAR, *DATE, *DAY, *MONTH, *YEAR *PLACE *IN, *INxx, *IN(xx) 44 Edit code Blank 1-4 5-9 A-D, J-Q, X, Y, Z Blank B Blanks, +nnnn, nnnn, nnnn K1-K10
Chapter 10. Output Specifications
38
45 47-51
39 40-43
39
Table 35. RPG IV Program Described Files, Field Description and Control Entries (Field Line) (P) (continued) Positions 52 Name Data Format Entry Blank A B C D F G I L N P R S T U Z Constant, Edit word, Data attribute, Format name Optional RPG III 44
53-80
45-70
81-100
75-80
40
41
42
| | | | | | | | | | | |
%ALLOC %CHAR
first position of a character that is not in the comparator string, or zero if not found last position of a character that is not in the comparator string, or zero if not found the date that corresponds to the specified value, or the current system date if none is specified number of days as a duration value in packed numeric format half-adjusted value in packed numeric format number of decimal digits difference between the two dates, times, or timestamps in the specified unit the quotient from the division of the two arguments string representing edited value character external display representation of float string representing edited value number of elements or occurrences 1 if the most recent file input operation or write to a subfile (for a particular file, if specified) ended in an end-of-file or beginning-of-file condition 0 otherwise
number of days numeric expression {:digits:decpos} numeric expression :digits:decpos numeric expression date or time expression: date or time expression: unit dividend: divisor non-float numeric expression:edit code {:*CURSYM | *ASTFILL | currency symbol} numeric expression non-float numeric expression:edit word array, table, or multiple occurrence data structure name {file name}
| |
%EQUAL
{file name}
1 if the most recent SETLL (for a particular file, if specified) or LOOKUP operation found an exact match 0 otherwise
%ERROR
1 if the most recent operation code with extender E specified resulted in an error 0 otherwise
%FLOAT
numeric expression
43
Table 37. RPG IV Built-In Functions Summary (continued) Name %FOUND Arguments {file name} Value Returned 1 if the most recent relevant operation (for a particular file, if specified) found a record (CHAIN, DELETE, SETGT, SETLL), an element (LOOKUP), or a match (CHECK, CHECKR, SCAN) 0 otherwise %GRAPH character, graphic, or UCS-2 expression number of hours numeric expression numeric expression any expression argument: array{:start index {:number of elements}} number of minutes number of months number of microseconds null-capable field name value in graphic format number of hours as a duration value in integer format half-adjusted value in integer format length in digits or characters array index of the matching element number of minutes as a duration number of months as a duration number of microseconds as a duration value in indicator format representing the null indicator setting for the null-capable field current occurrence of the multiple-occurrence data structure 1 if the specified file is open 0 if the specified file is closed
| | | | |
| |
%OCCUR %OPEN
| |
procedure or prototype name none pointer: numeric expression dividend: divisor replacement string: source string {:start position {:source length to replace}}
address of procedure or prototype number of parameters passed to procedure pointer to allocated storage the remainder from the division of the two arguments string produced by inserting replacement string into source string, starting at start position and replacing the specified number of characters first position of search argument in string or zero if not found number of seconds as a duration 1 if the system operator has requested shutdown 0 otherwise
%SCAN
| | | |
%SECONDS %SHTDN
%SIZE
%SQRT
44
Table 37. RPG IV Built-In Functions Summary (continued) Name %STATUS Arguments {file name} Value Returned 0 if no program or file error occurred since the most recent operation code with extender E specified most recent value set for any program or file status, if an error occurred if a file is specified, the value returned is the most recent status for that file %STR pointer{:maximum length} date or time expression: unit string:start{:length} characters addressed by pointer argument up to but not including the first x00 an unsigned numeric value that contains the specified portion of the date or time value substring the class instance of the native method {value {: time format}} the time that corresponds to the specified value, or the current system time if none is specified the timestamp that corresponds to the specified value, or the current system timestamp if none is specified *ON if there is a match *OFF otherwise %TRIM %TRIML %TRIMR %UCS2 %UNS %UNSH %XFOOT string string string character, graphic, or UCS-2 expression numeric expression numeric expression array expression from-characters: to-characters: string {: start position} number of years string with left and right blanks trimmed string with left blanks trimmed string with right blanks trimmed value in UCS-2 format value in unsigned format half-adjusted value in unsigned format sum of the elements the string with from-characters replaced by to-characters number of years as a duration
| | | | | | | | | | |
%TIMESTAMP
%TLOOKUPxx
| | |
%XLATE %YEARS
45
46
47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Table 38. RPG IV Operation Codes in Free-Form Syntax (continued) Code MONITOR NEXT ON-ERROR OPEN OTHER OUT POST READ READC READE READP READPE REL RESET RETURN ROLBK SELECT SETGT SETLL SORTA TEST UNLOCK UPDATE WHEN WRITE Free-Form Syntax MONITOR NEXT{(E)} program-device file-name ON-ERROR {exc-id {:exc-id...}} OPEN{(E)} file-name OTHER OUT{(E)} {*LOCK} data-area-name POST{(E)} {program-device} file-name READ{(EN)} name {data-structure} READC{(E)} record-name READE{(EN)} search-arg|*KEY name {data-structure} READP{(EN)} name {data-structure} READPE{(EN)} search-arg|*KEY name {data-structure} REL{(E)} program-device file-name RESET{(E)} {*NOKEY} {*ALL} name RETURN{(HMR)} expression ROLBK{(E)} SELECT SETGT{(E)} search-arg name SETLL{(E)} search-arg name SORTA array-name TEST{(EDTZ)} {dtz-format} field-name UNLOCK{(E)} name UPDATE{(E)} name {data-structure} WHEN{(MR)} indicator-expression WRITE{(E)} name {data-structure}
Traditional Syntax
v An empty column indicates that the field must be blank. v All underlined fields are required. v An underscored space denotes that there is no resulting indicator in that position. v Type III RPG III only IV RPG IV only v Symbols + Plus Minus v Extenders (RPG III) (h) Half adjust the result (n) Set pointer to *NULL after successful DEALLOC (p) Pad the result with blanks v Extenders (RPG IV)
48
(d) Pass operational descriptors on bound call (d) Date field (e) Error handling (h) Half adjust the result (m) Default precision rules (n) Do not lock record on input, if file is update (n) Set pointer to *NULL after successful DEALLOC (p) Pad the result with blanks (r) No intermediate value will have fewer decimal positions than the result (t) Time field (z) Timestamp field v Resulting indicator symbols BL Blank(s) BN Blank(s) then numeric BOF Beginning of the file EOF End of the file EQ Equal ER Error FD Found HI Greater than IN Indicator LO Less than LR Last record NR No record was found NU Numeric OF Off ON On Z Zero ZB Zero or Blank
Table 39. Operation Code Specifications Summary
| |
RPG Code ACQ (e8) ADD (h) IV IV ADDDUR (e) ALLOC (e) ANDxx
Result Field
Resulting Indicators _ ER _
+Z _ ER _ _ ER _
Comparand subroutinename
Comparand
| |
BEGSR BITOFF (BITOF) BITON CABxx CALL (e) IV CALLB (d e) CALLP (e m/r) CASxx
Bit numbers Bit numbers Comparand Comparand Program name Program name
IV
49
Resulting Indicators
| |
data-structure
Base string:start Left-most position(s) Base string:start Right-most position(s) Structure, Variable, or Record name *ALL name (variable or record format)
| | | | |
IV
CLEAR
*NOKEY
file-name
_ ER _ _ ER _
Comparand pointer-name
HI LO EQ _ ER _
IV III
DEALLOC(e/n) DEBUG DEFINE (DEFN) Identifier *LIKE *DTAARA *NAMVAR search-arg Dividend Starting value Output file Referenced field External data area External data area name Divisor Limit value
Debug info Defined field Internal program area Internal program area NR2 ER _ Quotient Index value +Z
IV III
| |
| | |
IV
IV
III
| |
IV
50
Factor 1
Result Field
Resulting Indicators
| |
IV
ENDSR IV IV EVAL (h m/r) EVALR (m/r) EXCEPT (EXCPT) EXFMT (e) EXSR IV EXTRCT (e) FEOD (e) IV FOR FORCE III FREE GOTO
label
return-point Result = Expression Result = Expression except-name format-name subroutinename Date/Time Target field :Duration Code file-name _ ER _ _ ER _ _ ER _
| | | |
| | |
index-name = start-value BY increment TO | DOWNTO limit file-name Program name Label indicator-expression Comparand *LOCK Comparand data-area-name _ ER _ _ ER _
|
IV
IF (m/r) IFxx IN (e) ITER KFLD KLIST LEAVE IV LEAVESR LOOKUP1 (LOKUP) (array) (table) MHHZO MHLZO MLHZO MLLZO Search argument Search argument KLIST name
Indicator
Key field
Array name Table name Source field Source field Source field Source field Table name Target field Target field Target field Target field
HI LO EQ7 HI LO EQ7
IV
MONITOR
51
RPG Code IV III MOVE (p) MOVE (p) MOVEA (p) IV III MOVEL (p) MOVEL (p) MULT (h) MVR
Result Field Target field Target field Target Target field Target field Product Remainder
Resulting Indicators + ZB + ZB + ZB + ZB + ZB +Z +Z _ ER _
Date/Time format
Multiplicand
Multiplier
program-device file-name Occurrence value Data structure Exception IDs file-name Comparand Comparand Occurrence value
_ ER _
| |
IV
_ ER _
_ ER _
| | | | | | | | | |
IV
POST (e)
program-device file-name name (file or record format) record-name search-arg name (file or record format) name (file or record format) search-arg name (file or record format) Length program-device file-name *NOKEY Structure, Variable, or Record name *ALL
_ ER _ _ ER EOF6 _ ER EOF6
READE (e n)5 READP (e n)5 READPE(e n)5 (REDPE(n)) REALLOC (e) REL (e) III RESET
IV
RESET (e)
*NOKEY
_ ER _
III
RETRN RETURN (h m/r) ROLBK (e) SCAN (e) Comparator string:length Base string:start Left-most position(s) expression _ ER _ _ ER FD2
IV
52
Factor 1
Factor 2
Result Field
Resulting Indicators
| | | |
search-arg search-arg
SORTA SQRT (h) SUB (h) IV IV SUBDUR (e) (duration) SUBDUR (e) (new date) SUBST (e p) TAG IV TEST (e)
9
array-name Value Minuend Date/Time/ Timestamp Date/Time/ Timestamp Length to extract Label Date/Time/ Timestamp Field Character/ Numeric field Bit numbers Character field Character field Character field Numeric Numeric/ Date/Time/ Timestamp name (file or data area) name (file or record format) data-structure _ ER _ _ ER _ _ ER _ Subtrahend Date/Time/ Timestamp Duration: Duration Code Root Difference Duration: Duration Code Date/Time/ Timestamp +Z _ ER _ _ ER _ _ ER _
IV
_ ER _
OF ON EQ NU BN BL AI JR XX
III IV
TIME TIME
| | |
IV
UNLOCK (e) (UNLCK) UPDATE (e)5 (UPDAT) WHEN (m/r) WHENxx (WHxx) Comparand
Indicator expression Comparand name (file or record format) Array name From:To String:start data-structure Sum Target string _ ER EOF6 +Z _ ER _
| |
53
Factor 1
Resulting Indicators +Z +Z
1. At least one resulting indicator is required. 2. The %FOUND built-in function can be used as an alternative to specifying an NR or FD resulting indicator. Note that in RPG III, the NR indicator is required on the CHAIN operation. 3. You must specify factor 2 or the result field. You may specify both. 4. You must specify factor 1 or the result field. You may specify both. 5. A data structure is allowed in the result field only when factor 2 contains a program-described file name. 6. The %EOF built-in function can be used as an alternative to specifying an EOF or BOF resulting indicator. Note that in RPG III, the EOF and BOF indicators are required. 7. The %EQUAL built-in function can be used to test the SETLL and LOOKUP operations. 8. For all operation codes with extender E, either the extender E or an ER error indicator can be specified, but not both. 9. You must specify the extender E or an error indicator for the TEST operation.
54
Character Data
For character data specify one of the following formats: A Fixed- or Variable Length Character N Indicator Fixed-length character fields are one or more bytes long. The default initialization value is blanks. Variable-length character fields have a declared maximum length and a current length that can vary while running a program. For internal formats, the definition specification keyword VARYING is used to specify variable-length fields. For external formats, the *VAR data attribute is used to specify variable-length fields on the corresponding input or output specification. A variable-length field is initialized by default to have a current length of zero. The indicator format is a special type of character data. Indicators are all one byte long and can only contain the character values 0 (on) and 1 (off). They are generally used to indicate the result of an operation or to condition (or control) the processing of an operation. The default value of indicators is 0. A special set of predefined RPG IV indicators (*INxx) is also available.
Graphic Data
The graphic data type is a character string where each character is represented by 2 bytes. Graphic data can be defined in either fixed-length or variable-length format. Fixed-length graphic fields are one or more double bytes long. Variable-length graphic fields have a declared maximum length and a current length, measured in double bytes, that can vary while running a program. For internal formats, the definition specification keyword VARYING is used to specify variable-length fields. For external formats, the *VAR data attribute is used to specify variable-length fields on the corresponding input or output specification. A variable-length field is initialized by default to have a current length of zero.
55
Fields defined as graphic data do not contain shift-out (SO) or shift-in (SI) characters. The default initialization value for graphic data is X'4040'. The value of *HIVAL is X'FFFF' and the value of *LOVAL is X'0000'.
UCS-2 Data
The Universal Character Set (UCS-2) format is a character string where each character is represented by 2 bytes. This character set can encode the characters for many written languages. Fields defined as UCS-2 data do not contain shift-out (SO) or shift-in (SI) characters. The length of a UCS-2 field, in bytes, is two times the number of UCS-2 characters in the field. The fixed-length UCS-2 format is a character string with a set length where each character is represented by 2 bytes. Variable-length UCS-2 fields have a declared maximum length and a current length, measured in double bytes, that can vary while running a program. For internal formats, the definition specification keyword VARYING is used to specify variable-length fields. For external formats, the *VAR data attribute is used to specify variable-length fields on the corresponding input or output specification. A variable-length field is initialized by default to have a current length of zero. You define a UCS-2 field by specifying C in the Data-Type entry of the appropriate specification. You can also define one using the LIKE keyword on the definition specification where the parameter is a UCS-2 field. The default initialization value for UCS-2 data is X'0020'. The value of *HIVAL is X'FFFF', the value of *LOVAL is X'0000', and the value of *BLANKS is X'0020'.
Numeric Data
The numeric data type represents numeric values. Numeric data has one of the following formats: binary, integer, packed-decimal, unsigned, zoned-decimal, or float. You can specify an internal format for a specific field on a definition specification in position 40. The default internal format is packed-decimal. You can specify an external format for a program-described field on the corresponding input or output specification. | | | | | | |
Table 40. Entries and Locations for Specifying External Formats Type of Field Input Output Array or Table RPG IV Specification Input - Position 36 Output - Position 52 Definition - EXTFMT keyword RPG III Specification Input - Position 43 Output - Position 44 Extension - Positions 43 an 55
For any program-described field, specify one of the following formats: B Binary F Float
56
I L P R S U
Integer Left sign Packed decimal Right sign Zoned decimal Unsigned
For numeric data other than float, the default external format is zoned decimal. The external format for compile-time arrays and tables must be zoned-decimal, left-sign or right-sign for numerics other than float. The default external format for float data is the float external display representation. For float compile-time arrays and tables, the compile-time data is specified as either a numeric literal or a float literal. The default initialization value for numeric fields is zero. The range of values allowed for an integer or float field depends on its length. Field length 4-byte float (8 digits) 8-byte float (16 digits) Range of Allowed Values -3.4028235E+38 to -1.1754944E-38, 0.0E+0, +1.1754944E-38 to +3.4028235E+38 -1.797693134862315E+308 to -2.225073858507201E308, 0.0E+0, +2.225073858507201E-308 to +1.797693134862315E+308 -128 to 127 -32768 to 32767 -2147483648 to 2147483647 -9223372036854775808 to 9223372036854775807 0 to 255 0 to 65535 0 to 4294967295 0 to 18446744073709551615
3-digit integer 5-digit integer 10-digit integer 20-digit integer 3-digit unsigned 5-digit unsigned 10-digit unsigned 20-digit unsigned
Date Data
Date fields have a predetermined size and format. There are two kinds of date data formats that can be defined on the definition specifications: 2-digit, and 4-digit year formats. Leading and trailing zeros are required for all date data. Table 41 lists the RPG-defined formats for date data and their separators.
Table 41. RPG-defined date formats and separators for Date data type Format Name Description Format (Default Separator) Valid Separators Length Example
2-Digit Year Formats *MDY *DMY *YMD Month/Day/Year Day/Month/Year Year/Month/Day mm/dd/yy dd/mm/yy yy/mm/dd / - . , & / - . , & / - . , & 8 8 8 01/15/96 15/01/96 96/01/15
57
Table 41. RPG-defined date formats and separators for Date data type (continued) Format Name *JUL Description Format (Default Separator) yy/ddd Valid Separators / - . , & Length Example
Julian
96/015
/ . -
10 10 10
Table 42 lists the *LOVAL, *HIVAL, and default values for all the RPG-defined date formats.
Table 42. Date Values Format Name Description *LOVAL 2-Digit Year Formats *MDY *DMY *YMD *JUL Month/Day/Year Day/Month/Year Year/Month/Day Julian 01/01/40 01/01/40 40/01/01 40/001 4-Digit Year Formats *ISO *USA *EUR *JIS International Standards Organization IBM USA Standard IBM European Standard Japanese Industrial Standard Christian Era 0001-01-01 01/01/0001 01.01.0001 0001-01-01 9999-12-31 12/31/9999 31.12.9999 9999-12-31 0001-01-01 01/01/0001 01.01.0001 0001-01-01 12/31/39 31/12/39 39/12/31 39/365 01/01/40 01/01/40 40/01/01 40/001 *HIVAL Default Value
Several formats are also supported for fields used by the MOVE, MOVEL, and TEST operations only. This support is provided for compatibility with externally defined values that are already in a 3-digit year format and the 4-digit year *LONGJUL format. It also applies to the 2-digit year formats when *JOBRUN is specified. Table 43 lists the valid externally defined date formats that can be used in Factor 1 of a MOVE, MOVEL, and TEST operation.
Table 43. Externally defined date formats and separators Format Name Description Format (Default Separator) Valid Separators Length Example
58
Table 43. Externally defined date formats and separators (continued) Format Name *JOBRUN1 Description Format (Default Separator) Valid Separators Length Example
Determined at run time from the DATFMT, or DATSEP job values. 3-Digit Year Formats2
9 9 9
4-Digit Year Formats *LONGJUL Notes: 1. *JOBRUN is valid only for character or numeric dates with a 2-digit year since the run-time job attribute for DATFMT can only be *MDY, *YMD, *DMY or *JUL. 2. Valid values for the century character c are: 'c' Years ----------------------0 1900-1999 1 2000-2099 . . . . . . 9 2800-2899 LongJulian yyyy/ddd / - . , & 9 2001/115
Time Data
Time fields have a predetermined size and format. They can be defined on the definition specification. Leading and trailing zeros are required for all time data. Table 44 shows the time formats supported and their separators.
Table 44. Time formats and separators for Time data type RPG Name *HMS *ISO Description Format (Default Separator) hh:mm:ss hh.mm.ss Valid Separators :.,& . Length Example
Hours:Minutes: Seconds International Standards Organization IBM USA Standard. AM and PM can be any mix of upper and lower case. IBM European Standard
8 8
14:00:00 14.00.00
*USA
hh:mm AM or : hh:mm PM
02:00 PM
*EUR
hh.mm.ss
14.00.00
59
Table 44. Time formats and separators for Time data type (continued) RPG Name *JIS Description Format (Default Separator) hh:mm:ss Valid Separators : Length Example
14:00:00
Table 45 lists the *LOVAL, *HIVAL, and default values for all the date formats.
Table 45. Time Values Format Name *HMS *ISO *USA *EUR *JIS Description Hours:Minutes:Seconds *LOVAL 00:00:00 *HIVAL 24:00:00 24.00.00 12:00 AM 24.00.00 24:00:00 Default Value 00:00:00 00.00.00 00:00 AM 00.00.00 00:00:00
International Standards Organization 00.00.00 IBM USA Standard. AM and PM can 00:00 AM be any mix of upper and lower case. IBM European Standard Japanese Industrial Standard Christian Era 00.00.00 00:00:00
If *JOBRUN is specified, the format is determined at runtime from the TIMESEP job value.
Timestamp Data
Timestamp fields have a predetermined size and format. They can be defined on the definition specification. Timestamp data must be in the format
yyyy-mm-dd-hh.mm.ss.mmmmmm (length 26).
Microseconds (.mmmmmm) are optional for timestamp literals and if not provided will be padded on the right with zeroes. Leading zeros are required for all timestamp data. The default initialization value for a timestamp is midnight of January 1, 0001 (0001-01-01-00.00.00.000000). The *HIVAL value for a timestamp is 9999-12-31-24.00.00.000000. Similarly, the *LOVAL value for timestamp is 0001-01-01-00.00.00.00000.
TIP When coding a date, time or timestamp format on a MOVE, MOVEL or TEST operation, separators are optional for character fields. To indicate that there are no separators, specify a valid format followed by a zero.
| |
60
| | | | | | | | | | | | | | | |
In position 40, you specify data type O. In the keyword section, you specify the CLASS keyword to indicate the class of the object. Specify *JAVA for the environment, and the class name. If the object is the return type of a Java constructor, the class of the returned object is the same as the class of the method so you do not specify the CLASS keyword. Instead, you specify the EXTPROC keyword, environment *JAVA, the class name, and procedure name *CONSTRUCTOR. An object cannot be based. It also cannot be a subfield of a data structure. If an object is an array or table, it must be loaded at runtime. Pre-run and compile-time arrays and tables of type Object are not allowed. Every object is initialized to *NULL, which means that the object is not associated with an instance of its class. To change the contents of an object, you must use method calls. You cannot directly access the storage used by the object. Classes are resolved at runtime. The compiler does not check that a class exists or that it is compatible with other objects.
61
62
63
64
Notices
This information was developed for products and services offered in the U.S.A. IBM may not offer the products, services, or features discussed in this document in other countries. Consult your local IBM representative for information on the products and services currently available in your area. Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM product, program, or service may be used. Any functionally equivalent product, program, or service that does not infringe any IBM intellectual property right may be used instead. However, it is the users responsibility to evaluate and verify the operation of any non-IBM product, program, or service. IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to: IBM Director of Licensing IBM Corporation North Castle Drive Armonk, NY 10504-1785 U.S.A. The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this statement may not apply to you. This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice. Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk. Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchange of information between independently created programs and other programs (including this one) and (ii) the mutual use of the information which has been exchanged, should contact: IBM Canada Ltd. Department 071 1150 Eglinton Avenue East North York, Ontario M3C 1H7 Canada
65
Such information may be available, subject to appropriate terms and conditions, including in some cases, payment of a fee. The licensed program described in this information and all licensed material available for it are provided by IBM under terms of the IBM Customer Agreement, IBM International Program License Agreement, or any equivalent agreement between us. This information contains examples of data and reports used in daily business operations. To illustrate them as completely as possible, the examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental.
M3C 1H7
If you are mailing a readers comment form from a country other than the United States, you can give the form to the local IBM branch office or IBM representative for postage-paid mailing. v If you prefer to send comments by FAX, use the following number: 1-416-448-6161 v If you prefer to send comments electronically, use one of these e-mail addresses: Comments on books: torrcf@ca.ibm.com IBMLink: toribm(torrcf) Comments on the iSeries Information Center: RCHINFOC@us.ibm.com Be sure to include the following: v The name of the book. v The publication number of the book. v The page number or topic to which your comment applies.
66
| | | |
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. UNIX is a registered trademark of The Open Group in the United States and other countries. Other company, product, and service names may be trademarks or service marks of others.
Notices
67
68
Printed in U.S.A.
SX09-1315-02