274
IBM i Programming � ILE � 7.3 SC41-5606-11 IBM

IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

  • Upload
    others

  • View
    14

  • Download
    0

Embed Size (px)

Citation preview

Page 1: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

IBM i

Programming

������ ILE

�������� 7.3

SC41-5606-11

IBM

Page 2: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,
Page 3: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

IBM i

Programming

������ ILE

�������� 7.3

SC41-5606-11

IBM

Page 4: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������

�����������������������������������������������������, ���������������� “��������” ������ 249

������������������ IBM i 7.3 (���������������� 5770-SS1) ����������� ������������������������������������������������������������� ������������������������������ RISC (reduced instruction set computer) �������� CISC ����������

������������������������ Licensed Internal Code Licensed Internal Code �������������������������������������� �����������������IBM License Agreement for Machine Code

© ������������ IBM Corporation 1997, 2016.© Copyright IBM Corporation 1997, 2016.

Page 5: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������

������� 1. ������ ILE . . . . . . . . . 1

����� 1. ���������������� IBM i 7.3 . . . . 3

����� 2. ���� PDF ������������ ILE . . . . 5

����� 3. Integrated Language Environment

Introduction . . . . . . . . . . . . . 7ILE �������? . . . . . . . . . . . . . . 7��������������� ILE . . . . . . . . . . . . 7

Binding . . . . . . . . . . . . . . . 7Modularity . . . . . . . . . . . . . . 8������������������������ (Reusable Component) . . 8������������������� (Common Runtime Service) . . . 9�������������������������������������� . . . . . . 9Source Debugger . . . . . . . . . . . . 9������������������������� . . . . . . . . . . 9��������������������������������������. . . . . 11����� Code Optimization ��������� . . . . . . . 12

�������������������� ILE . . . . . . . . . . 13��������� Original Program Model . . . . . . 13��������� Extended Program Model . . . . . . 14Integrated Language Environment Description . . . 15

����� 4. ������ ILE ����������� . . . . . 17����������������������� ILE . . . . . . . . 18���������� . . . . . . . . . . . . . . . 18��������������� (Module Object) . . . . . . . . 18������� ILE . . . . . . . . . . . . . . 20��������������� . . . . . . . . . . . . . 23���������������� . . . . . . . . . . . . . 25

Binding Directory Processing . . . . . . . . 26����������� Binder. . . . . . . . . . . . 27����������������������������� . . . . . . . . 29

Dynamic Program Calls . . . . . . . . . . 29Static Procedure Calls . . . . . . . . . . 30Procedure Pointer Calls . . . . . . . . . . 31

������������� . . . . . . . . . . . . . . 31����������������������������. . . . . . . . 33Optimizing Translator . . . . . . . . . . . 34���������� . . . . . . . . . . . . . . . 35

����� 5. ������ ILE ������� . . . . . . . 37Program Activation . . . . . . . . . . . . 37

�������� Program Activation . . . . . . . . 38Activation Group . . . . . . . . . . . . . 39

�������� Activation Group . . . . . . . . . 41Default Activation Groups . . . . . . . . . 42������������������������������-������������� . . . . 44

Service Program Activation . . . . . . . . . . 46Control Boundaries . . . . . . . . . . . . 49

������������������������������������� . . . . 49���������������������������� OPM ��� ILE CallStack . . . . . . . . . . . . . . . 50������������������������ . . . . . . . . 50

������������������� . . . . . . . . . . . 51Job Message Queues . . . . . . . . . . . 52������� Exception ������������� . . . . . . . 52����������������� Exception ��������� . . . . . . 53����������������� Exception. . . . . . . . 53���������������������������� Unhandled Exception 54������� Exception Handler . . . . . . . . . 55����������� ILE . . . . . . . . . . . . 58

��������������������������������� (DataManagement Scoping Rules) . . . . . . . . . 59

������������������� Call . . . . . . . . 59������������ Activation-Group-Level . . . . . 60�������������������� . . . . . . . . . 61

����� 6. ������������������ Teraspace

��� Single-Level . . . . . . . . . . . 63������������ Teraspace . . . . . . . . . . 63������ Teraspace ������������������� . . . . . . . 64������������������������������������� . . . . 64

��������������������������� Teraspace . . . 64�������� Activation Group ������������� . . . . . . 65�������������������������������������� . . . . 66���������������������������������������������������������������� Inherit . . . . . . . . 68����������������������: ����������������Teraspace . . . . . . . . . . . . . . 68

����������������������������� 8 ���������� C ���C++ ������ . . . . . . . . . . . . . . 69

������������������������������� C ��� C++ . . . 70

© ������������ IBM Corp. 1997, 2016 iii

Page 6: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������� . . . . . . . . . . . 70������������������������� Teraspace. . . . . . 71

��������������������� Teraspace . . . . . . . 71IBM i Interfaces ��� Teraspace . . . . . . . . 72��������������������������������� Teraspace. . . . . 73

���������������� Teraspace . . . . . . . . . . 74

����� 7. ��������������������� . . . . 79������������������ ������������������. . . . . . 79

������������������� (Use Adopted Authority -QUSEADPAUT) . . . . . . . . . . . . 80����������������� Optimization . . . . . . . 81

���������������������������������� . . . . . . . 81Symbol Resolution . . . . . . . . . . . . 82

Resolved ��� Unresolved Imports . . . . . . . 83������������������� (Bind by copy) . . . . . . 83������������������� (Bind by reference) . . . . 84������������������������������ . . . . . . 84�������������� . . . . . . . . . . . . 85������������������������������� . . . . . . 85

����������������� . . . . . . . . . . . . 90����������� Program Entry ���������� Module ��������CRTPGM . . . . . . . . . . . . . . 90����������� Export �������� CRTSRVPGM . . . . 91

��������������������������������� . . . . . . 93���� Binder . . . . . . . . . . . . . . 95

��������� . . . . . . . . . . . . . . 96������ Start Program Export ��� End Program Export 97������ Export Symbol . . . . . . . . . . . 98������������ Binder . . . . . . . . . . 100��������������������� . . . . . . . . . 109

���������������� . . . . . . . . . . . 110������������������� UPDPGM ��� UPDSRVPGM 112����������������������������������������������� 112���������������������������������������������� 112�������������������������������������������������� 113������������������������������������������������� 113

���������������������� ������� ������������������ . . . . . . . . . . . . . . . 114

����� 8. ��������� Activation Group 117���������������������������������������������� . . . 117������ Reclaim Resources . . . . . . . . . . 118

������ Reclaim Resources ������������� OPM . . 120������ Reclaim Resources ������������� ILE . . . 120������ Reclaim Activation Group . . . . . . . 120

������������������ Activation Group . . . . . . 121

����� 9. ���������������������

������� . . . . . . . . . . . . . 123Call Stack . . . . . . . . . . . . . . 123

����������� Call Stack . . . . . . . . . . 123���������������������������������������������� 124

Static Procedure Calls . . . . . . . . . . 125Procedure Pointer Calls. . . . . . . . . . 125�������������������������������������� ILE . . . 126Dynamic Program Calls . . . . . . . . . 128���������������������� Dynamic Program Call . . 128

������������������������������� (Interlanguage DataCompatibility) . . . . . . . . . . . . . 129

���������������������������������������������������������������������� . . . . . . . . . 129Operational Descriptors . . . . . . . . . 129

����������� API ��� OPM ��� ILE . . . . . . . 130

����� 10. ��������������������������� 133Single-Level Storage Heap . . . . . . . . . 133

������������ Heap . . . . . . . . . . 133Default Heap. . . . . . . . . . . . . 134Heap ����������������� (user-created heap) . . . . 134����������� Single-Heap. . . . . . . . . 135Heap Allocation Strategy . . . . . . . . . 135����������������������������� Heap ��� Single-Level . . . . . . . . . . . . . . . 136

����������� Heap . . . . . . . . . . . . 137Thread Local Storage . . . . . . . . . . . 138

����� 11. ���������������������������

�� . . . . . . . . . . . . . . . . 141Handle Cursors ��� Resume Cursors . . . . . . . 141�������������������� Exception . . . . . . . 143

��������������������������� . . . . . . . 143���������������� Message . . . . . . . . . 143������� Promote ������ . . . . . . . . . 144

���������������������������� Unhandled Exception 144Nested Exceptions . . . . . . . . . . . . 145Condition Handling . . . . . . . . . . . . 146

���������������� Condition . . . . . . . . 146�������� Condition Token . . . . . . . . 148������������������� ILE �������������������������������� . . . . . . . . . . . . . 148IBM i Messages ��� Bindable API Feedback Code 149

iv IBM i: ������ ILE

Page 7: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 12. ��������������������

������� . . . . . . . . . . . . . 151��������� . . . . . . . . . . . . . . 151

��������������������� . . . . . . . . . 151����������������������������������� . . . . 152

���������� Observability ��� Optimization �����������. . . . . . . . . . . . . . . . . 152

�������� Optimization. . . . . . . . . . 152��������������������������������� . . . . . 152Module Views . . . . . . . . . . . . 153��������������� . . . . . . . . . . . . 153������������������������������� OPM ��� ILE 154�������� Watch . . . . . . . . . . . . 154

Exception ���������������������. . . . . . . . . 154������������������������������������������ . . 154

����� 13. �����������������������

������ . . . . . . . . . . . . . . 155���������������������������� . . . . . . . . . 155��������������� Commitment Control . . . . . 156

Commitment Definitions ��� Activation Groups . . 157���������������� Commitment Control . . . . 158Commitment Control �������� activation group ��������� . . . . . . . . . . . . . . . . 159

����� 14. Bindable Application

Programming Interface ��� ILE . . . . . 161Bindable APIs ��� ILE ��������������� . . . . . . 161API ����������������������������� . . . . . . 165

����� 15. ��������������������������

������� . . . . . . . . . . . . . . 167��������������� (Program Profiling) . . . . . . 167

���������������������� . . . . . . . . . 168������������������������������� . . . . . . 168��������������������������������������������������� . . . . . . . . . . . . . . . 171����������������������������������������� . . . 172����������������������������������������������������������������������������������� . . . . . 173

����������������������������� (Interprocedural Analysis- IPA) . . . . . . . . . . . . . . . 175

������� Optimize ����������������� IPA . . . . 177IPA control file syntax . . . . . . . . . . 177����������������� IPA . . . . . . . . . . 180���������������������� IPA . . . . . . . 180

�������������������� IPA . . . . . . . . . 181��� Optimization ����������������� . . . . . . . 182

���������� Optimization ����������������� . . . . . 182����������������������������������� Optimization����������������� . . . . . . . . . . . . 182

���������� Licensed Internal Code . . . . . . . 184���������������������������� . . . . . . . . 184������������ . . . . . . . . . . . . 189�������� . . . . . . . . . . . . . . 189�������� . . . . . . . . . . . . . . 190���������������������� . . . . . . . . . . 190�������������� Licensed Internal Code ������������������ ILE . . . . . . . . . . . 191

Adaptive Code Generation . . . . . . . . . . 192������������ ACG . . . . . . . . . . . 192���������������� . . . . . . . . . . . 193��������������� . . . . . . . . . . . . 194��������������� QFRCCVNRST . . . . . . 194����������� FRCOBJCVN. . . . . . . . . 194���������������. . . . . . . . . . . . 195CodeGenTarget LICOPT . . . . . . . . . 196������������������QIBM_BN_CREATE_WITH_COMMON_CODEGEN197������������� ACG . . . . . . . . . . 198������������������������������ . . . . . . . 199��� Optimize �������������������� . . . . . . 199ACG ������������������� . . . . . . . . . 200

����� 16. �������������������������

���������� . . . . . . . . . . . . 201��������������������� . . . . . . . . . . 201����������������������������� . . . . . . . 201�������������������������������������� . . . . . 202

���������������������� 1: �������� 1 ��� �������������� . . . . . . . . . . . . . . . . 203

Storage Synchronizing Actions . . . . . . . . 204���������������������� 2 : ������������������� 2 ��� 205

����� 17. Output Listing ���������

CRTPGM, CRTSRVPGM, UPDPGM, ����

UPDSRVPGM. . . . . . . . . . . . 209Binder Listing . . . . . . . . . . . . . 209

Basic Listing . . . . . . . . . . . . . 209Extended Listing . . . . . . . . . . . 211Full Listing . . . . . . . . . . . . . 213IPA Listing Components . . . . . . . . . 214

������ v

Page 8: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������������������� . . . . . 216������������� Binder Language. . . . . . . . 218

Signature Padded . . . . . . . . . . . 219Signature Truncated . . . . . . . . . . 220Current Export Block Limits Interface . . . . . 220Duplicate Export Block. . . . . . . . . . 221Duplicate Symbol on Previous Export . . . . . 222Level Checking Cannot Be Disabled More than Once,Ignored . . . . . . . . . . . . . . 223Multiple Current Export Blocks Not Allowed, PreviousAssumed . . . . . . . . . . . . . . 223Current Export Block Is Empty . . . . . . . 224Export Block Not Completed, End-of-File Foundbefore ENDPGMEXP . . . . . . . . . . 225Export Block Not Started, STRPGMEXP Required 226Export Blocks Cannot Be Nested, ENDPGMEXPMissing . . . . . . . . . . . . . . 226Exports Must Exist inside Export Blocks . . . . . 227Identical Signatures for Dissimilar Export Blocks,Must Change Exports . . . . . . . . . . 228Multiple Wildcard Matches . . . . . . . . 228No Current Export Block . . . . . . . . . 229No Wildcard Matches . . . . . . . . . . 230Previous Export Block Is Empty . . . . . . . 230���� Signature Contains Variant Characters . . . 231SIGNATURE(*GEN) Required with LVLCHK(*NO) . . . . . . . . . . . . . . 232Signature Syntax Not Valid . . . . . . . . 232Symbol Name Required . . . . . . . . . 233

Symbol Not Allowed as Service Program Export . . 234Symbol Not Defined . . . . . . . . . . 235Syntax Not Valid . . . . . . . . . . . 235

����� 18. Exceptions ������������

Optimize . . . . . . . . . . . . . 237

����� 19. ������ CL ������������������� ILE 239������ CL �������������� . . . . . . . . . . . 239������ CL �������������������������� . . . . . . . 239������ CL ������������������������ . . . . . . . 240������ CL ��������� Binding Directory . . . . . . . 240������ CL ��������� Structured Query Language . . . . 241������ CL ��������� CICS . . . . . . . . . . . 241������ CL ������������������������ . . . . . . . . 241������ CL ���������������� Binder Language Source File 241

����� 20. ������������������� . . . . . . 243

������� 2. ������� . . . . . . . . 247

�������� . . . . . . . . . . . . 249��������������������������� . . . . . . . . 251����������������� . . . . . . . . . . . . 251������������������� . . . . . . . . . . . 252

����� . . . . . . . . . . . . . . . 253

vi IBM i: ������ ILE

Page 9: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������� 1. ������ ILE

����������������������������������������������������������������� Integrated LanguageEnvironment (ILE) ����������������� IBM® i ��������������������������������������������, ������, ����������������, ������������������������, ���������������������

����������������������������������������������� ILE ������� �������������������������������������������. �������������������������������������������������������������� ������������������������������������ ILE �����

���������������������������� IBM i �������������������� ILE �������

���������������������������������������� IBM i ����������������������� ILE ������������������������������ ILE high-level language (HLL) programmer’s guide ������������

© ������������ IBM Corp. 1997, 2016 1

Page 10: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

2 IBM i: ������ ILE

Page 11: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 1. ���������������� IBM i 7.3

�������������������������������������� ����������������������

v ����������������� Binder ����������������������������� IFS

v ������������������������������������������ 16,383 ���������������������������������������������

© ������������ IBM Corp. 1997, 2016 3

Page 12: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

4 IBM i: ������ ILE

Page 13: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 2. ���� PDF ������������ ILE

����������������������� PDF ������������

����������������������������������� PDF ������������, �������� ������ ILE

������������� PDF

������������������ PDF ���������������������� �����������������������:

1. ��������������� PDF �������������������

2. �������������������� PDF ��������

3. ��������������������������������������� PDF

4. ���� ������

������������ Adobe Reader

�������������� Adobe Reader ���������������������������� PDFs �������� ������������������������������������������������������ Adobe

(www.adobe.com/products/acrobat/readstep.html)

© ������������ IBM Corp. 1997, 2016 5

Page 14: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

6 IBM i: ������ ILE

Page 15: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 3. Integrated Language Environment Introduction

������������������� Integrated Language Environment (ILE), �������������������� ILE, ������������������������ ILE ��������������������������

ILE �������?

ILE ������������������������������������������������ �������������������������������������������������������� IBM i

������������������������������������������������������� ������������������������������������� ILE ��������������������� ILE RPG, ILE COBOL, ILE C, ILE C++, ��� ILE CL.

��������������� ILE

ILE ��������������������������������������� ������. ������ ����������������������(Binding), ����������������������� (Modularity), ������������������������ (ReusableComponents), �������������������, �������������������������������������� ����������� ��������������������������������������� �������������������������������������� ����� codeoptimization ��������� ������������������������������������� ����������������������������������.

Binding

���������������������� ���������������������� ���������� ����������������������������������. ���������������������������������������� ��������������������������������������. ���������������������������������� 2 ������ ����������������������������� DynamicProgram Call ���� External Program Call ��������������� ILE ��� Static Procedure Call ����Bound Procedure Call.

�������������������������������������������������������������������� �����������������������������������������. ������������� ILE ��������������������������������������. ������������������������� (*MODULE) ������������������������ � ��������������������������������������������������������������� (*PGM).

���������������������������������������������������������������������� ILE ��������������������������������������������. ���� ��, ������������������� ����������������������������������������������������������������������������� �� RPG, COBOL, C, C++, ��� CL.

© ������������ IBM Corp. 1997, 2016 7

Page 16: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Modularity

������������������������������������������������� ��������:

v ���������������������

������������������������������������� ��������������������������������������. ������������������������������������������ ���������������������������������������� 1 ���� 2������. ������������������ 2 ������ �������������������������������������� 2,000������. ����������������� ���������������������.

����������������������� ������������������������������������������� ILE ������������������������ 100 ���� 200 ������. �������������������������������������������������������������������������������������.

v ��������������

���������������������������������������������� ������������������������������������������. ����������������� ������������������������������������������������������������������������. ����������������������������������������������������������������������������������������������. ������� ������������������������������������������� ��������������������������������������������������������������.

v ���������������

���������������������������������������������������������������������������. �������������������������������������������� ������� ������������� �������� (logic) ����� ������������������.

v ���������������������������������������

���������������������������������������������������������. ��������������������������������������������������������������������������������. ��������������������������������������������������������������������������� �������������������������������������������������������������������.

v ����������������������������������������������������

������������������������ (Reusable Component)

���� ILE ���������������������������������������� �������������������� �������������������� ILE ����������������������������������� ILE ���������� ������� �������������������������������������������� ������� �������������������������������������� ������������������

������������������� ������������������������� ���������������������������������� ���������������������������������������������� ����������������������������������������������������� ���������������������������������.

���������������������������������������������. ���������������������������� ILE ����������� ��������������������������������� ILE ��������������.

8 IBM i: ������ ILE

Page 17: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������� (Common Runtime Service)

ILE �������������������������� (Bindable APIs ) ������ �������������������������������������. ������������������������� ����������:

���������������������������

�����������������������

�������������������

���������������������������������

������������������������

�����������������������������������������������������������������������.

������������������������������ �������������������������� API ����������� ILE. ����������������� APIs ������������������������ IBM i Information Center

��������������������������������������

���������� ILE �������������������������� OPM ���. ������������� ILE ��������������������� OPM ������������� ILE ����� ���. ����������������������� OPM ����������������������� ILE ������������� OPM ����� ����������. ���������������������������������������������������� ILE �����������������������������.

Source Debugger

��������������������������������������������������������� ILE ���. ���������������������������� ��������������� �������� ����� 12, “���������������������������”, ������ 151.

�������������������������

����������� ILE ����������������������(������������ ���������������) ����������������:

������������������������ �

���

����������������������������������������������������������������������������������������.

ILE ������������������ 3. ������������������ job ������������������������������. ������������������������������ ILE ����������� Activation Group. ������ ILE �������������������������������������������������������������:

�������

Activation group

���

����� 3. Integrated Language Environment Introduction 9

Page 18: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�����������������—���������� Open Data Path �������

���������� Open Data Paths (ODPs) �������������������������������������������������������������� ILE.

������������������������������������ ����������������������� shared ODP �������������������������� ���������������������������������������������������������������������������������������

������������ Shared ODP ����������������������������������� ������������������������������������������������������������������ ���������� ����������������������� ��������������������������������������������������. ������������������������������������������������� ��������������������������������������������������.

��������������������������������� ������������������������������:

1. ������������������������������������������ (Account Number) �������������������������������������� A1, A2, B1, C1, C2, D1, D2 �������.

2. ��������������������������������������������������� ����������������������������������������������������������������������. �������� ����������������������������� B1.

3. ��������������������. ������ D1 ������������������.

4. ���������������������������������������������������� �������������������������������� D1�������������������������������������������.

5. ������������������������� B1 ��������������������������������������� ���������������������������.

��������� D2 ����������������������. �������������������������������������������� D1����������������������������������� ����� Shared ODP �������������������������.�������������������������������������������������������� D1.

������ ILE ����������������������������������������������������������������Activation Group �����������������������. �������������������������������� ���������������� Activation Group �������������. ��������������������������������������� Shared ODP ��������������������� Activation Group ����� Shared ODP ��������������. ��������������������������������������������������������������������.

���������������������������� Activation Group ������������������������������������������������������������������������������������������������. ������� �������������������������������������������������������������������������������� �������������������������������������������������������������������������������������.

Commitment Control—��������������

����������������������������� ODP ���������������������������������������Commitment Control

10 IBM i: ������ ILE

Page 19: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������������� ����������� Commitment Control ���������������� Shared ODP��������� ILE ��������������������������������� Commitment Control ��������������������������������������� ����������������������� Commitment ������������������������������������������������

������������������������������� ��������������� ������������� commit ���������������������� commit ��������������������������������������������������������

������������������������������������������������������������������������� CommitmentControl �� Activation Group ����������������������������

��������������������������������������

����������������� ILE ��������������������������������������������������������������������������:

�������������� ���� ������� ANSI ������������������������

������������������

����������������������������������������������������������������������������.

�������—��������������

���������������� ILE Activation Group �������������������� OPM ����������������������������������. ����� ILE Activation Group ����������������������.

������������ ���������������������������������������������������. ������������������������������������������� Run Unit. ������� run unit ���������������������������������������� ������������������������������� ���������������� run unit ����� � �����������������������������������. ���������������������������������.

���������������� ILE COBOL �������������� (PRGA, PRGB ��� PRGC) ������������������������������ ������ PRGA �������� PRGB ��� PRGB ����� PRGC ����������� (����� ������ 1). �������� ILE COBOL ���������������������������� Run Unit ��������. ����������������������������������������������� ���������������������������������������������������������������������������� PRGA.

���������������������������������������������� (RPG1) ������������������� RPG1 ��������������������������� PRGB (������ 2 ������ 12). �������������������������

RV3W027-3

PRGA PRGB PRGC

ILE COBOL Run Unit

������ 1. ����������� ILE COBOL ��������� Run Unit ��������

����� 3. Integrated Language Environment Introduction 11

Page 20: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ �������������������������������������������������������������������������������������������������������� (Last Record Indicator).

������������������������������� ��������������������������� ������� RPG1 ���������������� ������������������������������������������������������������������ Run Unit ��������. ��� run unit ���������� RPG1 �����������������������������������������������������. ��������������������������������������������������. ������ RPG1 ��������������������������������������������������������� ����������������������������������������.

���������������������������������������������������������������� activation group������������ run unit �������� (������ 3). ��� Run Unit ��� ILE COBOL ������ ActivationGroup ����.

��������������������������������������� OPM run unit ��� ILE run unit ������ ILE COBOL

Programmer’s Guide

����� Code Optimization ���������

�������������� optimization ������������� ILE ����������������������� optimization������������� OPM

������������� ILE-enabled ����������������������������. ��������������������������������� Intermediate Form �������� ������������������ ��������� ILE ����������� Intermediate

RV3W028-2

PRGA PRGB PRGC

RPG1

ILE COBOL Run Unit

������ 2. ����������� ILE COBOL �������������������� ILE RPG �������������� Run Unit ��������.

RV3W029-2

PRGA PRGB PRGC

RPG1

Activation GroupILE COBOL Run Unit

������ 3. ����������� ILE RPG �� Activation Group �����������.

12 IBM i: ������ ILE

Page 21: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Code ������������������������ ������ �������� Intermediate Code ���������������������������� ILE��� optimization ��������������������������������� ILE ��������� ����������������������ILE �������

�������������������� ILE

ILE ������������������������������������������������������ IBM i ������������������������������������������������������������.

��������� AS/400 ������������������� ���������������������������������������������Original program model (OPM) �� OS/400® �������� 1 ����� 2 �������������� Extended ProgramModel (EPM)

��������� Original Program Model

���������������������������������������������� �������������������������������� ����������������������� ������������������������ (Program Object). �������������� ������������������� �������������������������������������������������������� original programmodel (OPM)

����� OPM �������������������������������� �����������������������������. �������������������������������������������������������������������������������������������������������������. ���������������������������������������������������������������������������.��������������������������������������������������������������� (entry point) ����������.

����������� �������������������������������������������������������� (call) ����������,������������������������ ���������������������������� ���������� Dynamic Program Call���������������������. ���������������������������������������������������������������� ��������������� Dynamic Program Call ��������������������

������ 4 ������ 14 �������������������������� OPM ����������������� ����������� ��������,�����, �����, CL ��� PL/I �������������������. ������������ 6.1 ���������� BASIC �����������������

������ OPM ���������������������� OPM ���������������� IBM i ��������������������������������������� compiler writer ���������������������� ������������������������������������������������������������������������������������������������������������� ���� ������������������������ ������������������������������������� CL ����������� ����������������������������� ������������������ �������

����� 3. Integrated Language Environment Introduction 13

Page 22: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������� OPM

�������������������������������������� OPM:

v ��������������������� (Dynamic Bindings)

������������ A ������������������� B �����������������������������. ���������������������������������������������������. ������������, ������������������������������������� B ����������������� ��������������������������������

������� OPM �� ������������������������ ��������������������������������� ILE ��������������������������.

v ��������������������� (Limited data sharing)

��������� OPM ���� ���������������������������������������������������������������������� ��������������� ILE ���������������������������������������������������.

��������� Extended Program Model

OPM ��������������������������������. ������������ OPM ������ ������������������������������������������������������� ���� ���� C procedure��������������������� ��������(HLL) ������������������������������ ������������������������� ������������������������������������. ���� �������� ����������������������� ��������.

������������������������������������������������ compilation units ������������������������������������������� ���������������������������� ������������� OPM ���������������������������������� Extended Program Model (EPM) ���������� ILE EPM �������������������������������������������������������� ���� Pascal ��� C.

IBM i

RV2W976-4

โมเดลโปรแกรมเดิม

(OPM)

RPG

CL

COBOL

BASIC

PL/I

������ 4. ������������������� OPM ��� IBM i

14 IBM i: ������ ILE

Page 23: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������������� IBM i ��������������� EPM ��� ��������

Integrated Language Environment Description

������ ������ 5���� ILE ��������������� IBM i ������������ OPM �������������������������������������� procedure-based ��������� EPM �����������������������. ���� ILE ����������������������������������������� ��������������������������������������������

�����������������������������������

���������� Procedure-based ���������������������:

v ���������������� (locally scoped variable)

���������������������������������������������������������. ��������������������������������� ����������������� 2 ���������������������������������� 2 ��������������������. ���������� COUNT ������������ 4 ���������������� CALCYR ������������ 6 ����� ����������� CALDAY.

����������������������������������������������������������������������������������������������������. ����������������������������������������������������� ������������������������������������������.

v ������������������ (automatic variable)

�������������������������������� ��������������������������������. ���� ����������������������� ��������������.

v ������������ (external variable)

Extended ProgramModel (EPM)

Pascal

FORTRAN

IBM i

โมเดลโปรแกรมเดิม

(OPM)Integrated LanguageEnvironment (ILE)

RPG

CL

COBOL

BASIC

PL/I

RV3W026-4

CRPG

COBOL CL

C++

������ 5. ������������������� OPM, EPM, ��� ILE ��� IBM i

����� 3. Integrated Language Environment Introduction 15

Page 24: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�����������������������������������������������������������������. ���������� A����������������������������������� ������� A ������ export export ������������������������������������������������������. ������� D ������ import�������������������������������� B ��� C ����������������. ������������������������������ imports ��� exports������������� “��������������� (Module Object)” ������ 18.

v ������������� (entry points) �������

������� OPM ������������������ ������������������������ ������������������������������������������������ PROCEDURE DIVISION. ������������������������������������������������ First-Page(1P). ������������������������� OPM ��������.

������������������������������������������������������������������������������. ������������ ��������������� ���������������������������������������������. ��������������������������� export ����������������������������������������������������������.

�� ILE ��������������������������������� ��������������� ����������������������������������������� ILE ��� �����. ����������������� ����������������� dynamic link libraries(DLLs) �� Microsoft Windows ��������������������������������������������� “���������������” ������ 23.

v ������������������

������������������������������������� ���������������������

16 IBM i: ������ ILE

Page 25: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 4. ������ ILE �����������

�������� 1������������������������� original program model (OPM) ��� Integrated LanguageEnvironment (ILE) model ������������������������������������������������ �����������������������������

�������� 1. ������������������������������� OPM ��� ILE

OPM ILE

������� ���������������������

�������������������������������� �����������������������������������������������������, ��� �������, ��������, ���Run unit �������������������������� Activation Groups����������������������������� �����������������������������

Static procedure call���������������������������������� �������������������������������������������������������������� ����������������������������

��������������������������������������������������� OPM ����������������� source

© ������������ IBM Corp. 1997, 2016 17

Page 26: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������� ILE

������� ILE ������������� 1 �����. ������������������������������������ 1 ����������������� (������ 6).

����������

������������� �������������������������� ����������������������������������������������������� (Caller). ������������ ����������� ILE C ���������������� ILE.

��������������� (Module Object)

���������������������������������������������� ���������������������� ILE. ������������������������������������ *MODULE. ����������������������������������������������������������������������� (Runnable Object). ������������������������������������� ILE ���OPM. ����������������������������� OPM ����������������������������� (RunnableProgram).

�������������������������������������������������������������� (Data Item). ������������� ILE ��������������������������������������������������������������. ������������������������������������������������������������������������������ ILE �������������� ��������������������� ILE HLL programmer’s guides.

ILE RPG, ILE COBOL, ILE C, ��� ILE C++ ��������������������������������:

v Exports

โปรแกรม A

โพรซีเดอร 2!

โพรซีเดอร ! 1

โมดูล M2

โมดูล M1

โพรซีเดอร P3!

RV

2W

1003-3

������ 6. ����������������������� ILE

18 IBM i: ������ ILE

Page 27: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Export������������������������������������������������������������� ���������������������ILE ����������������������������������������������. Export ������������������������������������� ����������.

�������������� Export ������������������ Definition.

v Imports

Import��������������������������������������������������������������������������������������. import ��������������������������������������������������.

�������������� import ������������������ Reference.

���������������������������������������������������� ILE ���������. ��������������������������������������� ��������������������������������� ������:

v �������������������� (debug data)

������������������������������������������������ ������������������� ILE. ������������������������� (optional) ����������������.

v Program entry procedure (PEP)

Program Entry Procedure ��������������������������������������������������������� ILE�� Dynamic Program Call. �������������������������������� (entry point) ��������� OPM.

v User entry procedure (UEP)

User Entry Procedure,��������������������� Dynamic Program Call �������������������������������. ������������������������������ PEP. ������������ �������� main() �������������� C ���� UEP ������������ ILE.

������ 7 ������ 20 �������������������������������. ������������� ��������������� M1 ���export ���������� ��� Draw_Line ��� Draw_Arc ��� export ����������� rtn_code. �������������� ���������� M1 ��� import ���������� Draw_Plot. ��������������������������� ������ PEP, UEP(���������� Draw_Arc) ��� ��������������������.

����� 4. ������ ILE ����������� 19

Page 28: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������� *MODULE:

v ���������� *MODULE ������������������������������ ILE.

v ���������������������������������� ILE ���������.

v ������������������������������������.

v ����� PEP ���������.

v ������������� PEP, �������������� UEP ����.

v ������ export �������������������������������.

v ������ import �������������������������������.

v �������������������������������.

������� ILE

������� ILE �������������������������������������� OPM ������:

v ����������������������� Dynamic Program Call.

v �������������������� (Entry Point) �������������.

v ���������������������������� *PGM.

������� ILE ��������������������������������������� OPM:

v ������� ILE �������������������������������������������������.

โมดูล M1

Procedure Draw_Arc;

End Draw_Arc;

Procedure Draw_Line;Dcl rtn_code EXTRN;

CallPrc Draw_Plot;

End Draw_Line;

RV3W104-0

Program Entry Procedure (PEP)

User Entry Procedure (UEP):Draw_Arc

ขอมูลดีบักสำหรับโมดูล M1!

Export: Draw_LineDraw_Arcrtn_code

Import: Draw_Plot

( )โพรซีเดอร ")(โพรซีเดอร "

( )ขอมูล!

)(โพรซีเดอร "

������ 7. ������������������������

20 IBM i: ������ ILE

Page 29: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ���������������������������������������� PEP.

v �������������������������� ’s PEP �������������� PEP ����������������������� ILE.

�������������������� Create Program (CRTPGM), ����������� ENTMOD ������������������������������������ PEP ����������� ’s entry point.

���� PEP �����������������������������������������������������������������. �������������������������������� ��������������������������. ����� PEP ��������������������.

����� dynamic program call ������������������� ILE, ����� ’s PEP ������������������program-creation �����������. ������� PEP ������� UEP ���������������������������.

������������ ILE ������������ �������������������������������������������������� (Debug Data)�������������������������������������������� ILE. ����������������������������������������������������������������� ILE.

������ 8 ������ 22 ������������� ILE �����������������. ������������ PGMEXAMP �������� PEP ������������������������������� M3 ��������. ������������� M2 ���� PEP ������� ���PEP ��� M2 ���������������.

�������������������� ������� 2 ������������������������ ������ ILE ���������� ��� M1 ��� M3��������������������� M2 ��� M4 �� ������������������ ILE ���������� ���

���������������� import ������������ ��� print��� SIN����� resolve ���������������������export ������������������ ���� PRINTS ��� MATHFUNC ��������.

����� 4. ������ ILE ����������� 21

Page 30: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������ ILE ���������� *PGM:

v �������������������� 1 ������������������ ILE ��� ������������������������������ *PGM.

v ����������������������������������� PEP ��� ’s PEP ������� ������������ PEP �������������.

v ������ dynamic program call, PEP ��� ’s �������������������� PEP ����������������������������������.

v UEP �������������� PEP ������������ entry point ��� user’s �������������.

v ��������� export ������������������������������������������.

v �������������������������������� import ����������������������������������������������������������. ���������������������������������� ���������� “���������������”������ 23.

v ���������������������������������.

v ������������������������������������ (Runnable Object)

*PGM (PGMEXAMP)

Procedure P3;

End P3;

Procedure P1;

DCL D EXTRN;

CallPrc print;

End P1;

Procedure P4;

DCL X REAL;

D=SIN(X);

End P4;

Procedure P2;

End P2;

RV2W980-5

โพรซีเดอร Program Entry (ใช PEP ในโมดูล M3)! "

โพรซีเดอร User Entry: (ใช P3 ในโมดูล M3)! "

อิมพอรตที่แกไขภายใน: P1, P2, P4, D! "

ใช PEP: นิยามในโมดูล M3"

UEP: โพรซีเดอร P3 ในโมดูล M3!

อิมพอรตที่แกไขภายนอก:! "

print in *LIBL/PRINTSSIN in MATHLIB/MATHFUNC

ขอมูลดีบัก"

ขอ" มูลดีบัก

PEPUEP: P3

PEPUEP: P2

CallPrc P2;

CallPrc P1;

CallPrc P4;

โมดูล M3

โมดูล M1

โมดูล M4

โมดูล M2

������ 8. �������������������������� ILE

22 IBM i: ������ ILE

Page 31: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������

���������������������������������������������������������������������������������������ILE ���� �������������������� . ���������� �����������������������������������������������������������������.

��������������� ������������������� ���������������� ILE ���� ���������� ������������������� ��������������� �������� ����������������������������������������������������� ������������������������������ ���� �������������������������������� ���� ����������������������������������� �������������������������������������������� ��

���������������������������������������� � ��������������������������������������������� ������ export ���������������� ILE ��������������������. ����������������� export ������������������������������������������������������������������ export ���������������������.

����������������������������� ��������������������������� �������������������������� ILE���� . ������� ������������������������������ �������������� private �������������������������������������������������� ILE �������������.

���������������������������������������� �����������������������������������������(���������������������������������) ������������ . ����������������������������������������������� ���������� (compatible) �����������.

���������� ILE ��������������������������������������� ��������� Binder Language. ��� binderlanguage ����������������������������������������������������� export. Signature���������������������������������������������� ������������������������� binder language. ��������������������������������������������������������������� ���������������������������������������������������������������������� export. ��������������������� ����������������, ����������������,������������������������������ ’ ������ �����������������, �� “���� Binder” ������ 95.

������ 9 ������ 24 �������������������������������. ���������������� ��������������������������������� ����������������������������������������������������� ILE ���� PGMEXAMP �������� 8 ������ 22. SPGMEXAMP ������������������������ P3 ��� P4 ������������������������������������ Signature ������������ Sigyy. �������������������������������� P3 ���P4 �������� ��������������������� D �������� ������� ILE ����������������������� ����������������P3 ���� P4 ���������������������.

��������������������������������� PEP ������� ��� PEP �������������������. ����������������������������� PEP ���������. ������� ����������������������������� ��������������� ������������������������������

����� 4. ������ ILE ����������� 23

Page 32: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������� *SRVPG:

v ������������ ILE ��� ��������������������������������� *SRVPGM ���.

v ����� PEP �������������������������. ���������������������������� PEP ��������������������������������������������. PEP �������� ’s ��������� ��.

v ������� ILE ������������������������������������������� export �������������������������������������������������������������.

v Signature ���������������������������������������������� export ������������������.

P3

P4

D

พับลิก

อินเตอรเฟส!

*SRVPGM(SPGMEXAMP)

Procedure P3;

End P3;

Procedure P1;DCL D EXTRN;

End P1;

Procedure P4;DCL X REAL;

End P4;

Procedure P2;

End P2;

RV2W981-8

อิมพอรตที่แกไขภายใน: P1, P2, P4, D! "

ลายเซ็นปัจจุบัน = Sigxx

ลายเซ็นกอนหนานี้ = Sigyy# "

อิมพอรตที่แกไขภายนอก:! "

ขอ" มูลดีบัก

ขอมูลดีบัก"

PEPUEP: A3

PEPUEP: A2

CallPrc P2;

CallPrc print;

D=SIN(X);

CallPrc P1;

CallPrc P4;

โมดูล M3

โมดูล M1

โมดูล M4

โมดูล M2

print in *LIBL/PRINTSSIN in MATHLIB/MATHFUNC

������ 9. ���������������������������������� ILE

24 IBM i: ������ ILE

Page 33: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ����������������������������������������������������������� ILE ������������������������������� ��������� signature �����������������������������.

v ���������������������������������.

v ������������������������������������ ����������������������

v Weak data ��������� export ����� Activation Group �������� ��������������������������������������������� ���� export ��������������������� ��������������������� weak data ����������� export ����������������������� Import ��� Export �� “���������������������������������” ������ 93.

����������������

�������������������������� ���������������������������������������������� ����������������� ILE ������������������� �������������������������������������������������������������������������������������������������������������������� ������������������������������������������������������� ��������������������������������������������� �������������������� *BNDDIR

�������������������������������������� �������������������������������������������������������������

v ��������������������������������������������������� ����������������������������������� ����������������� ILE ���� ������������������������ ������������ ���������������������������������� ������������������������������������������������������������ ������������������������������������������������ �����������������������������������������������������������������������������������������������

��������: ������������������������������������������� ������������������� ������������������������������������� ��������������������������������������������������������������������������

v ������������������������������������������� ���������������������������������������������������������������

�������������������������������������������������������� ������������������������������������������������������������������ ��������������������������������

������������������ CL �������������������������������������� �. ������ CL ���������������������� ILE ������ ����� 19, “������ CL ������������������� ILE”, ������ 239.

������ 10 ������ 26 ������� �������������������������

����� 4. ������ ILE ����������� 25

Page 34: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������� *BNDDIR:

v ����������������������������������������������������������� ������������������������������ ILE �������������������

v ������������������������������������������������������������������� ���������������������������������������������

v ������������������������������������������ *LIBL ��������������������

v �������������������������������� ������������������������������������������������������������������������������������������������������������������������������������

Binding Directory Processing

�������������������, ������������������������������������:

1. ����������������������������������� MODULE ��������. �����������������������������������������������������������������������������. ���������������, �������������������, �������������, ��������������� ������������.

2. ����������������������������������� BNDSRVPGM ��� ���������������������.�������������������������������������������� ����� resolve ��� ��������.

3. binding directory �������������������� BNDDIR ����������� ��������������. �������������������������� binding directory �������� ����������������������, ����������������������������������� resolve ����������� . entry ���������� binding directory �����������������.

4. �������������������������� �������������������� �������. ����������������������������������� binding directory. ����������������� ������������������������������������������� ����������������������������������������� �������������������������������������, ��������������������������� �����������, ���������. ����������������������binding directory �������� �����������������������, ���������������������, ���������������������������. ������������������������������������������� unresolved import ��������, ����������������� OPTION(*UNRSLVREF). �����������������, ��������������������������� ���������� resolve ���������������.

การโยงไดเร็กทอรี (ABD)

ชื่ออ็อบเจ็กต ! ชนิดอ็อบเจ็กต ! ไลบรารีอ็อบเจ็กต !

RV2W982-0

QALLOCQMATHQFREEQHFREE

*SRVPGM*SRVPGM*MODULE*SRVPGM

*LIBLQSYS*LIBLABC.

.

.

.

.

.

.

.

.

������ 10. �����������������������������������

26 IBM i: ������ ILE

Page 35: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������������, ������� CPD5D03, “Definition ������������������� ���������”, ����������������������������������������������������������� �������������������������.

�������� �������������������������������������� �����������������. ����������������������������������������������������� ������������ �������������������������������������������������� ��������� DSPMOD DETAIL(*IMPORT) �����������������������.

��������������������������������������������������� ����������� ���� ���������������,��������������� Binder Information Listing ��������� CRTPGM ���� CRTSRVPGM DETAIL(*EXTENDED). ������������������������������������������������ ���������.

����� �������������������������������������������������������������� ���������������������������������������������� Binder Information Listing ��������� CRTPGM ����CRTSRVPGM DETAIL(*EXTENDED). ������������������������������, �������������������DSPPGM ���� DSPSRVPGM ���� DETAIL(*MODULE) ������� ����������������������������*MODULE, ��� DETAIL(*SRVPGM) ��������������������������� ���������� *SRVPGM.

������������������ DSPMOD DETAIL(*REFSYSOBJ) �������������������������������������������, ��������� binding directory. ����������� binding directories ���������������������������������������� APIs ���������������������������������������������������� ���������� ������������������������� ������������������������������ ��� APIs �������������������������������������� ������������������

����������� Binder

Binder ������������������������������������������� linkage editor. ��� Binder ���binder ����������� import ������������������������������������������������. Binder ���������� export ������������������ ��������������� ��� Binding Directory ��������.

����������������� ILE ������������������� Binder �������������������������������������:

v ������������������� (Bind by copy)

����������������� ILE ������������������� ������������������������:

�������������������������������

������������������� Binding Directory ����� export ������ import ������������ resolve

Physical address ����������������������������������������������������� �������������������������������������������������������.

�������������� ������ 9 ������ 24, ���������� P3 ������� M3 ��������������� P2 �������M2. physical address ������������� P2 ������� M2 ���������������������������������� M3��������������������������������������������.

v ������������������� (Bind by reference)

����� 4. ������ ILE ����������� 27

Page 36: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Symbolic Link ����������������������� ����� export ������ import ��������� resolve ������������������������������������������������������. . Symbolic Link ����������������������������� export. ����������������������� Physical Address ��������������������������������������������������������������������.

������ 9 ������ 24 ��������������� symbolic link ����� SIN �����������������*MATHLIB/MATHFUNC. Symbolic Link ��������������� Physical Address ������������������������������������������ SPGMEXAMP �������������������������.

������������, ������������������������������������������������������������, ����������������������������������������������������������� �������:

v �����������������������������������������

v ����������������������������������������������������������������������������������������.

������ 11��� ������ 12 ������ 29 ������������������������������ ILE ���� PGMEXAMP ���������������������� SPGMEXAMP. binder �������� M1, M2, M3, M4 ������������������PRINTS ��� MATHFUNC ����������������� PGMEXAMP ������������������SPGMEXAMP.

Module M1 Module M2 Module M3 Module M4 PRINTS MATHFUNC

เซอรวิสโปรแกรม!

CRTPGM PGM(PGMEXAMP) MODULE (M1, M2, M3, M4) ENTMOD(*LIBL/M3) +

BNDSRVPGM(*LIBL/PRINTS MATHLIB/MATHFUNC)

Binder

โปรแกรม

PGMEXAMP

RV2W983-3

������ 11. ������������������� ILE. ������������������������������������������������ ������������������������������.

28 IBM i: ������ ILE

Page 37: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������������������� ILE ������������������ ����� ����� 7, “���������������������”, ������ 79.

�����������������������������

�� ILE �����������������������������������������. ILE ���������������� ������������������������������������������ call �����������������������������. ���� ILE ������������������������������ call ���������������������������������. ��������������������������� ILE ��������������������������������������������������.

���� ILE ������������������������������������������������������� Dynamic ProgramCall ������������������������������. ������ call ������������������ ILE �������������������� Dynamic Program Call ������������������������������. ������������������������������������������ Dynamic Program Call �������������������������� ���������������������������. ������������������������������������ �� OPM ��� ILE ����������������.������������������������ OPM ������ ILE �����������������.

������������������������������������������������� �������� ILE HLL programmer’s guide.

Dynamic Program Calls

Dynamic Program Call �������������������������������������� ILE ���� ����������������� OPM ��������������������������������� ILE Dynamic Program Call ��������������:

Module M1 Module M2 Module M3 Module M4 PRINTS MATHFUNC

เซอรวิสโปรแกรม!

CRTSRVPGM SRVPGM(SPGMEXAMP) MODULE (M1, M2, M3, M4) EXPORT(*SRCFILE) +

SRCFILE(*LIBL/QSRVSRC) SRCMBR(*SRVPGM) BNDSRVPGM(*LIBL/PRINTS MATHLIB/MATHFUNC)

Binder

เซอรวิสโปรแกรม!

SPGMEXAMP

RV3W030-3

������ 12. ���������������������������. ������������������������������������������������ ������������������������������.

����� 4. ������ ILE ����������� 29

Page 38: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ������� OPM ������������������ OPM ��������������� ILE ���

v ������� ILE ������������������ OPM ����������� ILE �������

v ��������������� ������������������ OPM ����������� ILE ���

Static Procedure Calls

��������������������������� ���������������������������������� ILE ������������������������������������������������������� ILE ��������. ����������������������������������������������������� ������:

v �������������������������

v ������������������������������ ILE ���������������������������.

v ��������������������������� ILE ����.

������ 13 ������ 31 ��������������� ���������������������������. ��������������������:

v ������������������� ILE ��������������������������� export ������������������������������������. ���� ���������� P1 ��������� A ��������������� P2 �����������. ���������� P3 ��������� C ����� ���������� P4 ����������������� D.

v ������������������������������������������������������ export ������������������������������������������������������. ���� ���������� P6 ����������������� B ��������������� P7 �����������. ���������� P5 ����������������� E ��������������� P4 ����������������� F.

30 IBM i: ������ ILE

Page 39: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Procedure Pointer Calls

�������� ����� 9, “����������������������������”, ������ 123 ��������������������������������������� ��������

�������������

������������������� ILE ��������� ��������������������������. ��� ���������������������������� ��������������������������������������� Activation. �����������������������activate �������. ������� �������� activation ��������������������.

Activation ���������������:

v ������������������������������������������ ��������������������������

v �������������������������������������������������� �����������������������������

RV2W993-2

โปรแกรม A

โปรแกรม C

การเรียกโพรซีเดอร !

แบบสแตติก

สแตติก

โพรซีเดอร !

การเรียก

สแตติก

โพรซีเดอร !

การเรียก

การเรียกโพรซีเดอร !แบบสแตติก

เ Eซอรวิสโปรแกรม!

เซอรวิสโปรแกรม! B

เ Dซอรวิสโปรแกรม!

เ Fซอรวิสโปรแกรม!

Module

Module

Module

Module

Module

Module

Module Module

Proc: P1

CallPrc P2

End P1

Proc: P3

CallPrc P4

End P3

Proc: P5

CallPrc P4

End P5

Proc: P6

CallPrc P7

End P6

Proc: P4

End P4

Proc: P4

End P4

Proc: P2

End P2

Proc: P7

End P7

������ 13. Static Procedure Calls

����� 4. ������ ILE ����������� 31

Page 40: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������������������������������������� ������������������������� ���������������������������� ��������������������� �������������������������������������������������������������������������� ��������������������������� ������������������������������������������������ ������������� ����������������������������’ ���������������������������������������� ��������������������������������� ����������������

������������� �������������������� activate ������� ����� ��������������������������������������������������������������� �������������������� ����������������������� activate��������������������� ����������� ������� ILE �������������������������������������V6R1 ��������������� ��� ����������������� activate ��������������������� ��� activate �������������������������������������������������������������������������������������� �������������������������� activate ���������������������������������������������� ����� �������������������� activate �������������� ��������������������� ������������������������������ ��������������������������� �����������������������

��������:

1. �������������������� activate ������������������������������ ����������������� ������������� activate �������������� ���������� ��������������

2. �������������������� activate ������������������������������ ��������������������������������������������������� ������������� activate �������������� ����������������������������������������������

������������� activation ���������������������������� ����������������������� ������*IMMED ���� *DEFER ������������� BNDSRVPGM ��� ������ CL ��������:

v Create Program (CRTPGM)

v Create Service Program (CRTSRVPGM)

v Update Program (UPDPGM)

v Update Service Program (UPDSRVPGM)

������ Add Binding Directory (ADDBNDDIRE) ���������������������� ������������������������������������ ��������� Work with Binding Directory Entries (WRKBNDDIRE) �������������������� activation ���������������������������� �� binding directory

����������������������������������������������:

v Activation ���������������������������������������������

v ������������������������������������������������� signature ��������.

�����������������������������������������������������.

���������������������������� program activation ������������� “�������� Program Activation”������ 38.

32 IBM i: ������ ILE

Page 41: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� activation ���������������������������������������������� �������������������������activation group. ����������������������������������������, ������������� activation gropu���������������������

������������������� activation group ������������ “Activation Group” ������ 39.

����������������������������

������ 14 ������ 34 ������������������������������������������������������� OPM ���ILE. �������������������������������������������������������������������������������������. ����������������������������������� ������������������������������������������������������. ��� �������������������������������������� ������������� “�������������������” ������ 51.

������������������������������������������� exception-message architecture. ������������������ Exception ���� ������������ OPM ����������� ILE ��������������������. �������Exception ����������������������������������������������������������������. ���� ���������������������������� ������������������������ Exception ������������.

���������������������������������������������������������������������������������. �������������������������������������� ���������������� ������ HLL ���������������������������������������������������. �������������������������������������������������. ���� ��������� exception ���� ��������������������������������������� ��������������������������������������������. �������������������������������������������������������������� ������������������ ���������������������.

������ 14 ������ 34 �������������� ILE ���������� OPM ��������������������� Exception���������. ������� Exception ������������������������������������������������������.�����������������������������������-���������� Exception. ������������������� API ������������������. ���������������� Exception ���������������-����������������� OPM ���������� ILE ���.

����� 4. ������ ILE ����������� 33

Page 42: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������������������������������������������� ILE ��� OPM �������������������� ������:

v ������������������� Exception ������������ ILE ���������������������������������������������������������������� Exception. ���������������� Exception ����� �������������������������������������. ������������ Exception �������������������������� (job log)���������� ILE ������������������������� ��������������������������������.

v ��� Optimization ���������������������� ILE ���������� HLL statement number ��������������������������������������. ������ optimization ������������ Exception �������������������������� HLL statement number.

����������������������������������������������������������� ����������������� “�������������������” ������ 51.

Optimizing Translator

�������������������������������������������� ��������������������������������������������� ILE ��������������������� optimization �������� ILE optimization translator ������������������ optimize ��������������������� ��������������������������� ����������, ������������������������������������������������� ������������������������������������������������������������������������ ������������������������������

��������� optimize ������������������������ �������������������������������������������� optimize �������������������������������. �������� optimization ��������:

10 ���� *NONE

20 ���� *BASIC

30 ���� *FULL

C/C++

โมเดลโปรแกรมเดิม(OPM)

Integrated LanguageEnvironment (ILE)

RPG CL RPGCL COBOL

RV3W101-1

HLL - เฉพาะตัวจัดการHLL - เฉพาะตัวจัดการ

ขอยกเวนที่ไมไดจัดการ! ! " !

แอ็คชันดีฟอลต #

สถาปัตยกรรมขอความแสดงขอยกเวน! ! !

ขอ! ยกเวนที่ไมไดจัดการ! " !

แอ็คชันดีฟอลต #

โดยตรงมอนิเตอร #

เงื่อนไขของILE

������ 14. Error Handling for OPM and ILE

34 IBM i: ������ ILE

Page 43: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

40 (�� optimization ��������� 30 ������)

����������������������������� ������ optimization ��������������������������������������������������� ��������� ���������������� optimization ������������ ��������� ������������������ ������������ �������������������������������� �������� optimization ���������������������������������������������� ��������� ����������� ���� �������������������� ������������������������� optimization ������������������

������������ optimize ������� 30 (*FULL) ���� 40 ��������������������������������������������� �������������������������������������������������� exception �����.������� ����� 12, “���������������������������”, ������ 151 ��������������������������. ������� ����� 18, “Exceptions ������������ Optimize”, ������ 237 ����������������������������������������������.

����������

ILE ���������������������������������������������. ��������������������������������������������������������������������, �������������������������������� (instruction). ����������������������� (command) ����������������. �����������������������������������������������������������������.

������������������������������ APIs ������������ ������������������������������������������������������. API ����������������������� ��������������������������������������������������.

����������������������� OPM ��������������������������� �������������������������������� OPM �������� ������������ ����������������� ILE ������������������ OPM ����������������� OPTION(*SRCDBG) ���� OPTION(*LSTDBG)

��������������������� optimize ����������� ����������� �������������������� ILE ������������������������������������� ������������������������� ���������������������������������������������������������� ������������ ��� optimize �������� 20 (*BASIC), 30 (*FULL)���� 40 ��� ����������������������������������������������������� ������������������������ ���������������������� ������������������������������������������� ������������� ����������������������� optimize �������� 10 (*NONE) �������������������������������� ����������������������������� ������ ������ optimize �������� 30 (*FULL) ���� 40 �������������������������������� ����������� ������������������������������

����������������������������������������������� ILE ���� ����� 12, “���������������������������”, ������ 151.

����� 4. ������ ILE ����������� 35

Page 44: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

36 IBM i: ������ ILE

Page 45: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 5. ������ ILE �������

������������������������������������������ ILE ����������������������, ����������������������������������������� ����� 4, “������ ILE �����������”, ������ 17

Program Activation

Activation������������������������������������������������. ����������� ILE ������������������ ���������������������������������������������

Program activation ��������������������� 2 ������� ���:

1. �����������������������������������������������������������������.

2. ������������������������������������������������.

������������������������������� 1 �������������� 2 �������������������� “Service ProgramActivation” ������ 46.

������ 15 ������ 38 �������������������������������� ���������������������� ���������������������������� IBM i ����������������������������������������� ������������������� ��������������������������������� ������������������� ����������������������������������� ������������ ��������������� activate �������������������� ��������������������������������������������������

��������� ������ 15 ������ 38 ������� program activation ���������������������������������1 ���

© ������������ IBM Corp. 1997, 2016 37

Page 46: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������� Program Activation

ILE ��������������� program activation ������������ program activation ����� activationgroup. (�������������� activation group �������������� ″Activation Group″ ������“Activation Group” ������ 39). �������������������������������� activation group ����� � �������������� activation ��������. ���������������������������������������������������������������������������������������������� ��������������������������

����������������� dynamic program call ��������� HLL ������ ILE ����� activation group ��������������������������������������. ���������������������������������������� activation group(ACTGRP) �������� Create Program (CRTPGM) ���������� Create Service Program(CRTSRVPGM). ����� program activation ������ activation group ����������������������������,activation group ��������. ������������������� activate �� activation group, �������� activate������������. ������� activation group ��������������������������������� ACTGRP ��������UPDPGM ��� UPDSRVPGM

��������������� activate ���������� activate ����������� activation group �������. ���������������� ������������ ���������������������������������������� call stack ������ 16 ������ 39 �������������������������������� 3 ������������� activation group ����� ,���������� 2 �� 3������������������������������������ call stack �������������, ������� A ��������������� B ������������ B ������������� ������� ������� B ������������������������������� A ����

โปรแกรม A

โปรแกรมคำสั่ง หนึ่งสำเนาของตัวแปรสแตติกสำหรับแตละการเปิดใชงานโปรแกรม! "

งาน งาน

Activation Group Activation Group

โปรแกรม A โปรแกรม A

ตัวแปร X = 10 ตัวแปร X = 20

หนึ่งสำเนาของคำสั่งโปรแกรมRV2W986-3

������ 15. ���������������������������������� Program Activation

38 IBM i: ������ ILE

Page 47: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������� ������� A �������������� C Call stack ��������������������� ������������� A ��� C������������������������������� B ��������������������������� call stack �������� “CallStack” ������ 123

Activation Group

���������������������������� ILE ���������� ��� activate ����������������������������������� activation group. ����������������������������������������������������������. �������������������������������������������:

�������������������������

�������������������������

���������������������������������

��������� exception �����������������������������

Activation groups ���������������������������������� single-level ������� teraspace ���������������������������������������������������������� ��������������������� ���������������� 6, “������������������ Teraspace ��� Single-Level”, ������ 63. �������������������������� single-level ��������������� ���������� ������������������������������������������������������������������������ ��� activation group ���������������������������������������� ��������������� ���������������������������teraspace, ������������������������� ������������������������������������������������������ teraspace,������������������������������������������������������������.

��������������������������������� ����������:

งาน

Activation Group

โปรแกรมที่แอ็คทีฟ

โพรซีเดอร !เรียกในโปรแกรม A

โพรซีเดอร !เรียกในโปรแกรม C

.

.

.

การเรียกแบบสแต็ก

RV

2W

987-4

โ BปรแกรมActivation

โ CปรแกรมActivation

โปรแกรม AActivation

������ 16. :NONE

����� 5. ������ ILE ������� 39

Page 48: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������� (open data path ���� ODP)

Commitment definitions

SQL cursor ��������

SQL cursor ��������

Hierarchical file system (HFS)

����������������������������

������������� Query

������� communications links

��������� ��� Common Programming Interface (CPI)

���������������������������������� activation group ���������������������. ������ ������������� activate �� activation group ���������������������������������������� .

������������������������ activation group ������������������������������������������������������������������������������������. �������������������������� ������ 17 ������ 41. ������������������������������������������������������������������������������������������������������. activation group ��������������������������������������������������������������������������������������������������.

40 IBM i: ������ ILE

Page 49: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������������������������������������������������� activation group ����� �. ���������� activation group �������� ����������������������������������������. ���� ��������������������������������������������������������� activation group �����������������. ����������������������������������������������������������������� ��������������������

�������� Activation Group

����������������������������������������������������������-�������� ������ �������������������������������������� �������� ������������������������������� ���������������������� ACTGRP ���������� CRTPGM ���������� CRTSRVPGM ������������������������������activation group ������

������� ILE ���� activation group �����������������������������������������:

v Activation group ������������������������ (User-named activation group)

����������������������� ACTGRP(name). ������������������������������������������������� ILE ��� ������������������������������������������ ��� activation group ����������������������������������������� ���������������������������������������� ����������� activation group ��������

v Activation group ���������������������� (System-named activation group)

งาน

Activation Group

Activation Group

Activation Group

Activation Group

RPG Order EntryApplicationากเวนเดอร 1จ !

RPG Accounts PayableApplicationจากเวนเดอร 2!

COBOL InventoryControlApplicationากเวนเดอรจ ! 3

C Decision SupportApplicationจากเวนเดอร 4!

RV2W988-1

������ 17. ���� Activation Group ������������������������������������������������������

����� 5. ������ ILE ������� 41

Page 50: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������� ACTGRP (*NEW) �������� CRTPGM. CRTPGM ���������������������������� activation group ������������������������. ILE ����������������� activationgroup. ���������������������������� activation group ���������������. ������������������������������ ������������������ ������������ activation group ������������������������. ������������ �����������������������������������������

v Activation group �������������������������

����������������������� ACTGRP(*CALLER). ��������������������������������������� ILE ������������������� �������������������������������������������� ��������������������������� activation group �����������������������������������������������������������������

v ������������������������������ activation group ���������������������������������������������������������.

��������������������� ACTGRP(*ENTMOD) ��������CRTPGM. ����������� programentry procedure���������������������� ENTMOD �����������������������������ACTGRP(*ENTMOD). ������������������������:

– ��������������������������� RPGLE, CBLLE, ���� CLLE ���

- ������������ STGMDL(*SNGLVL), QILE ������������ activation group

- ������������ STGMDL(*TERASPACE) , QILETS ������������ activation group

– ����������������������������� RPGLE, CBLLE ���� CLLE ���������� *NEW ��������������������

��� ACTGRP(*ENTMOD) ������������������������������������������� CRTPGM

��� activation group ������������� � ����������������� ��������������������� ������������ ��������������������������������������������������������� ���������������������� ������� activationgroup ������������������������������

�������������������� ACTGRP �������� UPDPGM ��� UPDSRVPGM ���������������������������� �������������������������� �������������������

Default Activation Groups

����������������� ��������������������������������������� ������������������� OPM �������������������������������������� ���������������������������� ������������������������������������������� ������������������������ OPM ������������������ single-level ���������������������������� �������������� default activation group ��� OPM ��� ����������������������������������������

������� ILE ���������������������������������� ������������������������ OPM ��� �������������������� �����������:

v ������� ILE ����������������������������������� ������� *CALLER �����������DFTACTGRP(*YES) ��� ����������������

42 IBM i: ������ ILE

Page 51: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������: ������� DFTACTGRP(*YES) ������������������� CRTBNDCL (ILE CL) ���CRTBNDRPG (ILE RPG) ��������

v ��������������� ILE ������������������� ������������������������������������������� OPM

v ������� ILE ������������������������������������������������������ Teraspace���

������������������������������������������������ teraspace �������� ������������������������������� ������������������������ teraspace ��������������� teraspace ���������������������������� �������������������������������������� teraspace ��� ����������������������������������������������������� ������� ILE ���������������������������������������������������������� teraspace ��� �������������������������������:

v ������� ILE ����������������������������������� ������� *CALLER �������������������

v ��������������� ILE ����������������������� *USER

��������� ������������������������������������������������� ��������������� ILE �������������������������������������������������� �������� teraspace:

v ��������������� ILE ������������������� ��������������������������������������� teraspace���������� ILE �����������������������������������������������������������*INHERIT ���������������������������� *TERASPACE

v ������������� ILE ������������������������������������������ �����������������*INHERIT ��������������������������� call stack ����������������������������������� �������������� ����������������������������������� invocation �������������������������:

– �������������������� SQL

– �������� SQL

– ��������� SQL

��������: ��������������� IBM i 7.1 ���������� �������� ������������ SQL ������������������������� ����������������� *INHERIT ������������������ ���������� �������� ������������ SQL ������������������������������������������ *SNGLVL

v ������� ILE �������������������������������������������� �����������������*TERASPACE �������������� call stack ��������������������������������������������������� teraspace �������� “�������� Activation Group �������������” ������ 65 ���������������������

������������������������ heap ��������� ������� ILE ������������������������������������������������������ ��������������������������� �������������������� ���������������� ���������������� �������������������������������������������������������� ����������� ���������������������������� ����������� ��������������������������� �������������������� �������� “������Reclaim Resources ������������� ILE” ������ 120 ������ ���������������

����� 5. ������ ILE ������� 43

Page 52: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������������������-�������������

Activation group ���������������������������������� ����������������������������������������� �� activation group ����������������� ILE ������������������������������������� ������invocation ������������������������������������� ������������ ������������� activation group ������������������������������� activation group ����������������������������������������

������������������������������ call stack (�������� “Call Stack” ������ 123) ����������������������������������� �����������������:

v HLL end verbs

������������, ������ STOP RUN ����������� ���� exit( ) ��������.

v ����� API CEETREC

v Unhandled exceptions

Unhandled exceptions ������������������������� call stack entry �� activation group ����.

v ������ return ���������������

������������������ return �������� ������ EXIT PROGRAM ����������� ��� ������RETURN ��������������.

v ������������� (Skip operation)

������������ ������������� exception ���������������������� call stack ����������������������������������������

��������������������������������������������������� ������ HLL end verbs ������������API CEETREC ��� unhandled exception ����������������� activation group ����������������������� �������������������� ������������������������������ ���������������������������������� ��������� call stack ��������������������������������������������� (���������������� hardcontrol boundary) ������������������������������������������� call stack ������������� (���������������� soft control boundary) ����������������������������� call stack �������������������������� ������������ activation group ����������

Control boundary ��� call stack entry ����������������������������������. ILE �������control boundary ���������������������� activation group. �������������������� controlboundary ������������������������ “Control Boundaries” ������ 49.

Activation group ������������������������ �������������� job ����������������������. ������activation group ���������, ����������������������������� (skip) ���� hard control boundary�������������� activation group. ��������������� ����������������������������������������������������������������������� ����������������������������� ����� ���������������������������������������� ��������������������������������� ���������������������������������������������������������������������� ������������������������������� call stack �������������������������� ������������������� ��������������������’������������ ILE HLL

44 IBM i: ������ ILE

Page 53: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ 18���������������������������� activation group ��������������� P1 ���� call stackentry �������������������������������������� (������������� ������� ACTGRP(*NEW)) ���������������� P1 ���� ���������������������������� ���������������������������������������� (�������������������� ACTGRP(name)) ���������������� P1 ������ ������������������������������

��� activation group ������������������������������������ job, �����������������������������Reclaim Activation Group (RCLACTGRP). �������������������� activation group ���. ������������������ activation group ��������������������������������.

������ 19 ������ 46 �������������������������������������� ��������������� ������������������������������������������ ���������� activation group ����������������������������� ������� call stack entry������ ���������� activate ����� activation group ���� ������ RCLACTGRP ��������� A ����������� B ���������� activation group ���������� C ���������� D.

กำหนดชื่อโดยระบบActivation Group

ACTGRP(*NEW) ACTGRP(NAME)RV2W1036-2

โ P1พรซีเดอร # โ P1พรซีเดอร #

โ Pnพรซีเดอร #โพรซีเดอร Pn#

กำหนดชื่อโดยผูใช" "Activation Group

ILEILE

สง! คืนตามปกติสงคืนตามปกติ!

ไมเคยลบ!ลบเสมอ

ขาม"ขา" ม

ILE ILE

������ 18. ������������� Activation Group ��������������������������� Activation Group ����������������������

����� 5. ������ ILE ������� 45

Page 54: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� activation group �������� ILE, ����������������������������������. ���������������������� ������������������ exit ���������������� ���������, data management cleanup, ���language cleanup (��������������). �������� “��������������������������������� (DataManagement Scoping Rules)” ������ 59 �������������������������������������������������������������� activation group �����.

Service Program Activation

������������������������������� activate ��������������� �������������������������������������������� ������������������������ “Program Activation” ������ 37. ���������activate ������������������ ��������������������� ���������������������������������activate �������:

v ��� activate ��������������� ������������������������������������ dynamic program call���������� ILE.

v ��� activate ��������������� ������������������������������������� ����������symbolic link ������� physical link.

v ��� activate ��������������� �������������������� signature.

��������� activation ����������������������������������������� ������������������ activate�������������� ��������������������������������� �����

งาน

Activation Group ใชงานอยู! "

โปรแกรมที่แอ็คทีฟ

โปรแกรมที่แอ็คทีฟ

โพรซีเดอร #

เรียกในโปรแกรม B

โพรซีเดอร #

เรียกในโปรแกรม B

การเรียกแบบสแต็ก

RV2W990-4

โปรแกรม CActivation

โปรแกรม DActivation

โปรแกรม B

โปรแกรม A

Activation Group ไมไดใชงานอยู" ! ! "

������ 19. ���� Activation Group ������������������������� Call Stack

46 IBM i: ������ ILE

Page 55: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������� activate ������������������ activation group ���������������������������������������������������������� ������������������ ������������������������������������������������������ ����������������������������������������������������������������dynamic call processing �������� ������������������ ����������������������������������������������������� ��������������� ����������������������������������������������������������������� �������������������������������������� ����������������������������������������������������� ����������������������������������������������� �������������������������������������������������������������� activate �������.

������ 20����������������������� ILE ������� A ��� ��������������� B, C, ��� D ��������������� B ��� C ������������ ��������������� E ���� ��������������������������������������������������� �������������������������

��������������������������������������� ����������������������������� ���������������ILE �������, ���������������������������:

v ������������������������������������������������������������� ���������������������������������. ����������������������������������������������������������������������.

v �������������������, ��� activate ������������������������������������������ activationgroup ����� �. �� ������ 20��������������� E ��� activate ����������������������������������������������� ���� B ��� C.

v Activation group ����������� (Y) ����������������������������������� D.

v ���������� signature �����������������������������������������.

������������������������ ����������������������������������������������������������������������������������������. ������ CRTPGM ��������� CTRSRVPGM ��������������������

ILE

ILE ILE ILE

ILE

โปรแกรม AACTGRP(X)

เซอรวิสโปรแกรม! BACTGRP(X)

เ Cซอรวิสโปรแกรม!

ACTGRP(X)เ Dซอรวิสโปรแกรม!

ACTGRP(Y)

เ Eซอรวิสโปรแกรม!

ACTGRP(*CALLER)

RV2W991-1

������ 20. Service Program Activation

����� 5. ������ ILE ������� 47

Page 56: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������ ���������������. ����������������������������������������� export ��������������������������� ��������������������������������������������������. ������������������������� ������������������������������������� ���������������������������������������������������������������������������

����������������������� activate ����� ��������������������������� ������������������������������������������������������������. ������������������������������������������ ����������������������� ������� (bind by copy) �����������������������. ������������,����������������������������������������� activate �����������������������.

������������������������������������ ������������������������������ ILE ������������������������������������� ���������� �� ������ 20 ������ 47��������������������� ������������������ A �������������������������� A ��������������������������������������������������� A ��������������������������������������������������������������� ���������������� authority ������������������ B, C ���� D ��������������������� authority ������������������ E

����� ������ 20 ������ 47�������������������� A ��������������������� B ��� D ��������� activate �������������� ��� C ������ ��� activate ������� D ����������������������������� A ���� B ��������������������������� ������ A ����������������������������������������� ������������������������������������������ ������� B ��������������������������� E��������� activate �������� C ������ E ��������� activate ������� ������������ A ��� activate������ action ��������:

v ��������������� C, D ��� E ���������������������������������������������� ��������������������������������� ���������������������������������� ������������������������������ D �������������������������� ����������������������������� activate ������������������������ �����������������

v E ��� activate �������� C ����� B ����������������������� E, E �������� activate ���������������� activate ������������������������� ������������������ activation group

v Activation group ����������� (Y) ����������������������������������� D.

v ����������������������������������������������������������������� ������������������ activate �������� ����������������� activate �������� ��������������������������� A ��� activate ������������� �������������������������� ������ C, D ��� E

������������������������������ B �������������������� ������ B ���������������������������������������������������������

������������������������������� A �������� ���������������������������� A ������������������ C, D ��� E ������������� �������������������������� B ����������������������������� B ������������������ B ������������������������������������� ��� B ��������������� activate ��������

48 IBM i: ������ ILE

Page 57: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Control Boundaries

ILE ���������������������������������������������������������������� ������������ HLL end verb�������������� API CEETREC ILE ������������������������������� call stack entry �������������������������������������������� call stack entry ���������������� ���������������

��������� ��������������� ������ “�������������������������������������”���“���������������������������� OPM ��� ILE Call Stack” ������ 50 ��������������

��������������� ������������������������������������ �����������:

v ������ ILE call stack ��� ���������� call stack ������������������������������������ ����

v ������ ILE call stack ��� ���������� call stack ������������������������������� OPM

�������������������������������������

������������������������������������������������������ �����������

������ 21���������������������������� ����������������������������������������������Invocations ������������� P2, P3 ��� P6 ������������������������������ ��� ��������� ��������������������� P7 ���������� P6 ������������ ��������� ���������������������� P4 ����P5 ���������� P3 �������������������������

Activation Group A1

การเรียกแบบสแต็ก

RV2W992-3

โ P7พรซีเดอร !

โ P5พรซีเดอร !

โพรซีเดอร ! P1

โ P4พรซีเดอร !

Activation Group A2

ILE

ILE

ILE

ILE

ILE

ILEILE

โ P6พรซีเดอร !

โ P3พรซีเดอร !โ P2พรซีเดอร !

������ 21. Control Boundaries. ��������������������������� ���������������

����� 5. ������ ILE ������� 49

Page 58: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������: �������������������������������� ����������������������� ������������������������������ �������� ���� ��������� call stack ��������������������������������������� teraspace������������������������ call stack ��������������������������������������� OPM �������������������������������� call stack ������������

���������������������������� OPM ��� ILE Call Stack

������������������������������������������ ������������� ILE call stack ���������OPM call stack

������ 22�������������� ILE ��������� (P1, P2 ��� P3) ������������������������������������OPM ����������������������������������������� CRTPGM ���� CRTSRVPGM ����������������ACTGRP(*CALLER) Invocations ������������� P1 ��� P3 ��������������������������������� ��������������� call stack ��������������������������� OPM A ��� B

������������������������

����������� ILE HLL end verb ��������� API CEETREC ILE ����������������������������call stack ������������� ���������������������� call stack entry ��������������� ��������������� ��������������������� ILE ���������������������������������

Activation Group ดีฟอลต !

*DFTACTGRPRV2W1040-1

โปรแกรม A

โปรแกรม B

โ P2พรซีเดอร !

โ P3พรซีเดอร !

โพรซีเดอร ! P1

ILE

OPM

OPM

ILE

ILE

������ 22. ������ ���������������������� ILE call stack ��������� OPM call stack. ��������������������������� ���������������

50 IBM i: ������ ILE

Page 59: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������� ������������������������������ Unhandled ������������������� ILE ����������������������������� call stack ������������������ Unhandled ��� promoted ������������������������������� ILE ������������������������� ������������� “�������������������”

������������������������������������������ call stack ������������������������������������������������������-����������� HLL end verb ��� ������������ CEETREC API ����������������������������������� �������������������������������������� ��������������������������������� ������������ call stack ������������������������������������������������������-����������� �������������������������� call stack ��������������� ��������������� ��������������������������� ����������������� call stack ��������������������������������������

������ 21 ������ 49 ������������������������ P2 ������������� P3 ���������� call stack ������������������������������������������ ��� ������ HLL end verb ������������ API CEETREC ������������ P2, P3, P4, ���� P5 (��������� P6 ���� P7) �������������������������� A2 ��������

�������������������

������������������������������������������������������������������� OPM ���������� ILE. ������������������������������������������������������������������exception message,��������� ������ 23. ������������������������������������������������������� ����� 11, “�����������������������������”, ������ 141. ������ 23��������������������������������������. �������������������������������������������������������������������������. ��������������������������������������������������������������� OPM ����������� ILE.

C/C++

โมเดลโปรแกรมเดิม(OPM)

Integrated LanguageEnvironment (ILE)

RPG CL RPGCL COBOL

RV3W101-1

HLL - เฉพาะตัวจัดการHLL - เฉพาะตัวจัดการ

ขอยกเวนที่ไมไดจัดการ! ! " !

แอ็คชันดีฟอลต #

สถาปัตยกรรมขอความแสดงขอยกเวน! ! !

ขอ! ยกเวนที่ไมไดจัดการ! " !

แอ็คชันดีฟอลต #

โดยตรงมอนิเตอร #

เงื่อนไขของILE

������ 23. ����������������������������� ILE ��� OPM

����� 5. ������ ILE ������� 51

Page 60: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Job Message Queues

message queue ���������� call ������������������������ ��� message queue ����������������������-������������������� exception ���������������������������������������call stack message queue ������������������������������ call message queue

Call message queue ��������������������������� OPM �������������� ILE ��������� call stack������� �������������������������������������������������� call stack entry ���������������������������������� �������������������������� ILE �������������� �������������������ILE ��������������������� ��������������� ILE ������������������������ �������������������������������������������� call stack entry ������� call message queue ���������������������

��������������������������������� ����������������������� ����������������� ��������������������������������������������������������������-����������������������������������

������������������������������������������� exception ������ API ��������� API ���������������� ����������� API ��� ��������������������� IBM Information Center

������� Exception �������������

������������������������������������ exception �������������������� exception ��������.

���������������������� ILE ��� OPM �������������������������� exception. ������ ������� exception ���������������������� ���������� ������:

Escape (*ESCAPE)������������������������������������������������ ��������������������������������������. ����������������������� �������������������� exception ��� escape.

Status (*STATUS)��������������������������������. ������������������������������������������� �������. ��������������������������������������������������������������.

Notify (*NOTIFY)����������������������������������������������� �������������������������������������� (calling program). ��������������������������������������������������. �������������������������������������������������������������.

Function Check����������������������������������������������. ��������������� ILE ���CEE9901, ������������������������������������������. ������������������� OPM ���escape message ����� message ID ���� CPF9999.

����������������������������������������������������������� ����������������� API ��������������������� ��� IBM i Information Center

������������� Exception ��������������������:

52 IBM i: ������ ILE

Page 61: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ����������������

�������������� (������ HLL ������) ������������ exception ������������������������������������ ���������������

v API �������������������

Send Program Message (QMHSNDPM) API ����������������� exception message �����call message queue �������������.

v ILE API

Signal a Condition (CEESGL) bindable API ����������������������������� ILE. ���������������������������� ������� exception ��� escape ������� status.

v Verb �����������������

������ ILE C ��� ILE C++, �������� raise() ���������������� C signal. ������������ ILERPG ���� ILE COBOL ����������������������������������.

����������������� Exception ���������

�������������������������� exception,��������� exception �������������. ������������������������������� exception ���������, ������������������� exception ������������������������������������������.

���������������������� exception ������������������������ exception ������������� ���������������������� exception ������ call message queue ��� OPM. HLL ��� ILE �������������� exception ���������������� exception ���������������� call message queue ��� ILE. �������������, ��������������������������� HLL ������������������� exception �������������������������������������. ��������������������������������������� HLL, HLL ��� ILE����������������������������� exception ������������������� exception ��������������.����������������������������������� HLL ������������� exception ��������������� ������������������������ HLL ��� ILE ����.

���������������������� ILE ������������������ ��������������������������������������� ���������������������������������������������� ����������������������� ILE.�������������������������� ������������������������������������� exception������������������� exception �������������. ����������������������� exception,������������������������ exception ����� ����������������������������������� exception �������. ������ “�������Exception Handler” ������ 55 ���������������������������������������� ����������������������� ILE �������������������������������������������� exception �������� ChangeException Message (QMHCHGEM) API ����������� API ��������������������� ��� IBMi Information Center

����������������� Exception

����������������������������������������������� exception. ����������������������������������������������������������� ��������������������������������������������. ������

����� 5. ������ ILE ������� 53

Page 62: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������� ILE ��� OPM ���������������������������� resume point. �������������������������������������������� exception. ���������������� exception �����������������������������resume point. ���������������������������������������������������������� resume point ������������ 11, “�����������������������������”, ������ 141.

���������������������������� Unhandled Exception

���������������������� exception �� HLL ������ , ����������������������������������������� Unhandled Exception.

������ 23 ������ 51 ����������������������������������� Unhandled Exception ��������������� exception ������������������ OPM ����������� ILE. ��������������������������������������� 2 ���������������������������������������������������������������������.

������ Unhandled Exception ��������� OPM ����������������� escape �����������������������������������. ������ message ID ���� CPF9999. �������������� call message queue ��� callstack entry ������������������� exception ���. ����������������������������������,����������call stack entry ������������. ���������������������������������������� call stack entry�����������. �����������������������������������������������������������. ������������������������������������� job �������������.

������ Unhandled Exception ���������� ILE ���������������������� call stack entry messagequeue �����������. Percolation �������������������� exception ������������ call message queue�������������������. ����������������������������� exception ����������������� call messagequeue �����������. ����������������������������, ��������� exception ������������������� callstack entry �����������.

Percolation ���unhandled exception ���������������������������������� �������������������� exception ���������. ����������������������������� exception ������������������������������������������� ������������������ exception:

1. ������� exception ����� exception ����������� ��� �����������������������������������

2. ��� exception ������� notify,��������������������������, ��� exception �����������,�������������������������������������

3. ������� escape exception ������������������������������������� ��������������� ������������������������������������ ���� ������������������������������ (����������������)

4. ���������������������������� ILE ����������������������������������� ������������������������������������ ������ call stack ������������������� ������ �������������������������� ��������������������� invocation ������������������������������������������������������-����������� ��������������������������� ������� exception ��������������������������������������� ILE ���������� ���� �������������� ������������������� CEE9901������������ ILE ����������� call stack ������������������������������������

54 IBM i: ������ ILE

Page 63: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ 24���� escape exception �������������������� ILE ������������� invocation �������������P1 ������������������ ���������������� invocation ���������������� �������������������������������� ���������� P4 ��������� escape exception Escape exception ��������������������������� P1 ������������������� ���������������������������������������������’ ���������� P3 ����������������������������������������������������� ��������� P1 ������������������������������������ ������������������������ ������� CEE9901 escapeexception ����������������� call stack ��������������������������� ��������� (������� A)

����������������������������������� exception ��������������� ������������� ILE ������������������������������������������������������������������������. ���������������������������������, ILE ������� failure message �������������� ����. ����������������������������������������������������������������.

������� Exception Handler

������������������������������������������� exception handler ������������� OPM ���������� ILE. ��������� ������ 23 ������ 51 ������������������������������������������exception. ����������������������� ILE ���������������������������� exception �������OPM.

Activation Group

การเรียกแบบสแต็ก

โ P4พรซีเดอร "

โปรแกรม A

OPM

ILE

ILE

ILE

ILE

โ P2พรซีเดอร "

แพรกระจาย!

ไมไดถูกจัดการ! #

ขอยกเวน# #

แพรกระจาย!

ฟังกชัน"

การตรวจสอบ

โ P3พรซีเดอร "

โพรซีเดอร " P1

จุดการกลับสูการทำงาน!

สง!การยกเลิกขอยกเวน# #

CEE9901

RV2W1043-1

������ 24. ����������������������������� Unhandled Exception.

����� 5. ������ ILE ������� 55

Page 64: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������� OPM, ��������������������������� HLL ���������������������������� 1���������������������� call stack entry. �������������������������� ����� exception ������������������ OPM.

��������������������������� HLL �� ILE ������������������������������. ��� ILE ������������ exception handler ������������. ��������������������������������������������������������������� exception �������������������������������������������������������������� HLL ����������. ���������������������� ILE ������:

�������������������������

����������������������� ILE

��������������� HLL �������������� ������������������������, ������� ILE HLLprogrammer’s guide.

���������������������������������������������������������� exception ��� � ������HLL ������� source ���������. ������ ILE C ��������������������������������� #pragma.���� ILE COBOL ����������������������������������������� ILE C. ������� ILECOBOL�������������������������������������������������������. ������������, ����������

ADD a TO b ON SIZE ERROR imperative

��������������������������������������� ������ �������������������� HLL ������� ������������������������������������� �������������������������� ���� ������������������������ imperative �������������� ��������������������� ILE (������������� ���� CEEHDLR)�������������������������������������������� COBOL.

����������������� ILE������������ ����������������������������������������� �������������������� ILE ��������������������� call stack entry ����������������� ����������������������������������� ILE, ������ Register a User-Written Condition Handler (CEEHDLR) bindable APIAPI ����������������������������������������������������������� ���������������������� API��� CEEHDLR ���������������������������� (declare) ���������������������������������������������������. CEEHDLR ��������������������������������. �������,����������������������������� ����������������������������������������������. ����������������������� ILE������ ���������������� ������������ Unregister a User-Written Condition Handler(CEEHDLU) bindable API.

���� OPM ��� ILE ������������������������� HLL. ����������������� HLL ��������������������������������������������������������. ������������, �� ILE C ����������������� signal ������������������ exception. HLL������������������������������RPG��������������������������� exception ������������������� (E extender),��������������� (MONITOR), ���������������������������� (*PSSR ������������ INFSR). ��������������������������� HLL �� COBOL ��������� USE ���������������������������� I/O����������������������������������� ���� ON SIZE ERROR ��� AT INVALID KEY.

56 IBM i: ������ ILE

Page 65: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������� exception handler ������������� ������������������������������ HLL ���exception handler ��� ILE ��������.

������ 25 ������ 58 ���� call stack entry �������������������� P2. �������������, ������������� 3������������������ call stack entry �����. ����������������������������������������, �������������������������������������������. �������������������������������������������������������������. �����������������������������. ������������ exception message ��������, exceptionhandler ������������������������:

1. �������������������������

��������������������������������, �������������������������. �������������� ��������������������������������; RPG (E), MONITOR, INFSR ����������������������;��������� COBOL ������������������ imperative ��������������������� ����������������������� ILE ���������������, ����������������������� ILE �������������������������������������� HLL.

��������������������������������������� � ������������� exception, ������������������������������������������������� HLL. ������������ ������������� P2 �� ������ 25 ������ 58 ������������������� HLL ������������� P1 ��������������������������� ,������������ P2’ �������������������������������������������� P1’.

���������������������������������� nest ���. ������������������������� nesteddirect monitor �������������������������������������� nested monitor ����������������������������������������������.

2. ����������������������� ILE

�������������������������� ILE ������������� call stack entry ���, �������������������������������������. �������������� �������������� ILE ����� ������������������ �������������� P5��� P6 ��������������������������������� ILE. ������������������������������ ILE���������������� call stack entry ��������, ����������������������������������� last-in-first-out (LIFO). �������������, HLL-specific handlers �� ������������������������, �������� direct monitor handler ��� condition handler. Exception ������������������ HLL ��������������������������������������������� ������

3. ����������������� HLL

���������������� ��������������������������.

�������������������� exception ������������ exception ��������������������������������������. ���������������������������������� ��������������������������� ILE , ��������������������� exception �������������������. Control Action ���� � ��������������. ������������,���������������������������������� Control Action. ���������������� exception �����������������, ���������������������� exception ������������������������������������������.��� exception ��������������� �� call stack entry ��������, percolation ��������������������� callstack entry �����������. ����������������������������� HLL ���� , HLL ��� ILE ������������������������������� exception �������������� call stack entry �����������.

����� 5. ������ ILE ������� 57

Page 66: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������� ILE

������������������������������������������� ILE �������� ����������������������������������������� ���������������� ����������� ILE ���������������������������������� HLL����������������� �������� ILE �������������������� exception �������������� ����������� ILE������������ condition token Condition token ����������������������� 12 ���� ��������������������������������� ����. ����������������������������������� ����������������������������������������� exception �������������

������������������������������������������, ��������������������������������������� ILE��� ILE condition token. ��������������������������������������������� ILE ������� ����� 11,“�����������������������������”, ������ 141.

การเรียกแบบสแต็ก

RV2W1041-3

โพ P1รซีเดอร !

ILE

ILE

ILE

ILE

ILE

ILE

ILE

โพ P3รซีเดอร !

ภาษามาตรฐานดีฟอลต !

มอนิเตอรโดยตรง!ตัวจัดการ

โ P4พรซีเดอร !

เงื่อนไข ILEตัวจัดการ

โพ P5รซีเดอร !

เขาหลัง"

ออกกอน#

เงื่อนไข ILEตัวจัดการ

โพ P6รซีเดอร !

HLL - เฉพาะตัวจัดการ

โพ P7รซีเดอร !

โพรซีเดอร P2!

ขอยกเวนเกิดขึ้น" "

ลำดับความสำคัญ

ของตัวจัดการขอยกเวน" "

.

.

.

������ 25. Exception Handler Priority

58 IBM i: ������ ILE

Page 67: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������������������� (Data Management Scoping Rules)

��������������������������������� ������������������������������������ (datamanagement resource). �������������������������������������������������������������������������������. ������������, ��������������������� ����� ����������������� open data path (ODP)�����������������������������������������������. ����������������������������������������������� �������������������������������������������.

��������������������������������� ������������������������������������������������������������������������� call stack. ������������, ���������������������������������� SHARE(*YES) �������������� commitment definition �����������������������������������������������. �������������������������������������������� ��������������������������������������������������������������.

��������������������������������� ���������������������������. ��������������������������������������������������� �������������������������������������. ����������������������������������� ����������������������������������������������������������������������������.

ILE ���������������������������������������������� �������������� OPM ����������ILE ������������������������������� ������:

Call

Activation group

Job

��������������������������������������������������������������������������������������������.������������������������������������, ���������������������������������������������.

������������������������������������������������ ������������������������������ ����������� 13, “�����������������������������”, ������ 155.

������������������� Call

��������������� Call ���������������������������������������������� call stack entry �������������������. ������ 26 ������ 60 ������������������������������ Call. ���������������������������������������������������������������� default activation group. �������� �������OPM A, ������� OPM B, �������������� ILE P2 ���������������������������������������������������� F1, F2, ���� F3. �������������������� ODP ������������������������������������call-level �����������. ������ RCLRSC ��������������������� �������������� call-level ���������������������������.

����� 5. ������ ILE ������� 59

Page 68: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������������������� call ����������������������������� call stack entry �������������. ������������������������� call stack entry ��� ��������������� call ����������������������.

������������ Activation-Group-Level

����������������������������������������� ��������������������������� �������������������������������������������������� ILE �������������� invocation ������������������� ����������������������������� ���������������������������������� ������������������������������������������������� ������ 27 ������ 61 ���������������������������������� activation group �������������������������������������������������������������������������� �������������������ILE ���������������� �������������������������� ������������� ODP ������� F1, F2, F3 ���override R1 ���������������� activation group

การเรียกแบบสแต็ก

RV

2W

1037-2

โ Aปรแกรม

UEP P2

PEP P1

โปรแกรม B

OPM

ILE

ILE

OPM

ODP F1

ODP F2

ODP F3

Override R1

������ 26. ������������������� Call. ODP ������������(Overrides) ������������������ call ������.

60 IBM i: ������ ILE

Page 69: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������������������������������������������������� activation group������������������������������������������ activation group ��������. ��������������������������������������������������. ������������, ������������� F1 ������������������������������ SHARE (*YES). ���� F1 ���������������������� ILE ��� ���������� activation group��������. ����������������� F1 �� activation group �������������������������� ODP ������� 2��������������.

��������������������

����������������������������������������������������������������������. ����������������������������������� OPM ���������� ILE. ����������������������������������������������������������������������������������������� activation group ���������������. ����������������������������������������� ���������������������������������� activation group ������������������������������������������������� activation group ������������. ��������������������������������������� job ��������������������������������������������������������� ILE ���������� OPM ����������������������.

������ 28 ������ 62 �����������������������������������. ������� A ����������� F1,�����������������������������������. ODP ��������������������������. �����������������������������������������. ��� ODP �������������������������� SHARE (YES) ������� OPM�������������� ILE ���������������������������.

RV3W102-0

PEP P1

UEP P2

โพรซีเดอร P3!

ILE

ILE

ILE

ODP F1

ODP F2

ODP F3

รีซอรสการจัดการขอมูล! "

.

.

.

Override R1

ILE Activation Group

������ 27. Activation Group Level Scoping. ODP ��� override ���������������������� activation group.

����� 5. ������ ILE ������� 61

Page 70: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������������������������������������������������������������. �������������, override R1 ��������������� ���������� P2. ������������������� ���������������������������������������������������. ������������������������������������������������������������������������������������������. ����������������������� call ����������������� ������������������������� call stack.

������������������������������������� ����������������� ��������������������������������������� override, ������ commitment control ������� API. ������������������������������������������������������������������ �� ����� 13, “�����������������������������”,������ 155.

ILE Activation Group

Activation Group ดีฟอลต !

RV2W1039-2

โปรแกรม A

โปรแกรม B

PEP P1

UEP P2

OPM

OPM

ILE

ILE

ODP F1

Override R1

Commitmentนิยาม *JOB

การจัดการขอมูล"รีซอรส!

.

.

.

งาน

������ 28. ��������������������. ODP, override ��� commitment definition ���������������������������.

62 IBM i: ������ ILE

Page 71: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 6. ������������������ Teraspace ��� Single-Level

����������������� ILE �������������������������� �������������������������������������:

v Single-level storage

v Teraspace

v Inherit

������������������� Inherit ���������������������������� �������������� Teraspace���� Single-level ��� Activation Group ��� ������������������������� ������� ILE ����������������� Single-level �������������

��������������������������� teraspace

������������ Teraspace

Teraspace ������������������������������������ ���������������������������������������. ������������������������������������������� ���������������������������������������������. �������������� Teraspace ���������������������������������������������� ���������������������

�������������� Teraspace ���������������� Space ��������������������������������������������� ���������������������������������������������� ������������ Teraspace �������������������������������������� Space ����������������

����������������������������������������������������������� Single-level ��� ���Teraspace

�������� 2. ��������������������������������������� Single-level ������ Teraspace

������������ Teraspace Single-level storage

������������ �����: ����������������������������������������.

������: ����������������������������������������.

���� ���������������� 100 TB ������� 16 MB ���������

��������������������������? ��� ���

������������ 8 ����? ��� ���

����������������������������? ������� API ����������������������������������������� (���� shmat���� mmap).

���������������������������������������� ������� API ���������������������������������.

© ������������ IBM Corp. 1997, 2016 63

Page 72: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ Teraspace �������������������

’ ��������������������������������������� ��������������������������������������������������������� ������ ��������������

�������������� ��������������������������������������� heap ������������������������������������������ ������������������������������� ������������������� heap ����������������������������������������’ ���

���������� ILE C ��� C++ ��������������������������� TERASPACE (*YES *TSIFC) ������������������������������ teraspace �������������������������� heap ��������������������single-level ��������������������������������� ���� malloc()������������������������_C_TS_malloc()���

���������� ILE RPG �������������������������������� heap ����������������������������������������������� ���������������� ALLOC �� Control Specification

������ ������������������������ ILE C/C++

���� ������������������������ ILE RPG

������������������������� ��������������������������

�������������������������������������

��������������������������������������������� ILE �������� ����������������� teraspace��� ������������������������������������ Teraspace ����������� Teraspace ��������������������������, ������ �������������� �������������������������������� Teraspace �����������������������������������������������. ���������� “�������������������������Teraspace” ������ 71 ����������������������������������������������������� Teraspace.

����������� ������� ������������������ ��� ����������������������������������������������������������������� �������������������������:

v ������������ Single-level (*SNGLVL)

v Teraspace (*TERASPACE)

v Inherit (*INHERIT)

�������������������������������������������� Teraspace.

��������������������������� Teraspace

��������������������������� teraspace ������������� RPG, COBOL, C ���� C++ ������������������������� �������������������������:

1. ������ C ��� C++ ������� *YES ������������� TERASPACE ������������������������

64 IBM i: ������ ILE

Page 73: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

2. ����� *TERASPACE ���� *INHERIT ������������� Storage model (STGMDL) ��������������������������������������� ILE

3. ���� *TERASPACE ������������� STGMDL ��������� Create Program (CRTPGM) orCreate Service Program (CRTSRVPGM) ����������������������������������������������������������������������������. ���������� “��������������������������” ������67 �������������������������.

���������������� *TERASPACE ������������� STGMDL ��������� Create Bound CProgram (CRTBNDC), Create Bound C++ Program (CRTBNDCPP), Create Bound RPGProgram (CRTBNDRPG) ��� Create Bound COBOL Program (CRTBNDCBL) ������������������������������� �������������������������������

�������� CRTPGM ��� CRTSRVPGM ������������� *INHERIT �������������STGMDL ����� ����������� ������������������������������������������������������������� �������������� single-level ���� teraspace ����������������������������� ��������activation group ���������������������������������� �����������

������������������ *INHERIT �������������������������� ����������������� *CALLER������������� ACTGRP ����. ��������������������������������������������������������������������� ����������������� single-level ���� teraspace ���������� ��������������������������������������������� ������������ ����������������������������������������������������������� ����������������� single-level

�������� 3. ���������������������������������������������������������

�����������������������������

����������������

OPM *PGM ILE *PGM ILE *SRVPGM

*TERASPACE ��� ��� ���

*INHERIT ��� ��� �������� ACTGRP(*CALLER) ��������)

��� �������� ACTGRP(*CALLER) ��������)

*SNGLVL ��� ��� ���

�������� Activation Group �������������

Activation Group ����������������������������������������������� Activation Group����������. ���������������������������������������������������������, ������ ���������������������������.

�������������������������������� Single-level ���������������������������, ����������������� ������� Single-level ����������������� ����������������������������������������� Heap ���� ��� Single-level ����

������������������������������������ Teraspace ���������������������������, ������������������������ Teraspace. ����������������� ����������������������������������������� Heap ������� Teraspace ����.

����� 6. ������������������ Teraspace ��� Single-Level 65

Page 74: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������������������� teraspace ������������������� ����������������������������������������������������� single-level (���������������������������������� OPM����) ����������������������������������� Single-level ������������������� ��Activation Group ������������������������������������ Teraspace �������

����������������������������������������������������� Activation Group ��������.

�������� 4. ���������������������������������� Activation Group

�����������������������������

��������������� Activation Group

*CALLER *DFTACTGRP *NEW Named

*TERASPACE ��� ���������. ��� ���

*INHERIT ��� ���������. ���������. ���������.

*SNGLVL ��� ��� ��� ���

������������� Activation Group ���������� ��������������������������������������� ������������������������������:

v ���������������������������� STGMDL(*INHERIT) ������ ������������ ACTGRP(*CALLER) ��������.

v �������������������� STGMDL(*TERASPACE) ������:

– ����������� ACTGRP(*NEW) ���� Named Activation Group.

– ������� ACTGRP(*CALLER) ������������������������������������������������������������������������������� Teraspace.

��������������������������������������

�����������������������������������������������������������������������������������.�������������������������������������������� ���������������������������.

v “��������������������������” ������ 67

v “������������������������������������” ������ 67

v “�������������������������������������������” ������ 68

v “��������������������������������” ������ 68

66 IBM i: ������ ILE

Page 75: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������������

���������������������������������������������:

����������: �������� M ������������������������������������.

�����������������������������������������.

Teraspace Inherit Single-levelstorage

M

Teraspace Teraspace ���������� ����������

Inherit Teraspace Inherit Single-levelstorage

Single-levelstorage

���������� ���������� Single-levelstorage

������������������������������������

����������������������������������������������������������.

�������������������������:�������������������������������������������������������������������������������?

������������������������������������������

Teraspace InheritSingle-levelstorage

�����������������������������������������������������

Teraspace ��� ��� ���1

Inherit1 ���2 ��� ���2

Single-levelstorage

���1 ��� ���

��������:

1. �������������������������������� Activation Group ������������. ������������ ����������������������������������������������� ACTGRP(*CALLER) ���. �������������������������������������������������� ����� Activation Group ��������.

2. ����������������������������������������������������������� inherit ��������������������������������������������� single-level ���� teraspace ��������������������������� activation group ������������������������������������� �������������������������������������������������� ������������: ��������������� A �������� ����������������������� inherit ��������������� B ���������������������������� teraspace�������������������� activation group ��� *CALLER ��������������� A ���������������������������� B ��������� ��������������� A ��� activate ����� activation group ������������������������ teraspace ��������

����� 6. ������������������ Teraspace ��� Single-Level 67

Page 76: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������������������������������������������

����������������������������������������������� inherit ���������������� activationgroup ��������������������������������������� single-level ���� teraspace ��� ���������������������������������������������������������������������������������������������� �������� Activation Group ����.

��������������������������������

�������������������������������������������������������������������������������������������������������������������������������������� ������������������������������������������������������������������������������

�������������������������������������������������������

��������� Inherit

���������������������������������������������������������������������� inherit(���� *INHERIT ������������� STGMDL) ��� ����������������� ��������������������������������������� teraspace ���� single-level ����� �������������������������������������������������� ������������������������������ �������������������� Teraspace ���Single-level ���������� “��������������������� Teraspace” ������ 71 �������������������������.

�������������������������������� ������������������� ��������������������������������teraspace: ���������������������-���� ���������������������� ��������������������������������������� ���������������� ����������������� ��������� ����������������������������������������������� *INHERIT ������� ������������ ILE ���������������������������������������� *INHERIT

�������������� ��������������������������������� ����������������������������������������������������� single-level (*SNGLVL) ���� *INHERIT ������������ CHGPGM ����CHGSRVPGM ���������������������������:

1. �������������������������������������� ILE

2. �������������������������������� single-level

3. ������������������������������������������

4. ����������������������������������������� V6R1M0 ���������������

5. ������������������������������������������������� V5R1M0 ���������������

6. ������������������������������������������������� V5R1M0 ���������������

����������������������: ���������������� Teraspace

�������������������������������������������������������������������� ��������������������������� ������������ �����������������������������������������������������������������������������������.

68 IBM i: ������ ILE

Page 77: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������������� 8 ���������� C ��� C++ ������

����������� 8 ��������������������� Teraspace ��������. ���������������������������� 8�������������������������������������������� Teraspace. ��� Type �������������� 8 �������Space ������������������������.

�������������������� 16 ������ Type �����������. ��� �������������������������������������������������������� 8 ������� 16 ����.

�������� 5. ����������������������

��������� ����������� 8 ���� ����������� 16 ����

���� (���������������������) 8 ���� 16 ����

���� ��� ���

��������� ��������������������� (������������������). ���������������� (8 ����) ����������������������������.

16 ��������.

Atomicity Atomic �������������������������������������� 8 ����.������������������.

Atomic �����������. Atomic����������������������������������.

�������������� Teraspace storage Teraspace storage + single-levelstorage

������������� ��� 64 ��������������������Teraspace. ����������� EffectiveAddress.

����������� 16 �������Effective Address 64 ���.

������������������ ����������������������������. (����������� 8 ������������������������� Teraspace ���������������������).

�������������������������������Single-level ����� (�����������16 ������������������������������������������������).

����������������� ������������������������������������ Space ������������������������ ����������������������������, �������������������������������� ����������������������������������������������������.

������������������������.

���������������������������� ��� ���

����, ���������� ������������������������ Space ������������

��� ���������������� EAO �������������.

���

����� 6. ������������������ Teraspace ��� Single-Level 69

Page 78: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������� 5. ���������������������� (���)

��������� ����������� 8 ���� ����������� 16 ����

������������������������������������������������

8 ���� 4 ����

����������������������������������������������������Exception �������������������.

��� ���

������������������������������� C ��� C++

������������������������������ 8 ���������������� ��������������������������������������� C ���� C++ ���IBM ������� STGMDL(*TERASPACE) ��� DTAMDL(*LLP64).

���������� C ��� C++ ������������������������������������:

v ������������������������������ 8 �������� 16 ����:

– ����������������� 8 �������� char * __ptr64

– ����������������� 16�������� char * __ptr128

v �������������������� ��� Pragma ���������� ������������������������������������������������������� C ��� C++. ����������������������������������������������������������������������������� Qualifier ������. ������������������������������������������������� 2 ������:

– P128, ������������������� 4-4-161

– LLP64������������������� 4-4-82

���������������

���������� C ��� C++ ����������� ����������� __ptr128 ������� __ptr64���������������������������������������������������� ���������. ������������ ������������������������������������������������������������������

��������������������������������������������������������������������������. ������������ �������������������������������������������������������������������������������������������������������� (Prototype) ��������������. ������������������������������������������������ �������������������������������� 8 ���������� 16 ����.������������������������������������. ���������������������������� �����������������������������������:

v ������������������ 16 �������� 8 ������������������������������������ 16 ������������������� Teraspace ������� Null ��������. �������� MCH0609 exception ��������������

1. ��� 4-4-16 ��� sizeof(int) – sizeof(long) – sizeof(pointer)

2. ��� 4-4-8 ��� sizeof(int) – sizeof(long) – sizeof(pointer)

70 IBM i: ������ ILE

Page 79: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v �������� 16 ����������������� Type ������������������������������ ����������� OPEN��� 16 ������������������������������������. ���������������������� OPEN ��� 8 ���������� �������������� 8 �������������������������� Space ������������������������.������������������������� 8 ������������������������������������������������ ������������������������� Space ������������������������������������������ Space ��������������������������������������.

���������������������������������������� ��������������������������������� 8 ������� 16��������������. ����������� 8 ��������������������������������� 8 ���� ������������������� 16 ������������������������������� 4 ������������. ����������������������������� ������������������������������������������������������ �������������������������������. ��������������������� �������������� ���������������������������, ������������������������������������. ������������ ������������������������������������� 8 ������� 16 ������������� ��������������������������� 8 ����������� 16 ������������������������������������������������ ������������������������������� ������������������������������������������������.

������������������������������������������������������������������������ 8 ������������������ 16 ��������������������� Teraspace �������� (��������������� 8 ��������������������������). ����������� 8 ������������������������������� 16 ���� ���������������������������������� 16 �����������. ���������������������������������������. ������������ �������������� 16 ����������������������������� 8 ���� �������������������������������������� 8 ���� �������������������������.

������������������������� Teraspace

�������������������������� Teraspace �����, ������� ���������������������������������������������������������� Teraspace. ������������������� �����������������������������������������, ������� �����������������������������������������������(Single-level ��� Teraspace).

����������������������������������������������������������� ��������������� teraspace�������������������� ���������������������������������������������������������� ������������������������������������������������ teraspace

��������������������� Teraspace

v ���������������������� Teraspace ������������������

����������������������������������������� Teraspace ���� Inherit. ������������������� Single-level ������������������������� Teraspace ����������������������������������������������������������� ����������������������������������������� (��������������������������������������������������) ������������� ��� 9 ��������� “���������������� Teraspace” ������ 74

����� 6. ������������������ Teraspace ��� Single-Level 71

Page 80: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ����������������������������������������������������� Teraspace ���� Inherit

�������������������������������� Teraspace �����������������������������������������������. ������������ ������������������ ���������������������������������������� Inherit ���� Teraspace �������� ������������ ��������������� ������������������������������������������������������������� ���������������������������������� ��������� �������������������������� ���������������������. ���������������������������������������������� ��������������������������������������������������������������������� ������������ 10 ��������� “���������������� Teraspace” ������ 74 ������������������� ������������������ Single-level

���������������������������������� �������������� Teraspace ������������������. ����������� ������ Teraspace ������ ������������������������������������������ ����������������������� Single-level ��� ����������������� ������������� ��������������������������������������������� Teraspace ���������������������. ��������������� ����������������������������������������������� �������������������������������� Teraspace ��� Single-level ���������

v “������������������� Teraspace ��������������������”

v “������������������� Teraspace ��������������������������”

��������: ������������������������������������������ Inherit ������������������������������ ���������������������������������������� Teraspace �����.

������������������� Teraspace ��������������������

����������� ������������������������������������� ��������:

v ����������������������������������� Single-level ��� Teraspace ������� ������������������������������������

v ������������������������ Teraspace ���������������������������������������������������� Activation Group (ACTGRP(*DFTACTGRP)).

v ������������������� Single-level ��������������������������������� ��������������Teraspace �������� Activation Group ���� *CALLER

������������������� Teraspace ��������������������������

������������������������ ���������������� ������������������������������������������������������ ��� Single-level ������ Teraspace ������ ���������� ���� �������������������������������� Activation Group ��������������� �������������������� Access ViolationException �������������������.

IBM i Interfaces ��� Teraspace

������� ��������������������������������������������������������� ��� 16 ����(__ptr128):

72 IBM i: ������ ILE

Page 81: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ���������������������������������������������� (������������ void f(char*p);) ����������������� 8 ���� (__ptr64) ��������� ���������������������������������������� ������������������� Header �������

v ������������������������������� (������������ void g(char**p);) );) �������������������������������������������� 16 �������������������� ����������� ������������������������������� 8 ��������������������������������������������������� ����������������������������������������������������������������� 8 ������������ ������������������������������������������ Header ��������������������������� datamodel(LLP64)

Bindable API ������������ Teraspace:

IBM ��������������������������� APIs ��������������������������� teraspace3

v _C_TS_malloc() ���������������������� Teraspace

v _C_TS_malloc64() �������������������������������������� teraspace �������������8-����

v _C_TS_free() �������������������������������� Teraspace.

v _C_TS_realloc() ������������������������������������������� Teraspace.

v _C_TS_calloc() ���������������������� Teraspace �������������������������.

�������� malloc(), free(), calloc()��� realloc()������������������ ������������������������ Single-level ���� Teraspace ������������������������������������� ���������������������������������� TERASPACE(*YES *TSIFC).

������������������������ POSIX ��������������������������������������� ���Teraspace ������������������������������ Interprocess Communication APIs ��������������shmget() �������������� UNIX-type APIs �� IBM i Information Center (�������������������������������� API)

��������������������������������� Teraspace

����������� Teraspace ��������������� ����������������������������������������������������������

v ����������������������������������� TGTRLS(V5R4M0) ������������������������� ������� teraspace ����������������� ����������������������������������� ���������������������� teraspace ��� ����������������� ����� IBM i 6.1 ����������� ������ ����������teraspace ���

v ������ MI ��������������������������������� Teraspace ��� ������������� Teraspace����������������������� ����������� Exception MCH0607

– MATBPGM

3. ������������������ teraspace TERASPACE(*YES *TSIFC) ������������������������� ILE C ��� C++ ��������� malloc(), free(), calloc() ���realloc() ����������������������� teraspace ��������� STGMDL(*SNGLVL) ���

����� 6. ������������������ Teraspace ��� Single-Level 73

Page 82: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

– MATPG

– SCANX (����������������������������)

v Effective Address Overflow (EAO) �����������������������.����������������������������������� ������������������������������������� POWER6® �������� “Adaptive CodeGeneration” ������ 192 ����������������������� EAO ��������������������������������������������������� 16-���� ������������������������� teraspace �����������������16 MB �������������� �������� ��������������������������������������������������������������������� �������������������������������������������������������� ������������������������� Teraspace ��������� ���� ��������������������������� 16 MB ������������� ������������ ��������������������� ������ MinimizeTeraspaceFalseEAOs LICOPT ����������������� “���������� Licensed Internal Code” ������ 184

���������������� Teraspace

���������������������� �������� ��������������������������������� Teraspace. ������������������������������������������������������� ������.

v ������������ 1: �������������������������������������������� 16 MB ����������������������������

��� _C_TS_malloc���� ����������������������������� teraspace ������������������ heap����������������� “������ Teraspace �������������������” ������ 64

v ������������ 2: ����������������������������������������������������� 16 MB

��������������������������� (shmget) ������������� Teraspace.

v ������������ 3: ��������������������������� byte-stream ��������������������������

������������������������� (mmap).

�������������������������������������������������� ��������������������������������������������������������� teraspace ������ ������������������ ���������������������������� 8 ����

v ������������ 4: ����������������������������������������������������������������������������� 16 MB

������������������������� Teraspace.

v ������������ 5: ��������������������������������������� Space ���������

����������������������� teraspace ���������������������������������������� 8 ����������� footprint ������������� �������������������������������������

v ������������ 6: �������������������������������������������������������������������������������� 16 ����

����������������������� teraspace ���������������������������������������� 8 ����

v ������������ 7: ��������������������������� Single-level �� ������� Teraspace

74 IBM i: ������ ILE

Page 83: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������������ ������������������������������ Single-level ���������������������������������� Teraspace ������������ ����������������������������������������������������� ��������������������������������������������������� ��������:

– ������������� user space ����������� QUSCRTUS API ���� ������ CRTS MI

– ����������������������� heap ��� single-level �������������� �������������

– ������������������������ Single-level ����������������������

– ����������� Heap ����������������� Single-level ����������� ������ ALCHS MI

v ������������ 8:������������������������� 8 ����������������

�������������������������������� STGMDL(*TERASPACE). ������DTAMDL(*LLP64) ���������� (__ptr64) ��� ������������������� 8 ����������� Teraspace (��������������������� 16 ����������� Teraspace). �������������������������������������������������������������� “����������������������������� 8 ���������� C ��� C++ ������” ������ 69.

v ������������ 9:������ ������������������������������ Single-level

������������������������������� ��� Single-level �����������������������Teraspace ��� �������������������������� ������������������������������������� (���� inherit)������������������� Teraspace ������ ������������������������������� “��������������������� Teraspace” ������ 71. ����������� ������������������:

– ����������������������������������������. ��������������� ������������������������ Single-level ���������������� ������������ 10 ������������������

– ��������������������������������. ��������� ���������������������� Single-level ���������������������������� 11 ������������������.

v ������������ 10: ��������������������� ������������������������� Single-level

������������������� Teraspace ������ ����������������������������������������������� Single-level ������������������������� ����������� Activation Groups ����������������������������������� ��� ���������������������������������������� Single-level��������������� ACTGRP(*CALLER)

v ������������ 11: ��������������������� �������������� pointer-to-pointer

�������������������������������������� pointer-to-pointer ���������������������������������������������������� DTMDL(������� *LLP64). ���������������������������������� 8 ��� 16 ���� ����������������������������. �������������������������������������������� ����������������������, ����������������������������������������������.������������, ����������������� char**�������������������� ���������������������� P128��������������� ����������������������� ������������������������������ LLP64. ������������������������������������������ 16 ���� �����������������. �������������������:

– �������������, �������������������������������������� teraspace ������������ 8 ���������������� STGMDL (*TERASPACE) DTAMDL(*LLP64)�������� create, ���� CRTCMOD ������

����� 6. ������������������ Teraspace ��� Single-Level 75

Page 84: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������������ ������������������� array ����������������������������������� ���������������� P128 char** ���������������������, �������������������16 ����:

#pragma datamodel(P128)void func(char **);#pragma datamodel(pop)

char myArray[32];char *_ptr128 myPtr;

myPtr = myArray; /* assign address of array to 16-byte pointer */func(&myPtr); /* pass 16-byte pointer address to the function */

– application programming interface (API) ������������������� pointer-to-pointer ��������������� iconv. ���������������������� 16 ������������ ������������������������������ iconv:

...#pragma datamodel(P128)...size_t iconv(iconv_t cd,

char **inbuf,size_t *inbytesleft,char **outbuf,size_t *outbytesleft);

...#pragma datamodel(pop)...

������������������� iconv���������� �������������������� DTAMDL(*LLP64):

...iconv_t myCd;size_t myResult;char *_ptr128 myInBuf, myOutBuf;size_t myInLeft, myOutLeft;...myResult = iconv(myCd, &myInBuf, &myInLeft, &myOutBuf, &myOutLeft);...

����������������������������������������������� Retrieve Pointer to User Space(QUSPTRUS) ����������������� void*����������������������������������������������. ������������������ �������������������������� 16 ���������� operand ������

v ������������ 12: ��������������������

�������������������������������������������������������������� ��� IBM ����������� ���������������������������������������� ��������������������� ������������������������������������ errno����������������������������������� IBM i

v ������������ 13: �������������������� *LLP64�����������������������������������

�������� ����������������� *LLP64, ����������������������������� �������������������. �������������������������������������������, ��������������������������������������������

76 IBM i: ������ ILE

Page 85: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���� 8 ����, ������� ��������������������������������������������������� ����������� 16 ����API �������� QUSPTRUS ��������������������������������������������

����� 6. ������������������ Teraspace ��� Single-Level 77

Page 86: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

78 IBM i: ������ ILE

Page 87: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 7. ���������������������

������������������������ ILE ��������������������������������������������������������������������������������������������� �������������������������������������������:

1. ����������������������������

2. ����������������������� ILE ������������������� ��������������������������� CreateProgram (CRTPGM) ���� Create ��������������� (CRTSRVPGM) ������

��������������������������������������� binder ������������ ������������������������������ ILE ����������������������, ����������������������������������������������� ����� 4, “������ ILE �����������”, ������ 17

������������������ ������������������

������ Create Program (CRTPGM) ��� Create ��������������� (CRTSRVPGM) �����������������������������������������. �����������������������������������������������������������������������������������������������.

�������� 6���������� ����������������������������������������.

�������� 6. ����������������������� CRTPGM ��� CRTSRVPGM

���������������� ������ CRTPGM ������ CRTSRVPGM

Identification PGM(*CURLIB/WORK) MODULE(*PGM)

SRVPGM(*CURLIB/UTILITY)MODULE(*SRVPGM)

Program access ENTMOD(*FIRST) EXPORT(*SRCFILE) SRCFILE(*LIBL/QSRVSRC) SRCMBR(*SRVPGM)

Binding BNDSRVPGM(*NONE) BNDDIR(*NONE)

BNDSRVPGM(*NONE) BNDDIR(*NONE)

Runtime ACTGRP(*ENTMOD) ACTGRP(*CALLER)Optimization IPA(*NO) IPACTLFILE(*NONE)

ARGOPT(*NO)IPA(*NO) IPACTLFILE(*NONE)ARGOPT(*NO)

Miscellaneous OPTION(*GEN *NODUPPROC*NODUPVAR *WARN *RSLVREF)DETAIL(*NONE) ALWUPD(*YES) ALWLIBUPD(*NO)ALWRINZ(*NO) REPLACE(*YES) AUT(*LIBCRTAUT) TEXT(*ENTMODTXT) TGTRLS(*CURRENT) USRPRF(*USER)STGMDL(*SNGLVL)

OPTION(*GEN *NODUPPROC*NODUPVAR *WARN *RSLVREF)DETAIL(*NONE) ALWUPD(*YES) ALWLIBUPD(*NO)ALWRINZ(*NO) REPLACE(*YES) AUT(*LIBCRTAUT) TEXT(*ENTMODTXT) TGTRLS(*CURRENT) USRPRF(*USER)STGMDL(*SNGLVL)

© ������������ IBM Corp. 1997, 2016 79

Page 88: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������� Identification �������������������������������������������������� �������������������������������������������������������������������������������������������������������������� ������ ������ CRTPGM ������� ������������������������������������� Program(*PGM). ���� CRTSRVPGM �������������������������������������������� ���������������(*SRVPGM). ���������������� ���������� �������������������������.

������������������������������������������� ������� Binder ��������������������������� ��������������. �������������� Binder ������������������������������ Module (MODULE),Bound ��������������� (BNDSRVPGM), ��� Binding Directory (BNDDIR).

���������������������������������������������������������������� (�������� “�����������������” ������ 90). ������������ CRTPGM ������������������������������������������������������������������������������. �������������������� ��� Dynamic Program Call ������������������������� ������������������������������������������������������������. ����������CRTSRVPGM ���������������������������������������� �������������������������������������������������� ����������������������������������������.

������������������� (Use Adopted Authority - QUSEADPAUT)

������� QUSEADPAUT ���������������������������������������������������������Adopted Authority (USEADPAUT(*YES)). ����������� ������������������������QUSEADPAUT �������������������������������� �������������������������������������������������������������������� ������ Security reference ���������� �����������������������

������������������������ Authorization List. ���������������������������������������. ������������������� *USE �� Authorization List ������������� �������������������, ����������� ���������������������������������������������������� USEADPAUT(*YES). ��������������Authorization List ����������������������������������.

��� Authorization List ������������������������������ Authorization List ����� ��������������������. ��������������������������������������. ������������ ���������������������������QPRCRTPG API ������ *NOADPAUT ��������������������������� ������������������������������������������������ Authorization List ���������. �������������������������������������������������� API ��� Authorization List ����� ���������������������������.

80 IBM i: ������ ILE

Page 89: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������� 7. �������� ���������������� QUSEADPAUT

��� ��������

authorizationlist name �������������������������������������������������������� USEADPAUT(*NO) ������������������������������:

v Authorization List ����������������������� QUSEADPAUT.

v ������������������ Authorization List ������������������.

v ��������������������� ���������������������������������������������������.

������������������ Authorization List ���������������������������������������� USEADPAUT

(*YES).

*NONE ����������������������������������� QUSEADPAUT ���������������������� ������������������������������������������������� �����������������������������.

����������������� Optimization

������������������������ Optimization �������������� Optimize ������� ILE ����������������������������. ������������������������������ ��������������������������������������� ����������������������������� �������� ����� 15, “���������������������������������”, ������ 167

����������������������������������

���������������������� ���������������������������������� ����������� ����������������� ������������������������������������ ������������������������ ������:

v Creation Data (*CRTDTA)

����������������������������������������� ����� (���� ��������������� optimization ��������) ����������������� �������������������� (creation data) ����

v Debug Data (*DBGDTA)

��������������������������������������� �������������� �� ����� 12, “���������������������������”, ������ 151 ��� “����������������������������� (Interprocedural Analysis -IPA)” ������ 175 ������ ��������������������������������

v Intermediate Language Data (*ILDTA)

��������������������� ������ optimization ��������������������������������������(interprocedural analysis - IPA) ���������� ����� 15, “���������������������������������”,������ 167 �������������������������.

��������� Display Module (DSPMOD) ������������������������� ������������������ ������������������������������������ ������������������������������������� Intermediate LanguageData (*ILDTA) ���������������������������������������������

����� 7. ��������������������� 81

Page 90: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������� Display Program (DSPPGM) ���� Display Service Program (DSPSRVPGM) �������������������� DETAIL(*MODULE) ����������������� ���������� ���������������������������������������������:

v Creation Data (*CRTDTA)

��������������������������� ����������������������� ��������������������������������������� (creation data) ����

v Block Order Profiling Data (*BLKORD)

��������������� ������������������������ ���������� ����� 15, “���������������������������������”, ������ 167 �������������������������.

v Procedure Order Profiling Data (*PRCORD)

��������������� ������������������������ ���������� ����� 15, “���������������������������������”, ������ 167 �������������������������.

Creation Data (*CRTDTA) ���������������������������� ������������������� ��������������������������������������������������������� �������������� ������� observable ������������������������������������������������������� ���� ������������ Change Module(CHGMOD) ��� Change Program (CHGPGM), ��������������������� ��������� IPA

����������� observability ����������������� Remove observable information (RMVOBS)�������� Change Module (CHGMOD), Change Program (CHGPGM) ��� Change ServiceProgram (CHGSRVPGM) �������� observability ����� ������� MI ��������������������������������������

��������: ����������������������� observability ���

������������������������ ����� observability ����������������������� ���������� ��������������������������������������������� ������������������ ���������������������� ������������������������������ ������������ Creation Data (*CRTDTA) �������������������������������������������������� unobservable �������������������������������������� ������������������������������������� (creation data) ��� unobservable �������������������

Symbol Resolution

Symbol resolution �������������������������������������������:

v �����������������������������������������������������

v �����������������������������������������������������������������

����������������������������������� Symbol Resolution ����������������������������������������� (��������������). �����������������������������������������������:

v ��������������������������������������� MODULE, BNDSRVPGM ��� BNDDIR ���������CRTPGM ���� CRTSRVPGM

v ���������������������������������������������������

82 IBM i: ������ ILE

Page 91: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Resolved ��� Unresolved Imports

����������� ����������������������������������������������������� �������. ����Unresolved Import ������������������������������� �������������������������������� ��������������������������. ���� Resolved Import ������������������������������� ����������������������������� ��������������������������.

��������������������������������������������������������������������������� UnresolvedImport ���. �������������� Symbol Resolution ���� Unresolved Import ��������������������������������������������������. ��� Unresolved Import ����������������������������������������������������������� �������������������������������������������������������. ������������ ��� *UNRSLVREF ����������������������� �����������������������������������������Unresolved Imports ��������������������. ������������������� ��������������������������������������������������������������������������� ������� ����������������� MCH4439���������� �������������� “Attempt to use an import that was not resolved.”

������������������� (Bind by copy)

���������������������������� MODULE �������������������������. �������������������� BindingDirectory ���������������������� BNDDIR ��������������������������������. ����������������Binding Directory �����������������������������������:

v ���������������������������������� Unresolved Import

v ���������������������������������������������������������������� Binder �������������������������������������������

������������������������������� Binder �������������������� ���������������������������������� ������������������������������������������������� ��������� Binding Directory. ������������:

Module M1: imports P2Module M2: exports P2Module M3: exports P3Binder language S1: STRPGMEXP PGMLVL(*CURRENT)

EXPORT P3ENDPGMEXP

Binding directory BNDDIR1: M2M3

CRTSRVPGM SRVPGM(MYLIB/SRV1) MODULE(MYLIB/M1) SRCFILE(MYLIB/S1)SRCMBR(S1) BNDDIR(MYLIB/BNDDIR1)

��������������� SRV1 ��������� 3 ��������: M1, M2 ��� M3. ��� M3 ������������ ���������P3 �����������������������������

����� 7. ��������������������� 83

|

|

|

Page 92: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������� (Bind by reference)

�������������������������������������� BNDSRVPGM ���������������������. ����������������������� Binding Directory ����������������������������� Unresolved Import �������������������������������������. �����������������������������������������������������������.

��������: ����������������������������������������������� �������������������������������� ���������������. ������� ��� *LIBL �������������������������������������������������� ����������������������������������������������������. ���������� BNDSRVPGM(*LIBL/*ALL) �������� OPTION(*DUPPROC *DUPVAR). ������� *LIBL ���� *ALL ����������������������������������������������

������������������������������

���������������������� (MODULE) �������� CRTPGM ��� CRTSRVPGM ����������������������������������������������. ����������������������������������������������������������������������������:

1. ��� Binding Directory ��������������������������������������������������� �������������������������.

2. �������������������������������������������������������������������������� MODULE��������� CRTPGM ��� CRTSRVPGM ���. ���� CRTPGM PGM(mylib/payroll) MODULE(mylib/pay*). ������������������������������� pay�� ������������������� mylib/payroll ���������������� �������������������������������������������������� ������������������������������������ CRTPGM ���� CRTSRVPGM ������������������������������������������

3. �������������������������� ���������� *ALL ������������������������������������������������������MODULE. ���� CRTPGM PGM(mylib/payroll) MODULE(payroll/*ALL).�������������������� payroll payroll ��������������������� mylib/payroll ����������������.

4. ���������������������������������������� (Generic name) �������������������������������������� 2 ��� 3.

5. ��������������������� �������������������� Binding. ������������������������������������� Binding ���������������������������������������������������������. ����� ������RTVBNDSRC ����������������������������������� Binding ���. �����������������MODULE �������� RTVBNDSRC ������������������������������������������������������������� MODULE ����� ������������������������������ ������ *ALL ������������������������ ��������������������� RTVBNDSRC �������� ����������������������������������������������� ������������ ����������������������������������� Binding ��������������

84 IBM i: ������ ILE

Page 93: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������

�������������������������������������������������������������� ������������������������������ �������������������� �����������������

������������������������������������������������������������� ������������������“���������������������������������” ������ 93 ������������������ ������������������������ ��������������������������������������������������� ����������������������������������������������������������������� ��������� ����������������� ������������������������������������������� ������������������������� �����������������������������������������������

������������� ���������������������������������������� ������������ ������������������������������������������������ ��������������������� ������������������������������������� ����������������������� (CRTPGM, CRTSRVPGM, UPDPGM, UPDSRVPGM)������������ OPTION(*DUPPROC *DUPVAR *WARN) ���������������������������� ������������������������ ����������������������� ����������������������������������������:���������������������������������������� ����������������� ������������������������ ����������������������������� ����������� ��������������������������������������������� ����������������������� ��������� ������������������������������������������� �������������������������������������������� ������������������������������������������������������ ������������������������������������������������������ ��������������� ������������������������������������������������ ������������������� ���������������

�������������������������������

������������������������������������� ���������������������������������� ����������������������������������. ������������������������������������������ MODULE, BNDSRVPGM ���BNDDIR �����������������������������������:

v ����������������������������� ����������������������������������������

v ����������������������������������������

���������������������������������������� ������ ����������������������������������������������������������������������������������. ������������������������������������������������������������������������������������� �����������������������������������������������CRTPGM ���� CRTSRVPGM.

������������������������������������ Symbol Resolution. ��������, ��������������� ���Binding Directory �������� ������ 29 ������ 86 ������������������������ CRTPGM �� ������ 30 ������ 87 ��� ������ 31 ������ 89. ������������������������������������ ��������������.

����������������������������������� Binding Directory ������������������������. ���������������� MYLIB ���������������������������������� CRTPGM ��� CRTSRVPGM.CRTSRVPGM ��������������������� Binding Directory L ��������� MYLIB:

����� 7. ��������������������� 85

Page 94: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

CRTBNDDIR BNDDIR(MYLIB/L)

��������������������������������� M1 ��� M2 ������������������ S ��� T �������� BindingDirectory L:

ADDBNDDIRE BNDDIR(MYLIB/L) OBJ((M1 *MODULE) (M2 *MODULE) (S) (T))

����������� 1 �����������������

���������������������������������������������� A �������� ������ 30 ������ 87:

RV2W1054-3

เซอรวิสโปรแกรม! S เซอรวิสโปรแกรม! T

เซอรวิสโปรแกรม!

QLEPRINTSการโยงไดเร็กทอรี L

*MODULE

*MODULE

*SRVPGM

*SRVPGM

M1

M2

S

T

*LIBL

*LIBL

*LIBL

*LIBL

เอ็กซพอรตรายการ! !

P1

P20

P30

.

.

.

เอ็กซพอรตรายการ! !

P30

P40

P21

.

.

.

เอ็กซพอรตรายการ! !

พิมพ !

.

.

.

โมดูล M2โมดูล M1

อิมพอรตรายการ!

P20

P21

พิมพ !

.

.

.

อิมพอรตรายการ!

เอ็กซพอรตรายการ! !

P30

P20

.

.

.

.

.

.

������ 29. ����� ������������������ Binding Directory

86 IBM i: ������ ILE

Page 95: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

CRTPGM PGM(TEST/A)MODULE(*LIBL/M1)BNDSRVPGM(*LIBL/S)BNDDIR(*LIBL/L)OPTION(*DUPPROC)

����������������� A ���� Binder ���������������������������������������������� CRTPGM������������������:

1. ����������������������������� (PGM) ��� A ��������������������������������.

2. �������������������������������� (module) ��� M1. ��� Binder ����������������. ��������� M1������������������ 3 ������������������ Resolved �������: P20, P21, ��� Prints.

RV2W1049-4

เซ Sอรวิสโปรแกรม! เซอรวิสโปรแกรม T!

เซอรวิสโปรแกรม!

QLEPRINTS

การโยงไดเร็กทอรี L

*MODULE

*MODULE

*SRVPGM

*SRVPGM

M1

M2

S

T

*LIBL

*LIBL

*LIBL

*LIBL

เอ็กซพอรตรายการ! !

P1

P20

P30

.

.

.

เอ็กซพอรตรายการ! !

P30

P40

P21

.

.

.

เอ็กซพอรตรายการ! !

พิมพ !

.

.

.

โมดูล M2โมดูล M1

อิมพอรตรายการ!

P20

P21

พิมพ !

.

.

.

อิมพอรตรายการ!

เอ็กซพอรตรายการ! !

P30

P20

.

.

.

.

.

.

โปรแกรม A

������ 30. Symbol Resolution and Program Creation: Example 1

����� 7. ��������������������� 87

Page 96: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

3. �������������������������������� (BNDSRVPGM) ��� S ���� Binder ���������������������������������������������� S ������������������������ Resolve ������������Unresolved Import. Import �������������������������������������� P20 ����������������������������� Resolve.

4. �������������������������������� (BNDDIR) ��� L. ��� Binder ����������� BindingDirectory L. �����

a. ���������������������� Binding Directory �������� M1. ����� M1 ����������������� ������������������������������������������� ����������������������������.

b. ������������������������� Binding Directory �������� M2. ����� M2 ���������������������������������������� Unresolved Import ��������� (P21 ��� Prints).

c. ������������������������� Binding Directory ��� ��������������� S. �������������������S ��������������������������� 3����������������������������.

d. ������������������������ binding directory ����������� ������� T ��� binder ����������������������������������������� T ������������ P21 ����������������������������

5. ������������������������������� Resolve (Prints) ����������������������������� ��� Binder�������������� Prints �� ����������������������������������� QLEPRINTS ����������������������������� �������������������������������������� ���������������������� ���������� ������������������������ Binding Directory ����� ������������������������������������� ������ ILE �������������� Binder �� ������������������������������������� Resolved�� �������������������������������������������������� ������������� Binder �������������������������������� ������������������������� Resolve ��� ��� ����������������� ���������������������� OPTION(*UNRSLVREF) �������������� Create �����������������������.

����������� 2 �����������������

������ 31 ������ 89 ��������������� CRTPGM ����������� �������������������������������BNDSRVPGM ����������:

CRTPGM PGM(TEST/A)MODULE(*LIBL/M1)BNDDIR(*LIBL/L)OPTION(*DUPPROC)

88 IBM i: ������ ILE

Page 97: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������������������������������������������������������������������������. �������������������������������������������������������������������� 1. ������������������������ S���������������������������� BNDSRVPGM ��������� CRTPGM ������� Binding Directory �����������. . �������� M2 ����������������� P20 ��������������� Binding Directory ������������������� S. ������������ M2 ��������������������������������������������������. ������������������� ������ 30 ������ 87 ��� ������ 31������������:

v ������� A ������������� 1 ������������ M1 ���������������������������������� S, T,��� QLEPRINTS.

v ��������� A �������������� 2 �������������������� M1 ��� M2 ������������������ T ���QLEPRINTS.

RV2W1050-4

เซอ Sรวิสโปรแกรม! เซอรวิสโปรแกรม T!

เซอรวิสโปรแกรม!

QLEPRINTS

การโยงไดเร็กทอรี L

*MODULE

*MODULE

*SRVPGM

*SRVPGM

M1

M2

S

T

*LIBL

*LIBL

*LIBL

*LIBL

เอ็กซพอรตรายการ! !

เอ็กซพอรตรายการ! !

เอ็กซพอรตรายการ! !

P30

P40

P21

พิมพ !

P1

P20

P30

.

.

.

.

.

.

.

.

.

โมดูล M1 โมดูล M2

อิม อรตรายการพ !

อิมพอรตรายการ!

เอ็กซพอรตรายการ! !

P20

P21

ิมพพ !

P30

P20

.

.

. .

.

.

.

.

.

โปรแกรม A

������ 31. Symbol Resolution and Program Creation: Example 2

����� 7. ��������������������� 89

Page 98: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������������������� 2 ����������������������������������:

1. �������������� (PGM) �������������������������������.

2. �������������������������������� (module) ��� M1. ��� Binder ����������������. ��������� M1������������������ 3 ������������������ Resolved �������: P20, P21, ��� Prints.

3. ��������������������������������������������� BNDSRVPGM. ������� BNDDIR. . �������Binder ������� Binding Directory ������� (L).

a. ������������������ Binding Directory �������� M1 �������� M1. ��������������������������������������������������

b. ��������������������� Binding Directory �������� M2. ��� Binder ��������������������������������� M2. �������������������������������� P20 ����������������������������������� Resolve. ����� M2 ��������������������� ����������������������������� Unresolved Import ����. �������������������� Unresolved Import ��� P21,Prints, ��� P30.

c. ������������������������������������������������������� Binding Directory ������������������������ ’S’ ������������������� S ������������ P30 ���������������Unresolved Import ��� P21 ��� Prints. ����������������������������������������������� Binding Directory ���������������������� T.

d. ��������������� T ��������������� P21 ������ Unresolved Import.

4. ������������������� 1 �������������� Prints ����������������. ������������ ������������������������������������������������������������ ����� M1 ������������

Symbol Resolution �������������� Strength ��������������. ����� ������������������������������������������ Strong ��� Weak ���������������� “���������������������������������” ������ 93.

�����������������

�������������������� ���������� ���������������������� ILE ����������������������������������������������������������������. ��������� CRTPGM ������������������������������� Entry Module (ENTMOD). ������������ CRTSRVPGM ������������������������������� Export (EXPORT) (�������������� �������� 6 ������ 79).

����������� Program Entry ���������� Module �������� CRTPGM

����������� Program Entry ���������� Module (ENTMOD) �������� Binder �������������������������������������������:

Program entry procedure (PEP)

User entry procedure (UEP)

�������������������������������� PEP �������������������������������������������������������������������������.

90 IBM i: ������ ILE

Page 99: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������������� ENTMOD ��� *FIRST. �������������� Binder ��� Entry Module����������������������������������������������������������������������� PEP.

���������������������������:

*FIRST ����������������������� ENTMOD

�������������������� PEP

Binder ����������������������������������������� ����������������. ����Binder ���������PEP ���������.

��� *ONLY ������������ ENTMOD ������������������������������������������������������PEP �������. ������ *ONLY ���������� �������������� PEP ������������� ���������������������������.

������������������������� ������������������������������ PEP ����������. ��� PEP ����� ��������������������. �������������������������� PEP ������ CRTPGM �����������.

���������������������� Program Entry ���������� ���� ����������������� display module(DSPMOD). �������������������������������� Program entry procedure name��� DisplayModule Information. Information ��� *NONE ��������������������������������������� PEP. ������������������������������������� ����������� PEP ����.

����������� Export �������� CRTSRVPGM

����������� export (EXPORT), source file (SRCFILE), source member (SRCMBR), ���source stream file (SRCSTMF) ������������������������������������������������� ������������ �������������������������� (���������� ����������) ���������������������������������������������������������������������� ILE �����.

����������������������������������������� *SRCFILE. �������������������� binder ��������������������������� SRCFILE ���� SRCSTMF ��������������������������������������������� ��������������� ������� ��������������������������������������������� Binder (��������������“���� Binder” ������ 95). ). ��� Binder ������������������� Binder ��������������������������������, ����� Signature ���������. ���� Binder ������������������� Signature �������������������� Binder ��������.

������ Retrieve Binder Source (RTVBNDSRC) ����������������������������������������������� Binder. ��������������������������������������������������������������������������������������. ������������������ ������������������������������������������������������������������������� ������������������������������� ����������������������������������������������������� . ������ ������� ����������������������������������������������������������������� �������������������� ������������������������ SRCFILE ���� SRCSTMF ��������� CRTSRVPGM ���� UPDSRVPGM

����� 7. ��������������������� 91

|

|

|

|

Page 100: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������� ����������������������������� export ����� *ALL. ����� EXPORT(*ALL) ��������������������� �������������������������������������������������������������������������.��� Signature �������������������������:

v ����������������������������������

v ��������������������������������������������

��� EXPORT(*ALL) ������� ������������� Binder �������������������������������������������������. ��������������� ����� ������������������������������ Binder ��������������������������� ������� EXPORT(*ALL) �������������� �������������������� ����������������������������� ���������������������������������� ����� ������������������������������������������ ������� Signature ���������������������� �������������������� ������ Signature����������� ����������������������������������������������������������������������������������������������.

EXPORT(*ALL) �������������������������������������������������������������������������������������� ���������������. ILE C ����������������������������������� Global ����Static ������������������������������������������ ILE C ���������� global ����������������� EXPORT(*ALL). �������� ILE RPG �������������������������� EXPORT(*ALL):

v ������������������ RPG

v ���������������������������������������

v ������������������������ EXPORT

������ ILE COBOL ��������������������������������������������������:

v �������������� PROGRAM-ID ��������� COBOL (���������������������� *PGM)���������������. ������������������������������������������� Strong.

v ���������������������������� COBOL ���������������������������� PROGRAM-ID ������������������������������� INITIAL. �������������������������������������������Strong. ����� ������������������������������������������ Strong ��� Weak ���������������� “���������������������������������” ������ 93.

v ��������������������������������� EXTERNAL. ������������������������������������������� Weak.

����������� Export �������������������������������� Source Member

������������������������ export ����� *SRCFILE. ��� *SRCFILE ����������������������������� binder ������������������ the SRCFILE ��� SRCMBR ��������������� SRCSTMF ������������������� binder

������������������������������������������������������� UTILITY �������������������������������� Binder:

92 IBM i: ������ ILE

|

Page 101: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

CRTSRVPGM SRVPGM(*CURLIB/UTILITY)MODULE(*SRVPGM)EXPORT(*SRCFILE)SRCFILE(*LIBL/QSRVSRC)SRCMBR(*SRVPGM)

���������������������������������������� ������������� UTILITY �������������������QSRVSRC. ������������������������������ Binder���� ���� Binder �����������������Signature ��������������������. ������������������������������ Binder ��������������������������������������������������� ������� UTILITY. . ����������, ������, ���� ������������Binder ��������������������������������� ������������� ����������������������������������

��������������������������������������� SRCFILE

�� V3R7 �������������� ��������������������������������������� Source File (SRCFILE)�������� CRTSRVPGM ���� UPDSRVPGM ��� 240 ��������. . ����������������������������������� ������� CPF5D07 �������������. �������� V3R2 ������������������ 80 ��������.����� ������ V3R6, V3R1 ��� V2R3 �������������������������������.

������������� IBM i 7.3 �������������� binder source ������������ (�����������SRCSTMF) ����������������������������������� �������������������������������������������������������� ���������������������� (�����������������������������������������) ������������������������������������ binder ��� 240 ������

���������������������������������

���� ILE ����������������������������������������� �����������:

v �������������������� Weak

v ����������������� Weak

v �������������������� Strong

v ����������������� Strong

v ������������������������ Strong

v ������������������������ Weak

v ������������������

������������������ ILE ���������������������������������������������������������. ��� ��������������������� ILE ���������������� (�������) ��������������������������������������. ������������������������������� CRTSRVPGM ������������������������� �����������������������������������������. (�������������� “����������� Export �������� CRTSRVPGM” ������91.) ��� Strength (Strong ���� Weak) ���������������������������������������������������. ���Strength ������������������������������������������������� ���� �������������. ������������������������������������������������������. ��� Strength �������������������������� Symbol Resolution.

����� 7. ��������������������� 93

|

|

|

|

Page 102: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v Binder ���������������������������������� Strong ���������������������� Weak ������������������.

v �������������������� Weak ����������������������������������� Strong �����������������������������������������������. ������������������ ���������������������� Weak������������������������� ������������������������������������. ���������������������� ����������������������� Weak ��������������������������������������

v ������������� ��� Binding Directory �������������������������� Weak ����������������������� Weak �������������������. ����������������������� Resolve ���� ��������������� Binding Directory ����������. . ����������������� Weak �������������������������������������� �����������������������. ���������������� Binding Directory �����������������.

������������������������������� Weak ������������������������������������������������ Resolution ���������������. ������������������������������� Strong ���������������������������������� ��������������� ��������������������������.

������������ ���������������������������������� Strong �����������������������. ��������������������������������� Strong ��������������������������������������������������:

v ������������������������������������������������.

v �������������������������������������������������������.

����������������������������������������������������� Binding.

����������������������������������������� Weak �������������������������������������������������������������������������������� Binding. ������������ ��������������������������� Weak ���������������������������������� Binding ������������������ Weak��������. ������������������������������������������� Strong.

����������������������������� Weak ����� Activation Group ��������. ����������������������������������������������������������������������������������������������������������� Binding. ���������������� Weak ����������� Binding �����������������������.

�������� 8������������������������ �������������������������������� ILE:

�������� 8. ���������������������������������������� ILE

���� ILE �����������������Weak

�������������� Strong

�����������������Strong

��������������������Strong

���������������������������Strong

���������������������������Weak

���������������������

RPG IV ��� ��� ��� ��� ��� ��� ���

COBOL2 ���3 ���3 ��� ��� ���1 ��� ���

CL ��� ��� ��� ��� ���1 ��� ���

94 IBM i: ������ ILE

Page 103: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������� 8. ���������������������������������������� ILE (���)

���� ILE �����������������Weak

�������������� Strong

�����������������Strong

��������������������Strong

���������������������������Strong

���������������������������Weak

���������������������

C ��� ��� ��� ��� ��� ��� ���

C++ ��� ��� ��� ��� ��� ��� ���

��������:

1. COBOL ��� CL ������������������������������������������������������������������.

2. COBOL ����������������� Weak. ������������������� External ������������������������ �������������� Weak ��������

���.

3. COBOL �������������� NOMONOPRC. ����������������������������������������������������������������������.

����������������������������������������������������� �������������������������� ��������������������������:

v ��������������������� ILE RPG

v ��������������������� ILE COBOL

v ��������������������� ILE C/C++

���� Binder

���� Binder�������������������������������������� ��������������������������������������������. ���� Binder ���������������������������� Source Entry Utility (SEU) ���������������������������������� BND �������.

��������: ����������������������� SEU ������������������� BND ������������������ Binder ������ wildcard ���. ��������������������������������������� Binder ��������������254 ��������.

���� Binder ���������������������������:

1. ������ Start Program Export (STRPGMEXP) ���������������������������������������������������������������������

2. ������ Export Symbol (EXPORT) ����������������������������������������������������������������.

3. ������ End Program Export (ENDPGMEXP) ��������������������������������������������������������������������

����� 7. ��������������������� 95

Page 104: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ 32������������������� Binder �����������:

�������������� Retrieve Binder Source (RTVBNDSRC) ����������� ����������������� Binder������������������������� �������������������

���������

���������������������������� STRPGMEXP PGMLVL(*CURRENT) ��� ENDPGMEXP������������������������������������������������. ���������������������������������Signature. ���� Signature ��������������������������������������������������������.

��������: ������������ signatures ����������������������� Digital Object Signatures. �Digitalsignatures ������������ IBM i ������������������������������������������� ������������������������������������������� ���������������������������� ������������������ Signature ���������������������������������������������. ������������������������������ digital objectsignatures ������������������������������������������ IBM i Information Center

�������������������� signature ���������� ������������ Binder ��������������������������������������������� ����������������������������� ���������������������������������������� ������������������ signature ���������� Binder ��������� signature ������������������������ �������������������������� ���������������������. �������������������������������������������������Binder ������������������� ������������������������������������������

��������: ��������������������������������������������������������������� ����������������������������������������������������������������������������� Binder. ��������������������

STRPGMEXP PGMLVL(*CURRENT) LVLCHK(*YES)..

EXPORT SYMBOL(p1)EXPORT SYMBOL(’p2’)EXPORT SYMBOL(’P3’)

.

.ENDPGMEXP

.

.

.

STRPGMEXP PGMLVL(*PRV)..

EXPORT SYMBOL(p1)EXPORT SYMBOL(’p2’)

.

.ENDPGMEXP

������ 32. ��������������� Binder �����������

96 IBM i: ������ ILE

Page 105: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������������� ���������������������������������������������������������. �����������������������������������������������������������������������. ����� ������������� ��������������� signature ���������� ������������� Binder ����� signature ����������������

�������������������������������������� ������������������������������������������������������������������������ �������������������������������������������������������������������������� ��������������������

������������������������������������������������� ���������� ����������������������������������������������������� ����������������������������������������������������������������������� ����������������������������������������������������������������������������������������� ���������� CRTPGM ���� CRTSRVPGM ������������������������������������������

Signature ��������������������������������������������������������������. ����������������������������������������������������� ����������������������� ���������������������������������������������������������������� ���������������������������������������������������������������������������������������� ������ CRTPGM ����CRTSRVPGM

������ Start Program Export ��� End Program Export

������ Start Program Export (STRPGMEXP) ���������������������������������������������������������������������. ���������� End Program Export (ENDPGMEXP) �����������������������������������������������������������������������.

������ STRPGMEXP ��� ENDPGMEXP ����� ����������������������������������� Signature�����������. �������������� STRPGMEXP ��� ENDPGMEXP �����������������.

����������� Program Level �������� STRPGMEXP

������������� STRPGMEXP �������������������������������� PGMLVL(*CURRENT) ��� ����������������������������� STRPGMEXP ���������. ���������� STRPGMEXP ����� ������������������� PGMLVL(*PRV). Signature ����������������������� STRPGMEXP ����� PGMLVL(*CURRENT) �������.

����������� Signature �������� STRPGMEXP

����������� Signature (SIGNATURE) �������������������� Signature ����������������������������������. �������������������������������������������������������� �����������������������. ��� ���������������������������������������������������������������:

v Binder ����� Signature ����������������� ����������������. ��� Signature �������������� �����������������������������. �������������������������� 2 �������������������������������������������� ������������ Signature ���������. ���������������������������������������������������������������������������� (���������������������������������������). ).

����� 7. ��������������������� 97

Page 106: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������������� Signature ������������� Binder ��������������������������. ���������������� ����������������������������������������������� ����������������������������������������� ���������������.

v Binder ����� Signature �������������������� ����������������. ������� �������������������������� 2 ���������������������������������������������. ������������ Signature �������������� ������������������������������������ ����������������������������������������(�����������������������������������������������������������������) �������������������� Signature ������������ Signature ���������������������������� ��� Binder. ���������������� Signature �������� ������������������������������������������������ �������������������������������������������������������������������������������.

*GEN ������������������������������� Signature ��������� Binder ����� Signature ���������������������������.

������������������ Signature ��������������������������������� Display Service Program(DSPSRVPGM) ����������� DETAIL(*SIGNATURE).

����������� Level Check �������� STRPGMEXP

����������� Level Check (LVLCHK) ��������������� STRPGMEXP �� ������ Binder �������������������������������� ��������������������������� ������� LVLCHK(*YES),�������������������� LVLCHK(*YES), ��������������� binder ��������������������������� ���� ���������������������������������������������������������������������� ������� ������������� ������������������������������������������������������� �������������������������������������������������

������ LVLCHK(*NO) ������������������ ��������������������� �����������������, ����������� Activation ��������������������������� �������������� “������������� BinderLanguage” ������ 218 ��������������������������������������������������������� ������������� Binder

������ Export Symbol

������ Export Symbol (EXPORT) �������������������������������������������������������������

�������������������������������������������������������� ������������������������������������Apostrophe ������� �������� ������ 32 ������ 96 ����������������������������� Apostrophe �������������������������������������������������� ���������� Binder ������������������������� P1������ p1

������������������������������������� ������������ wildcard (<<< or >>>) ����������������������������������������������������������������� �������������������������������. ������������������������������������������������� ������������������������������ ���������������������������������:

98 IBM i: ������ ILE

Page 107: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v �������������������������������������������������

v �������������������������������������������������������������

v �������������������������������������������� �����������������������������

����������������������������������������������������������������

Signature ���������������������������������������������� ������������������������������������� Signature ������������� ���������������������������������������������������������������������, ������������������ wildcard “r”>>> ��� “ra”>>> �����������������������������“rate” �������������������������������� ������������������������������������������������������������������������������������

��������: ����������������������� SEU ������� Type ��� BND ������������ Binder��������������������

�������������� Wildcard Export Symbol

���������������������� ������������������������������������������������:

interest_rate

international

prime_rate

������������������������������������������������� ��������������������������:

EXPORT SYMBOL (“interest”>>>)������������������������� “interest_rate” ���������������������������������������������������� “interest”.

EXPORT SYMBOL (“i”>>>“rate”>>>)������������������������� “interest_rate” ���������������������������������������������������� “i” �������������� “rate”.

EXPORT SYMBOL (<<<“i”>>>“rate”)������������������ “Multiple matches for wildcard specification”. �������������“prime_rate” ��� “interest_rate” �������� “i” �������������� “rate” ���������.

EXPORT SYMBOL (“inter”>>>“prime”)������������������ “No matches for wildcard specification”. ��������������������������������������� “inter” ������������� “prime”.

EXPORT SYMBOL (<<<)������������������ “Multiple matches for wildcard specification”. ������������������������������������������������� ����������������������. ����������������������������������������������������������.

����� 7. ��������������������� 99

Page 108: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������ Binder

��������������������� Binder ����������������������������������������������������� �����������������������������������:

v ���������� Rate

������� Interest_Rate ��������������� Loan_Amount, Term_of_Payment, ���Payment_Amount.

v ���������� Amount

������� Loan_Amount ��������������� Interest_Rate, Term_of_Payment, ���Payment_Amount.

v ���������� Payment

������� Payment_Amount ��������������� Interest_Rate, Term_of_Payment, ���Loan_Amount.

v ���������� Term

������� Term_of_Payment ��������������� Interest_Rate, Loan_Amount, ���Payment_Amount.

������������������������������������������ ����� 17, “Output Listing ��������� CRTPGM,CRTSRVPGM, UPDPGM, ���� UPDSRVPGM”, ������ 209.

�������������� Binder ������������������������������������. ������������� ���������������������������������������������������������.

������������������ Binder ������ 1

���� Binder ���������������� Rate, Amount, Payment, ��� Term �����������������������������:

FILE: MYLIB/QSRVSRC MEMBER: FINANCIAL

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(’Term’)EXPORT SYMBOL(’Rate’)EXPORT SYMBOL(’Amount’)EXPORT SYMBOL(’Payment’)

ENDPGMEXP

������������������������������������ ������������� 3 ����� (MONEY, RATES, ���CALCS) ����������������������������.

������������������������������ ������ 33 ������ 101 ���� Binder �����������������CRTSRVPGM ������:

100 IBM i: ������ ILE

Page 109: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

CRTSRVPGM SRVPGM(MYLIB/FINANCIAL)MODULE(MYLIB/MONEY MYLIB/RATES MYLIB/CALCS)EXPORT(*SRCFILE)SRCFILE(MYLIB/QSRVSRC)SRCMBR(*SRVPGM)

������������� ��������� QSRVSRC ������������� MYLIB ������������������������ SRCFILE����������������������������� Binder ����.

������������������� ������������� Binding Directory ������ �������������������������������������������������������������������������� MODULE �������.

������������������ Binder ������ 2

������������������������������������������������������������� BANKER ������������. ����������� BANKER ���������������������������� Payment ����������������������������FINANCIAL. . ���������������������������������� BANKER ��������� ������ 34 ������102.

เซอรวิสโปรแกรม!

MYLIB/FINANCIAL

โมดูล MONEY

ลายเซ็นปัจจุบัน = Sig 123

โมดูล RATES

โมดูล CALCS

โ Amountพรซีเดอร !

โ Paymentพรซีเดอร !

โ Termพรซีเดอร !

โ Rateพรซีเดอร !

โพรซีเดอร CALC1!

CALC2โพรซีเดอร !

Term

Rate

Amount

Payment

พับลิก

อินเตอรเฟส!

RV2W1051-3

������ 33. Creating a Service Program by Using the Binder Language

����� 7. ��������������������� 101

Page 110: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������ BANKER �������� ��������������� MYLIB/FINANCIAL �������������������������� BNDSRVPGM. ��������� Payment ����������������������������������������������������������������� ��������������� FINANCIAL. ��� Signature ����������� MYLIB/FINANCIAL ������������������������������������� Payment �����������������������BANKER.

������������������������ BANKER �������������� Activation �������������������������:

v ��������������������� FINANCIAL ��������� MYLIB.

v ���������������������������� Signature (SIG 123) ������������������ BANKER.

������������������������������� �������������������� ������������ BANKER ����������������������������������������

เซอรวิสโปรแกรม!

MYLIB/FINANCIALโปรแกรม BANKER

โมดูล Money

ล = Sig 123ายเซ็นปัจจุบัน

โมดูล RATES

โมดูล M1

โมดูล CALCS

โพ Amountรซีเดอร !

โพ Paymentรซีเดอร !

โพร Termซีเดอร !

โพ Rateรซีเดอร !

โพร CALC1ซีเดอร !

โพ CALC2รซีเดอร !

Term

Rate

Amount

PaymentCallPrc Payment

MYLIB/FINANCIAL

Payment = 4th slot

Signature = Sig 123

พับลิก

อินเตอรเฟส!

RV2W1053-4

������ 34. ��������������������� FINANCIAL

102 IBM i: ������ ILE

Page 111: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������� ������ 34 ������ 102����������� BANKER �������� MYLIB/FINANCIAL ������������������������������������������������ BANKER. ��� Activation ����� Signature ����������� MYLIB/FINANCIAL ������������������� MYLIB/FINANCIAL ���������������������������:

������� BANKER �������������������������

���������������������������������

������������������ Binder ������ 3

����������������������������������������� ������������������������������� 2 �����������������������������������. �������������������� OpenAccount ��� CloseAccount, ������������������������������������. ������������������������������������������������ MYLIB/FINANCIAL ���������������������������������� BANKER:

1. ��������������� OpenAccount ��� CloseAccount.

2. ���������� Binder �����������������������.

���� Binder ������������������������������������������. �������������������� ILE ������������������������������������������������� FINANCIAL ���������������������������. ����Binder �����������������������������������������:

FILE: MYLIB/QSRVSRC MEMBER: FINANCIAL

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(’Term’)EXPORT SYMBOL(’Rate’)EXPORT SYMBOL(’Amount’)EXPORT SYMBOL(’Payment’)EXPORT SYMBOL(’OpenAccount’)EXPORT SYMBOL(’CloseAccount’)

ENDPGMEXP

STRPGMEXP PGMLVL(*PRV)EXPORT SYMBOL(’Term’)EXPORT SYMBOL(’Rate’)EXPORT SYMBOL(’Amount’)EXPORT SYMBOL(’Payment’)

ENDPGMEXP

������������������������������� ������������������������ ��������:

v �����������������������������������

v ����������������������������������������������������������������������������������������������������������������������

�������������������������������������������������. �������������������������������� �����������������:

1. ������������ STRPGMEXP, ENDPGMEXP ����������� PGMLVL(*CURRENT) ����.

2. ������������� PGMLVL(*CURRENT) ��������������������� PGMLVL(*PRV).

����� 7. ��������������������� 103

Page 112: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

3. �������� STRPGMEXP ����� PGMLVL(*CURRENT) ���������������������������������������������������������������������������.

4. ���������������������������������.

5. �������������� �����������������������������.

6. ������������������������������������������������������ ������������� Binder ���������.

��������������������������������������������������� Signature �������� STRPGMEXP �����������������������������������������������������������:

STRPGMEXP PGMVAL(*CURRENT) SIGNATURE(’123’)EXPORT SYMBOL(’Term’)...EXPORT SYMBOL(’OpenAccount’)EXPORT SYMBOL(’CloseAccount’)

ENDPGMEXP

���������������������������������������������������������� ������ 35 ������ 105, ���� binder��������������������������� ����������� 3 ������� Binder ������������������� CRTSRVPGM ��������:

CRTSRVPGM SRVPGM(MYLIB/FINANCIAL)MODULE(MYLIB/MONEY MYLIB/RATES MYLIB/CALCS MYLIB/ACCOUNTS))EXPORT(*SRCFILE)SRCFILE(MYLIB/QSRVSRC)SRCMBR(*SRVPGM)

104 IBM i: ������ ILE

Page 113: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������� BANKER ���������������������� ��������� Signature ������������������������������. (����Signature ������������������������� MYLIB/FINANCIAL ��� Signature�������������� BANKER). ) ���������� BANKER ������������������������� CRTPGM ���Signature ������������������������ BANKER �������� Signature ��������������������������FINANCIAL. ������������������������������������� BANKER ��������������������������������������������������������� FINANCIAL. ���� Binder ��������������������������������� ���������������������������������������������������������������������������������������.

������������������ Binder ������ 4

������������������������������� FINANCIAL ������������������� ��������������������������������������������������������������:

�������������������������������� Rate

��������������������������

เซอรวิสโปรแกรม#

MYLIB/FINANCIAL

โปรแกรม BANKER

โมดูล Money

โมดูล M1

ลายเซ็นกอนหนานี้ = Sig 123! "

ลายเซ็นปัจจุบัน = Sig 456

โมดูล RATES โมดูลACCOUNTS

โมดูล CALCSโพรซีเดอร #

Amountโพรซีเดอร #

Payment

โพรซีเดอร #Rate

โพรซีเดอร #Term

โพรซีเดอร #

โพรซีเดอร #OpenAccount

CloseAccount

โพรซีเดอร #CALC2

โพรซีเดอร #CALC1

Term

Rate

Amount

Payment

OpenAccount

CloseAccount

CallPrc Payment

MYLIB/FINANCIAL

Payment = 4th slot

Signature = Sig 123

พับลิก

อินเตอรเฟส#

RV2W1052-4

������ 35. Updating a Service Program by Using the Binder Language

����� 7. ��������������������� 105

Page 114: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������������� Credit_History ������������������������������������� Rate. ���Credit_History ������������������������ Interest_Rate ���������������������������������Rate. ���������������������������������� ILE ������������������������������������������������� FINANCIAL ��������������������������. ������������������������������������������� ��� ��������������������������������������������:

v ���������������������

v �������������������������������������������������������� FINANCIAL ����.

��������������������������. ������� Binder ����������������������������������� Rate. ������������������� ILE ������������������������������������������������ FINANCIAL ��������������������������.

FILE: MYLIB/QSRVSRC MEMBER: FINANCIAL

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(’Term’)EXPORT SYMBOL(’Old_Rate’) /* Original Rate procedure with four parameters */EXPORT SYMBOL(’Amount’)EXPORT SYMBOL(’Payment’)EXPORT SYMBOL(’OpenAccount’)EXPORT SYMBOL(’CloseAccount’)EXPORT SYMBOL(’Rate’) /* New Rate procedure that supports +

a fifth parameter, Credit_History */ENDPGMEXP

STRPGMEXP PGMLVL(*PRV)EXPORT SYMBOL(’Term’)EXPORT SYMBOL(’Rate’)EXPORT SYMBOL(’Amount’)EXPORT SYMBOL(’Payment’)EXPORT SYMBOL(’OpenAccount’)EXPORT SYMBOL(’CloseAccount’)

ENDPGMEXP

STRPGMEXP PGMLVL(*PRV)EXPORT SYMBOL(’Term’)EXPORT SYMBOL(’Rate’)EXPORT SYMBOL(’Amount’)EXPORT SYMBOL(’Payment’)

��������� Rate ���������������������� Old_Rate ���������������������������������������������������������. �����������������������������������.

Comment ������������������������� Old_Rate ����������������. Comment ���������������������������������������� /* ��� */. ��� Binder ��������� Comment ����� ��������� ������������Binder ���������������������������������.

���������� Rate ����������������������������� Credit_History ������������������. ��������������������������������������������������������������������.

106 IBM i: ������ ILE

Page 115: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������������������������������� Rate �������:

v ��������������������� Rate ��������������������������������������� Old_Rate. �������������������� Old_Rate (������������ Rate). �������������������������������������Credit_History.

v ���������������� Rate �������������������������� Credit_History. �������������������������� Old_Rate ����. ������ Old_Rate ���������������������������������� Rate. �������������������������������� Rate ������������������������������������������ Dummy.

������������������������ ������������������������������ �������������������������������.

���������� Binder ��������� �������� RATES ���������������������������� Rate, Term, ���Old_Rate ������������������������������� FINANCIAL ���:

เซอรวิสโปรแกรม MYLIB/FINANCIAL#

โมดูล MONEY

ลายเซ็นปัจจุบัน = Sig 789ลายเซ็นกอนหนานี้ = Sig 456, Sig 123! "

โมดูล RATES โมดูลACCOUNTS

โมดูล CALCS

โพรซีเดอร #

โพรซีเดอร #Amount

Payment

โพรซีเดอร #

โพรซีเดอร #

โพรซีเดอร #

Term

Old_Rate

Rate

โพรซีเดอร #

โพรซีเดอร #OpenAccount

CloseAccount

CALC1

CALC2

โพรซีเดอร #

โพรซีเดอร #

Term

Old_Rate

Amount

Payment

OpenAccount

CloseAccount

Rate

พับลิก

อินเตอรเฟส#

RV2W1055-2

������ 36. Updating a Service Program by Using the Binder Language

����� 7. ��������������������� 107

Page 116: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������� ILE ���������������������������������� Rate ���������� FINANCIAL ������������������������������ 2 �������������������������� Old_Rate ��� Old_Rate ���������������������� 4 ���. ��������������� ILE ������������������������������������� Rate ��������������������������������������� �����������������������:

v ������������������ Rate ������� ����������������������� �������������������� Old_Rate ��������������������� Rate.

v ������������������ Rate ������� ����������������� Credit_History ������������� �������������������� Rate.

�������������������������������������������������������������:

v �������������������������������������������������������������

v �����������������������������������������������������������������������������������������������

����������������������������������������:

1. ������������ STRPGMEXP, ENDPGMEXP ����������� PGMLVL(*CURRENT) ����.

2. ������������� PGMLVL(*CURRENT) ��������������������� PGMLVL(*PRV).

3. �������� STRPGMEXP ����� PGMLVL(*CURRENT) ���������������������������� ������������������������������.

������������� Rate ������������������ Old_Rate �����������������������������������������������������.

4. �������� STRPGMEXP ����������� PGMLVL(*CURRENT) ���� �����������������������������������������������������������������������������������������.

������������� Rate ������������������������������������������������������ �������������Rate ���������������������� Credit_History ���������.

5. ������������������ Binder ��������������.

6. ������������������������ �������������������������������������������������.

���������� ���������������������������������� Rate ���������������������������������������� ��������� Credit_History.

7. ������������������������������������������������������������� ������������������������������������������� (Dummy).

���������� �������������������������������� Old_Rate ������������������������������������ ������������������ Rate ������������������������������������� Dummy.

8. ���������������������� Binder ��������������.

9. �������������������������������������� ���������������������������.

10. ��������������������������������������������������������������� Binder ���������.

108 IBM i: ������ ILE

Page 117: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������

������ Change Program (CHGPGM) ��� Change Service Program (CHGSRVPGM)���������������������������������������� ���������������������������������� ��������������������������������������������:

v ������������ Optimization.

v ������������User profile.

v ������������ Use adopted authority.

v ������������ Profiling data.

v �����������������.

v ������� Licensed Internal Codes.

v ����������������� (��� *SNGLVL ����� *INHERIT ��������)

��������������������������������������������������� ������������������������������������������������������������� ���������������������������� *YES �������������� Force ProgramRecreation (FRCCRT).

��� *NO ��� *NOCRT ������������������������������������ Force Program Recreation(FRCCRT) �������������������������� ������������������������������������������������������������������������������� ��������������������������� �������������������������������������� ���������������������������������������:

v ���������� Optimize program (����������� OPTIMIZE)

v ���������� Use adopted authority (����������� USEADPAUT)

v ���������� Profiling data (����������� PRFDTA)

v ���������� User profile (����������� USRPRF)

v ������� Licensed Internal Codes (����������� LICOPT).

v ��������������������������� (����������� STGMDL)

��� *NO ������������� Force Program Recreation (FRCCRT) ������������������������������������������ ������������������������������������������������������������������������������������������� �����������������������������������������������������������������

������������������������������� CHGPGM ���� CHGSRVPGM �������������������������������������������� �������������������� “Object Destroyed” ���� �������������������������������������������������������������� ����������� Force Program Recreation (FRCCRT)���� *NOCRT, ���������������������������������������������������

���������������������������� thread (NBRTHD) ����� ����������������������������������������������������� ����������������������� ����������������

����� 7. ��������������������� 109

Page 118: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������

������������������������������������������������� ILE ������������ ������������������������������������������������� ��������������������������. ��������������������������������������������������������� ������������������������ ������������������������������������������������������������� ������������������.

���������������������������������������������������� ������������ Update Program(UPDPGM) ���� Update Service Program (UPDSRVPGM). �������������������������������������������� ������������������������� ����������������������������������������������.

������������������ PTF ������������������������������������� UPDPGM ����UPDSRVPGM ������������������������������. ������������������������������������������������������������������� ���������������������� UPDPGM ���� UPDSRVPGM������������� *PGM ��� *SRVPGM.

������������ ������ 37 ������ 111

110 IBM i: ������ ILE

Page 119: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������������������������������������������������������������� ���������������������������������������������������������������������. �������������������������������������������������������������������������.

����������� allow update (ALWUPD) ��� allow *SRVPGM library update (ALWLIBUPD)�������� CRTPGM ���� CRTSRVPGM �������������������������������������������������������������������������������������. ���������� ALWUPD(*NO) ��������������������������������������������������������������������������� UPDPGM ����UPDSRVPGM. ������� ALWUPD(*YES) ��� ALWLIBUPD(*YES) �������������������������������������������������������������������������������. ���������� ALWUPD(*YES) ��� ALWLIBUPD(*NO) �������������������� ����������������������������������������. ���������������� ALWUPD(*NO) ��� ALWLIBUPD(*YES) �����������������

เซอรวิสโปรแกรม MYLIB/FINANCIAL#

โมดูล MONEY

ลายเซ็นปัจจุบัน = Sig 789ลายเซ็นกอนหนานี้ = Sig 456, Sig 123! "

โมดูล RATES โมดูลACCOUNTS

โมดูล CALCS

โพรซีเดอร #

โพรซีเดอร #Amount

Payment

โพรซีเดอร #

โพรซีเดอร #

โพรซีเดอร #

Term

Old_Rate

Rate

โพรซีเดอร #

โพรซีเดอร #OpenAccount

CloseAccount

CALC1

CALC2

โพรซีเดอร #

โพรซีเดอร #

Term

Old_Rate

Amount

Payment

OpenAccount

CloseAccount

Rate

พับลิก

อินเตอรฟส#

RV3W105-0

โมดูล MONEY

โพรซีเดอร #

โพรซีเดอร #Amount

Payment

������ 37. �������������������������������

����� 7. ��������������������� 111

Page 120: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������� UPDPGM ��� UPDSRVPGM

���������������������������������������������������������������������������������������������������������������������������. �������������������������������������������������������������������������������������������� ����������� replacement library (RPLLIB)�������������. ��� ������������������������������������������������������. ������������������������������������������������������������������������ ��������������������������������������������������������.

����������� bound service program (BNDSRVPGM) ������������������������������������������������ ��������������������������������������������������������������. ����������������������������������������������������������������������������������� ��������������������������������� Resolve ��������������������.

��������������������� Service program library (SRVPGMLIB) �������������������������������������������������. ���������������������������� UPDPGM ���� UPDSRVPGM �������������������������������������������. ������ UPDPGM ���� UPDSRVPGM ����������������������������� ��� ALWLIBUPD(*YES) ������.

����������� Binding Directory (BNDDIR) ������� Binding Directory ������������������������������ ������������������� Resolve ����������������.

����������� Activation Group (ACTGRP) ������� ������� Activation Group ��������������������������������������������������������. �������������������������������������������Activation Group ���.

�����������������������������������������������

������������������������������������������������������ ����������������������������������������������������������. ������������ ��������������������������������������������������������� Isolate �������� ���������������� ����������������:

v ������������������������������ ����������������������������������������������������������������� Resolves ��������������

v ���������������������� Binding Directory ������������ CRTPGM ���� CRTSRVPGM

�������������������� Isolate ������������������������������. ������������������������Resolve ������������������� Binding Directory ������������� OPTION(*TRIM) ��������������������������. ������ ������������ ������������������� �������������������������������������������������������������.

����������������������������������������������

����������������������������������������������������� ��������������������������������������������������� ������������������������������ Resolve ��������������:

112 IBM i: ������ ILE

Page 121: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ����������������������������������������.

v �����������������������������������.

v Binding Directoriy �������������������. ���������� Binding Directory ����������������������������� ���������������������������������������������������. �����������������������Binding Directory ����������������������������� ���������������������������������������������������������������������.

v ���������������������. ���������������������������� Binding Directory �����������������������������������������������������. ������������� ILE ���������������������������������������������������������������������.

����������������������������� Resolve ��� ����������������������������������� OPTION(*UNRSLVREF) �����������������.

��������������������������������������������������

������������������������������������������������������������� ��������������������������������������������������������:

v �������������������������������������.

v ��������������������������������������������������������������������������������������� UPDSRVPGM.

���������������������������������� EXPORT(*ALL) ����������������������������������.������������������������������������������������������.

�������������������������������������������������:

v ������������������������������ Resolve ��� ���������������������������.

v ������������������������������������������������������������� ��� Binding Directory�����������������������.

v ���� Binder ������������������������������� ��������������������������.

�������������������������������������������������

������������������������������������������������������������ ������������������������������������������������������������. ������������������������������������������� EXPORT(*ALL) ����������.

������������ ��������������������������������������������� �������������������������������������������:

v ��� OPTION(*NODUPPROC) ���� OPTION(*NODUPVAR) ��������������������������������������������������������������������������.

v ��� OPTION(*DUPPROC) ���� OPTION(*DUPVAR) ���������� ������������������������������������������������������������������������������������������������.

����� 7. ��������������������� 113

Page 122: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������� ������� ������������������

��������������������������������������, ������� ILE, ���������������������������� ��������������������������:

v �������������������������������������������������������������������������������.

��������������������� Prefix ������������������������������� �������������������������.

v ��������������������������������������������������������������������������������������������. . ������������������������������������������ �������������������������������������. ����������� ������������������������� �������������������������������.

v ��������������� signature ������ ���������� Binder ����������������������������������.

���� Binder �������������������������������������� ��������������������������������������������������.

������ Retrieve Binder Source (RTVBNDSRC) ��������������������������� Binder ������������������������� �������������������.

����������������������������������:

– ����������������������������������

– - ������������������������������������������������������������ signature �����������.

����������������������� Binder. ��������������������������������������������� ���������������������� Binder ����������������������������.

v ������������������� CPF5D04 ����������������������������� ���� CRTPGM,CRTSRVPGM, ���� UPDPGM, ����������������������������������������������������,����������������������������������:

1. ������������������������� OPTION(*UNRSLVREF) ����������������������������� .

2. ��������������������� *SRVPGM ���������������� *BNDDIR QSYS/QUSAPIBD��������� ��������� *PUBLIC *EXCLUDE, ���������������������������. ���������� ���������������������������������, ������������ DSPOBJAUT. ���� *BNDDIR QUSAPIBD��������� *SRVPGMs ������ API ����. ��� API �������������������������, �������*SRVPGMs ��� API ���������������� *PUBLIC *EXCLUDE authority. *SRVPGM ������������������������������� QUSAPIBD. ����� ����������������������� *PUBLIC*EXCLUDE �����������, ���������������� ������������� *PUBLIC *EXCLUDE*SRVPGM �����������������������������, ��� ��� CPF5D04.

���������������������� CPF5D04, �����������������������������:

– ������������������ *SRVPGM ��� ����������������������������������� �������������. ���������������� *SRVPGMS ������������������������������������������������ ,������ DSPPGM ���� DSPSRVPGM DETAIL(*SRVPGM). *SRVPGM ����������������������� ����������� CRTPGM ���� CRTSRVPGM BNDSRVPGM. ��������������������� binding directory ������������������� CRTBNDRPG, CRTRPGMOD,CRTBNDCBL, CRTPGM ���� CRTSRVPGM BNDDIR, ������� RPG H-spec. ���

114 IBM i: ������ ILE

Page 123: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������������������������������������� resolve ������� ����������������� *PUBLIC *EXCLUDE *SRVPGM �� *BNDDIR QUSAPIBD.

– �������� *PUBLIC �������������������� *SRVPGM ��������������� �������CPF5D04. ������������������������������������������������������������������� �������������������������������������.

– ����������� OPTION(*UNRSLVREF) ������������������������������������������,��������������������������������������������.

v ��������������������������������������������������������������������������� �������OPTION(*RSLVREF) �����������������. ������������������������� ���������������������������������������������������������� Unresolved Imports. ����������� ���������������������� ��������������������������� Resolve.

��� OPTION(*WARN) ���������� ������������������������� Resolve ���������������������������������������� CRTPGM ���� CRTSRVPGM . ��������������������������������DETAIL �����������������������������������������. ������� ����������������������������� ������������������������.

v ������������������������������ �������������������������������������������������������������.

����������������������������������������������������������������. ����������������������������������������� ILE ���������������������������������������������������������. ��������������������������������������������������������� ���������������������������������������������.

v ��������������������������������������� ILE ������������������������������������������.

����������������������������� ������������������������������� ������������������������������������������������������������� ILE �������. ��������������������������� ��������������������������������������������� ������������������������ ILE �����������������������.

v ��������������������������������������������������������������.

������������������������������������������������������. ������������������������������������������������.

��������������������� ���������������������������� ������������������ ������������������������������������������ ��������������������������� ������������ �������������������������������������������������������.

����� 7. ��������������������� 115

Page 124: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

116 IBM i: ������ ILE

Page 125: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 8. ��������� Activation Group

����������������������������������������������������� ������ activation groups �������������������������������:

v �������������������������������������������

v ������������ Reclaim Resources (RCCRSC) ���������� OPM ��� ILE

v ����� activation group ���������� Reclaim Activation Group (RCLACTGRP)

v ������������������ activation group

����������������������������������������������

Activation group ��������������������� ������������ activation group �� job ����� � ��������������������. ����������������������������������������� (���� longjump() �� ILE C) �������������������������� activation group ������.

�����������������������������������������������������������������������������������. ���������������������������������������������������������������������������������������������.�������������������������������������������������������������������������������������������.

������������������������������������ (request) ����������������� �������������������������������. ����������������������������� ILE ���������������������������������������.����������������������������������������������.

������ 38 ������ 118 ���������������������������������������������������� ������������������������������������������������� activation group ���������������������������.

© ������������ IBM Corp. 1997, 2016 117

Page 126: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������������������������������������� X �������������������������������. ������������� �����ID ������������������������. �����������������������������������������. ������������������������������� �������������������������������������������.

����������������������������������������� ����������������������������������������������������������������������������. ������ ��������������� activation group, ���������������������������������� �����������������

������ Reclaim Resources

������ Reclaim Resources (RCLRSC) ���������������������������� ������������. ������������������������������������������������������������������ �����. ������������������������������� 3 ��������:

��������������������

Call stack entry ������������������������������������������

������������ Program-activation

Program activation ���������� OPM ��� ILE ������������������������������������������

������������ Activation-group

Activation group ������������������������������������������

Activation Group A1

Activation Group A2

RV2W1042-1

Activation Group A3ILE

ILE

ILE

ผูใชคนที่หนึ่ง! !

โ Aปรแกรม

CALLPRC P1ID=ONE

เซอรวิส"

โปรแกรม X

โพรซีเดอร " P1

โพรซีเดอร " P10

ผูใชคนที่สอง! !

โปรแกรม B

CALLPRC P1ID=TWO

หนวยเก็บแบบสแตติก#

ตัวแปร

ID=ONEU1, U2,...

ID=TWOU1, U2,...

������ 38. ����������������������������������������������

118 IBM i: ������ ILE

Page 127: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������������ ����������������������������������������������������������������������������. ���������������������������������������������. ����������������������������������������������������������������������������������������.

������ 39��������������������������� RCLRSC ��������� OPM ��� ILE. ������ call-levelscoping ���������������������������. ����� call-level scoping ��������������������������������������������������� ������������ �������������� call stack entry ������������������������.

������������� ���������������� ������� A, B, C, ��� D ������� D ��� C �������������������� B ������� B ��������� RCLRSC ������������ LVL(*). ������ RCLRSC ��������������LVL ��������������. ������������������������������������������������������������������ ��� call stack entry ��������������������. ������������������������������������ 104

โปรแกรม AActivation

โปรแกรม A ODP F1

โปรแกรม CActivation

โปรแกรม C ODP F3

โปรแกรม BActivation

โปรแกรม BRCLRSC LVL(*)

ODP F2

โปรแกรม DActivation

โปรแกรม D ODP F1 ที่แบงใช! "

OPM

Activation Group ดีฟอลต #

*DFTACTGRP

OPM

OPM OPM

OPM OPM

ILE ILE

หมายเลข 101 หมายเลข 102 หมายเลข 102

หมายเลข 105 หมายเลข 106 หมายเลข 106

หมายเลข 103 หมายเลข 104 หมายเลข 104

หมายเลข 107 หมายเลข 108 หมายเลข 108

การเรียกแบบสแต็ก

โปรแกรม AActivation

โปรแกรม A

โปรแกรม A P1

ILE

Activation Group A1

ILE

หมายเลข 199 หมายเลข 200

RV

3W

100-0

1

หมายเลข 201

ILE

������ 39. Reclaim Resources

����� 8. ��������� Activation Group 119

Page 128: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������. ��������������������������������������������� 104 ������������������.��������������������������������������� 200 ��� 201 ������������������������ RCLRSC����������� activation group ��� ILE. RCLRSC ��������������������������������������������

�������������������������������� C ��� D ��� open data path (ODP) ���������� F3 ������������ F1 ��������������� ODP ����������� ��������� A ODP ������������������ ������� F1 �������������

������ Reclaim Resources ������������� OPM

������ Reclaim Resources ���������������������������������������������������������������������������� OPM ���������������������������������. ���� OPM ������� ���� �������� ����������������������������������������. ����������������������������������������������������������������� ��������������� RCLRSC.

������ Reclaim Resources ������������� ILE

������������� ILE ���������������������� CRTBNDRPG ��� CRTBNDCL ���������������DFTACTGRP(*YES) ������ RCLRSC ����������������������������������� �������������������������� OPM ������������� ILE ��� ������������������������� CRTBNDRPG ����CRTBNDCL ���������������� DFTACTGRP(*YES) ������ RCLRSC ��������������������� ���������������������������������������������������� ������������ ���������������������������������� ILE ��������������������������������������������� acivate �� activation group ���ILE ����� activation group ������������������������������� ������ RCLRSC ��������������������������������������������� ILE ������������������������������������ ������ RCLRSC ������������������������������������������������������������� ��������� �����������������������������������-�������������

�������������� RCLRSC ��� ILE ������ ���������������� QCAPCMD API ������������� CL��� ILE. �������� QCAPCMD API ���������������������� ������������������������������������ CL �� ������ 39 ������ 119 �������������������������������������� ������������������������� call-level number ������������� ILE ��������������������� ��������� ����ILE C ����� ������������������������������������ IBM i ���������

������ Reclaim Activation Group

������ Reclaim Activation Group (RCLACTGRP) �������������� ���������������������������-����������������������� ���������� ����������������������������������� activation group ������������������������������������ activation group �������������������

120 IBM i: ������ ILE

Page 129: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������ Activation Group

���������������������������� ILE �������������������������������������������� *CALLER�������������� ACTGRP. ������������������������� �������������������������� activate�������� activation group �������������������� activation group �����������������������������������.�������� 2 ��������������������������������������. ������������������������������������������������.

������������������� ACTGRP(*CALLER) ���������������������������������:

v �������������������������������������

��������������������������� ���������������������������� optimize ���������� activationgroup ��������.

v ����������������������

������������������ export ����������������������������� ������������������������activation group ��������.

v � �����������������������������

������������������ ������������������������ ��������������������������������������������������� activation group. ��������������������������� commit ���� rollback ������������������������������ activation group.

v ��������������������

Exception ��������������������������������������������������������������. HLL endverb ������������������������������� activation group �������������������������.

������������������� ACTGRP(name) ������� ��������������� �����������:

v ��������������������������������� �������������������������� single-level

�������������������������������������������������������������������������������������� ������������������������� ��������������� ������� adopted authority.

v ����������������������

��������������������������������� commitment ����������������. �����������������������������������������������������������������.

v ���������������������

�������������������������������������������������. ������ HLL end verbs ����������return ����������������������������������������������. �������������������������������������������������������.

����� 8. ��������� Activation Group 121

Page 130: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

122 IBM i: ������ ILE

Page 131: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 9. ����������������������������

������ call stack �� ILE ������������������������������������������������������������� ���������������������������������������������������������������������. ������������������������������������������������������������������ ������������������������������, ����������������� “�����������������������������” ������ 29 ������������������������� 3 ���procedure pointer call

���������, �������������������������������� OPM application programming interfaces (APIs)�������������� ILE ���� ����������� OPM-to-ILE

Call Stack

Call stack ������������� call stack entries��� last-in-first-out (LIFO) ��������������(entry) ��������������������������������������������������. �������������� call stack�������������������������������������������������������������� ���������������������������������������������� call stack entry ���� ������������ condition ��� ������������ cancel.

������� call stack ��������������� ������������������������������������������� call stack �������������������������������������� ������������������������������������������ ������������������� stack ��������������������������������������������������������� �������������� ������ IBM i ���������������������

����������� Call Stack

������ 40 ������ 124 ���������������������� call stack ���������� 2 ������� ������������� OPM (������� A) ���������� ILE (������� B). ��������� B ���������� 3���������� ��� program entry procedure (PEP), user entry procedure (UEP) �����������������(P1). ��������� PEP ��� UEP ������ “��������������� (Module Object)” ������ 18. ��������������������������:

1. ������������ A ��� dynamic program call.

2. ������� A ������������ B ��������������������� PEP ���������� B. ��������������������� dynamic program call.

3. PEP ����� UEP. ��������������������� ���������������������������.

4. UEP��������������� P1. ��������������������� ���������������������������.

© ������������ IBM Corp. 1997, 2016 123

Page 132: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ 40���� call stack ��������������. ������ stack entry ��������������������������������. �������������������������������������������������������������� ��������������������������������������������������������������:

v ������������������������������ ���������������������������������������������

v ���������������������������������������������������� ������������������ call stack ���������������������������

�������� ����������������� P1 �������������� ����������������������������� B �������������������� P1 ���������������������� UEP ������������ P1 ������������������ �������UEP �������������������� PEP ��������� UEP ���������������� �������� PEP ����������������������������� A ��������� PEP �������������������� �����������������������A’ ������������������������������������ call stack ���������� A ��������������������������dynamic program call ������������ B

����������������������������������������������

���������������������������������������������� ILE: �������������������������, ���������������������������, ���������������������������

โ Aปรแกรม

โมดูล M1

โมดูล M2

โปรแกรม B

การเรียกแบบสแต็ก

OPM

ILE

RV2W1034-1

OPM

ILE

ILE

ไดนามิกโปรแกรมการเรียก

สแตติกโพรซีเดอร !

การเรียก

สแตติกโพรซีเดอร !

การเรียก

รายการโปรแกรมโพรซีเดอร !

รายการโปรแกรมโพรซีเดอร !

โพรซีเดอร P1! โพรซีเดอร P1!

รายการผูใช" "

โพรซีเดอร !

รายการผูใช" "

โพรซีเดอร !

������ 40. ���� Dynamic Program Calls ��� ����������������������������� Call Stack.

124 IBM i: ������ ILE

Page 133: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������ ILE ��� activate ��������������������������������� PEP �������������������������������������������� ��� procedure pointer call ��� activate �������������������������������������� dynamic program call ���������������� activation ������������������������� ������������������������������������� �������������������������������������� ����������������� ������������������������������ ILE ���������������������� ��������������������������� ���� procedure pointer call �������� (��������� dynamic program call)

Static Procedure Calls

��������������������� ILE �������������� stack entry ��������������������������� stack ���������������������������������������. �������������������:

1. ���������������������������������

2. ���������������������������������� ����������������������������������� ILE ��������.

3. ������������������������ export ��������������������� ILE ��������� activation group ��������.

4. ������������������������ export ��������������������� ILE ��������� activation group ������������.

���������� 1, 2, ��� 3�������������������������������������������������������activation group. call path ������������� call path ��� dynamic program call ��������������� ILE���� OPM. ���������� 4������������������������� activation group ��������������������������������������� activation group ����. ����� call path ������������������ call path ��� ��������������������������� ��������� activation group ���������������� call path ��� dynamicprogram call.

��������������������������������� ������������������������������������������������������������������ ����������������������������������������������. ��������������� �������������������������������������������������������������������������

Procedure Pointer Calls

Procedure pointer calls������������������������������. ����������� ������������������������������������������������������������������������� ����������������������������������������������������������������� ����� ���.

Procedure pointer call ������������������� call stack ������������������� ���������������������������. �������������������������������� ��������������������������� ������������������������� procedure pointer call ����������. ������������������������������ activation group �������� ���������������� procedure pointer call �����������������������������������������������.

����� 9. ���������������������������� 125

Page 134: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������������������������������������� ILE

�� ILE procedure call ������������������������������������������������������������������������������������������������������. ���� ILE ���������������������������� 3 ���� ���:

������������� (By Value, directly)����������������������������������������������������������.

�������������� (By Value, indirectly)������������������������������������������������������������. ��������������������������� (����������) ������������������������������.

by reference���������������������������������������������������������������������. �����������������������������������������������������������������������������������������������������������.

������ 41��������������������������������������������. ���������� ILE ����������������������������������������������. ������������������������������������������������������������������������ ILE HLL programmer’s guides.

������������� HLL ���������������������������������������������������������������������������������������. ���� ILE C ��������������������������������������� ��������������������� ILE COBOL ��� ILE RPG, �����������������������. ���������������������������������������������������������������������������������������������������������������.������� ILE HLL programmer’s guides ������������������������������������������������������������������������.

������������������������� IBM i 7.3 ���������������������� 400 ��������������������������������������������� �� IBM i 7.3 ��������������������������������������������������� 16,383

สำเนาของอารกิวเมนต! !

พอยเตอร !

พอยเตอร !

สำเนาของอารกิวเมนต! !

อารกิวเมนตจริง! !

ตามคา, ทางตรง"

ตามคา, ทางออม" #

ตามการอางอิง#

RV2W1027-1

������ 41. Methods for Passing Arguments to ILE Procedures

126 IBM i: ������ ILE

|

|

Page 135: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������� ������������������������������ �������������� ILE ����������������������������������������. ���� ILE ������������������������������������ ������:

v ILE C �������������������������������������� ���������������������������������������������������� ���������������������������������������� ����������������� ���������������������������������������������� #pragma ����������������������

v ILE C++ �������������������������������������� C++ ��������������������������������������������������� ���������� ������������������������������������ ����������������������� �� extern linkage specifier �������������������������������

v ILE COBOL �����������������������������, �������������, �����������������. ��������������������������������������������

v ILE RPG �����������������������������, �����������������. RPG ������������������������ ����������������������������, ���������������������������� ������������������������,���������� EXTPROC(*CWIDEN).

v ILE CL ������������������������������������ ��������������. ��������������������������������������������

������������������

������������������������� (HLL) ��������������������������� (�������������������������������������������������) ��������������������������������������������������������������� ����� ������ 42. �������������� ILE HLL programmer’s guides ��� ���� ILE ����������������������������� �����������������������������������������������.

โพรซีเดอรที่เรียก"

การเรียกโพรซีเดอร "

สงคืน!

การเรียก

โพรซีเดอรที่เรียก"

อาจสงคืนผลลัพธ! "

ของฟังกชัน"

การเรียกโพรซีเดอร "

ที่มีการสงผาน! !

อารกิวเมนต" "

RV2W1028-1

������ 42. Program Call Argument Terminology

����� 9. ���������������������������� 127

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

Page 136: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������� (Omitted Argument)

���� ILE ������������� ����������������������������� �������������� ����������������������������������������������� ILE ��� ������������������������� ������������ ���� ��������������������������������� (by reference) ������������� ILE C ���� an ILE bindable API������������������������������������������ null pointer �����. �������������������������������������������������������� ILE ���������� �������������� programmer’s guide������������. ������ API ������������������������� IBM i Information Center ������������������������������������������� API

���������� ILE ��������������������������������������������������������������������������������������������� bindable API ���� Test for Omitted Argument (CEETSTA).

Dynamic Program Calls

Dynamic program call ����������������������������������. ������������ ����������������� CALL������ CL �������������������� dynamic program call.

������� OPM ����������������� dynamic program call. ������������������������� dynamicprogram call ��������.

������� ILE ������������� dynamic program call. �������������������������� ILE ������activate ���������������������������� ��������������������������� ���� procedure pointercall.

������������������ ��������������������������� ������������������������� symbol ���dynamic program call ����� resolve ���������������������������������������������. �����������dynamic program call �������������������������� ���������������������������. ����������� dynamic program call ������:

v ������������������ ILE ����������� OPM

v ������������� non-bindable API

����������� dynamic program call ������������ ILE ����������������������� PEP ����������������������������������������� UEP ����������. ��������������������������������������� ������������������������������������������������������������������.

���������������������� Dynamic Program Call

��������������� ILE ���� OPM (���������������������������� ILE) �������������������������������� ������������������������������������������������������������������������

�������� dynamic program call ���������������������������� ���������������������������������������������������������������������������������� ������������� �������� dynamicprogram call ������������������������������� 255 ��� ILE language �������������������������������������������������������� ���� ILE ����������������������������

128 IBM i: ������ ILE

Page 137: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

CALLPGMV, ������������� ����������������������� 16383 ���������� ���������������������������������������������������� ������������� ILE HLL programmer’s guides

������������������������������� (Interlanguage Data Compatibility)

����������� ILE ������������������������������������������������������������� HLL �������������������������������������� HLL, ���� ILE ��������������������������������� ������������ILE COBOL �� USAGE PROCEDURE-POINTER ������������������

������������������������������������ HLL ����������������������������������������� HLL���������������������� ��������������������������������������������������������������������������������������������� ������������ ����������� ILE C ���������� export �������������4 �������������������������������������������� short integer (���� 2 ����) ����� ������������������������������������������������������������������������������������������ILE HLL programmer’s guides

��������������������������������������������������������������

��������

���� ILE �������������������������������������������������������������������� ILE����. ������������, ILE C ������������������ #pragma ����� �������������������������������������ILE �����������������������; RPG ���������� ���������������������� EXTPROC

Operational Descriptors

Operational descriptors ����������������������������������������������� API ����������������������������������������������� HLL ������� Operational descriptors ������������������������������������������� ���������������������������������������������������������������������� (������������ ������� string ����������) �������������������������������������������������������������

����������������������� operational descriptors ���������������������������������������������� ������������ �����������������������������������.

Operational Descriptor ������������������� ���� bindable API �������������������������������������������� HLL �������� ��� HLL �������������������������������������������������.ILE bindable API ��� operational descriptors �������������������������������������������������� ������� HLL. ����������� Operational Descriptor ��������������������� API.

Operational descriptors ��������������������� HLL �����������������������������������������������������. ���� ILE ����������������������������������������������������. ���� ����������������� ILE ��������������������� operational descriptors ������������������. ������������������������������������� HLL ������ operational descriptors �������������������������� ILEHLL.

����� 9. ���������������������������� 129

Page 138: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Operational descriptors ��������� Data Descriptors �������������. ���� Operation Descriptor �������������������������� �����������������.

����������� Operational Descriptor

���������� operational descriptors ��������������� ���������������������������������� ILElanguage ������������� ������������������ ��� ILE bindable API ������������� bindable API������� descriptor ������������������������������� ��������������� APIs ��������������������API ������������������������� IBM i Information Center ������� API ����������������������������������������������������������

����������� Descriptor ���������

�������������� descriptor ��������������������������. �������������������� descriptor���������������������� ������������������������������������������������������������. ������������������ descriptor �������������, ������������������������������������������

����������� Descriptor ������������

����������� descriptor �������������������� ������������������������������������������������������������������. ��� operational descriptor ���������������������������������������������������������������.

��������: ������������ �������������������������������������������������������� ����������������������������������������������������������

Bindable API ���������������� Operational Descriptor

����������� descriptor ������������������������������������������ ��������� semantics ���HLL ����������������������. ����������������������������������� operational descriptor��������������������������������������������� ���. ������������������������������������������������� descriptor ���������������������������������������. ����������������������������� bindable APIs ������:

v Retrieve Operational Descriptor Information (CEEDOD) bindable API

v Get String Information (CEEGSI) bindable API

����������� API ��� OPM ��� ILE

��������������������������� ILE ��������������������������������������� ILE ������������������������ call-level API ��� OPM. ����������������������������������������������������������������� 2 ��� ��������������������������������������� ILE.

��������������� ILE ������������������������� bindable API ����������������������� ILE�������. �������������������������������������� OPM ���������������������������� ��������������������������� ILE ��������������������������������� OPM

130 IBM i: ������ ILE

Page 139: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������� stub ���������� ILE ������ bindable API ��������������������������������� ��������������������� bindable API ������������ stub ���������� ILE ��������������������������������. stub ���������� ILE ���������������� �������������������������������� bindable API ����������.

�������������������������� ������ 43.

������ ������� B ��� D ��� ������������� ILE. ��������������� X ������������������������������� bindable API ��������. stub ���������� ILE ���������������������������������������������� activation group ���������. ������������� activation group ���� VENDOR1������������������.

Activation group VENDOR1 ����������������������������������������. dynamic program call���������� A (������� OPM) ����� activation group ����������������������������OPM. ������������������������������� ���������� H (������� ILE) ������� activationgroup ������������ H ��� activate. ������� activation group ������������ ����������������������������� A ���������� H.

���������������� API ������������������ ILE (�������������������������� P1) ���������������������������������������������������������� ������������������������������������������������������� stub ��� ���������������������������� action ������������������� callstack ���� ������������� exception ����������� ���������� stub �������������������������������������� activation group ����������������������������. ������������������������ API

Activation Group ดีฟอลต !

Activation Group A1

RV2W1047-2

Activation Group เวนเดอร1!

OPMILE

ILE

ILE

STUB

STUB

ILE

โ Aปรแกรม

CALLPGM B

เซอรวิส!

โปรแกรม X

โ Bปรแกรม

CALLPRC P1

โ Dปรแกรม

CALLPRC P4

โพรซีเดอร ! P1

โ P4พรซีเดอร !

โปรแกรม H

CALLPRC P1

������ 43. ��������������� API ��� OPM ��� ILE

����� 9. ���������������������������� 131

Page 140: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������� ��������������� ������������������ stub ���������������������������������������������������. HLL ending verbs ���� activation group ���������������������������������� OPM ����������� ILE

132 IBM i: ������ ILE

Page 141: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 10. ���������������������������

������������������������������������������������������������� ILE ��������. ������������������������������������������������������ ������������������������������������������������ ������������������������������������������������������������������������������������������������.

��������������������������������������������������, ����������, ������������� ��������������������������������������� �������������������������������������������������������������������. ����������������������������������������������� �������������������������������������������������������������. ��������������������������� �����������������������������������. ���������������������������������������������������������������������������

������������������������� ������������������������������������������������������������������������.

������������������������������������� �����������������������������������������. ���������������������������������������������������������������������������� call stack.

������������������������������������ ����������������������������������������������������������������. �������������������������������������������������������������������������. �����������������������������������������. ������������������� ������������������������������������������������������������ ������

Single-Level Storage Heap

Heap heap ������������������������������������������������������������������������������������. �������������������������� ������� ����������������������������������� ����������������������������������������������� Heap ����. ������������������������� ������ heap ����������������������������������������������� ������ ALCHSS ��������������������������� single-level storage ���� ���������������������������� Teraspace ����������������������������.

������������ Heap

Heap �������������������������:

v �������������������������������� heap ������ heap ������������� activation group.

Heap Identifier ������ Heap �������������������� 0 ����.

© ������������ IBM Corp. 1997, 2016 133

Page 142: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Storage management-bindable API ��������������������������������������� HeapIdentifier ��������� Heap ���������������. bindable API ������������������ activation group�������������� heap ��������.

v activation group �������� heap ������������� heap ��������.

��������� activation group ����������� heap ������������������ heap ���������������������activation group ����������������� . Heap Identifier ����������������������������activation group ����������������������.

v �������������������� heap ����������������������������������������.

��� �������������������� heap ��� 4 �������������� 512 ��������. ���������������������������� 1 ����� ������������ 128,000.

v ��������������������������������������� heap ������������������������ 16 ���������������64 ��������.

Default Heap

����������������������������������������������� ��� default heap ������� �� activationgroup ������ single-level storage ������� �������� default heap ���������������������������������� ���������������������� heap ����������������������������������������������������������������� ���������� heap �����������������������������������.

������������������������������������������������������������������������������������� heap ����. default heap ���������������� activation group �������������������������������������.

��������� activation group �������� ����������������������������������������������������������������� default heap ������������. ������������ ������������������������������������������������������������������������������������� activation group ���. ����������� heap���������������������������.

Heap ����������������� (user-created heap)

����������������������� heap ��������� bindable API. ������������������������ heap ���������������������������� ������������������� heap ������������.

������������ ���������������������������������������������� ��������������������� heap ����������������������������� activation group. ����������������������������������� ����������������������� heap �����������������������. ������������ heap ������� 1 ��������� ��������������������������������������������������������������. ������������������������������������������������������. ����������������������� heap �����������������������:

v �������������������������������������������������������������������������������������������. �������������������������������� ��������������������������������������������������������������������������������� (call) �������������������� bindable API ����

134 IBM i: ������ ILE

Page 143: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Discard Heap (CEEDSHP). ���������������������������������������������������������������� heap. �����������������������������������������������������������������.

v ������������������������������������������������������������������������������ ��������� bindable API ���� Mark Heap (CEEMKHP) ��� Release Heap (CEERLHP) bindableAPI. CEEMKHP ������������������������� heap. ���������������������������������������������������������� ����� heap �������������������� ������ bindable API CEERLHP ���������������������������������. �������������� mark ��� release ������������ heap �����������������������������������������������������������������������������������. ����������������������������������������������������������������� heap ��������� heap ����������������������������������������������������������������.

v � �������������������������������� �������������������������������������� defaultheap. �������� ���� ��������������� default heap ��� 4 ��������. ����������������������������� ������������������������������������������������ 4 ��������. �������� ��������������������������� heap 1 ���������������������������� 4 ��������. ������������������������������������������������������ ����������������� heap ������������� heap ������������. ��������������� ��������������� heap �������������� 4 ������������������. ������������������������������������ heap �������� “Heap Allocation Strategy”������������������������������� heap.

�������������������������� heap ����� ��� ������������� default heap ������������������������� heap ���������������������������������������������������������������� heap ���������.������������ ��������� APIs ��������������������� ����������������� API ������ ������������������ IBM i Information Center

����������� Single-Heap

������������������������ heap ������� ����� heap ������� default heap ��������������� bindableAPI Discard Heap (CEEDSHP), Mark Heap (CEEMKHP), ���� Release Heap (CEERLHP)��� default heap ���. �������������������������������������������������������� default heap��������� free operation ������������������������� activation group �������������� heap ����.

���������������� default heap ������������������������������������������������������������� ��������������������������������������������������. ������������������� heap ��������� heap ����������������������������������������������� ��������������������������������������������� ���. ����������������������������������� heap ��� default heap. ��������������������������������������������� mark �����������������������������������������������������������������������������������������.

Heap Allocation Strategy

���������������������������� default heap ���������������������� default allocation strategy.���������������������������� ���� heap ������������������ 4 �������� ������������������������������������� 4 ��������. �������������������������������� allocation strategy ���.

����� 10. ��������������������������� 135

Page 144: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������ ��������������� heap ������������������ API ���� Create a Heap (CEECRHP).����������������� allocation strategy ������ heap ������������������ API ���� Define HeapAllocation Strategy (CEE4DAS). ������������� heap ���� ��������������� heap �������allocation strategy �����������������. ������������������������� allocation strategy �������� heap ���������������.

������������ bindable API ������� CEECRHP ���������������� allocation strategy. ���������heap �������������������������� _CEE4ALC allocation strategy type. type ����������������� heap ���������������������� 4 ����������������������������������������� 4 ��������._CEE4ALC allocation strategy type ���������������������� ������:

Max_Sngl_Alloc = 16MB - 64K /* maximum size of a single allocation */Min_Bdy = 16 /* minimum boundary alignment of any allocation */Crt_Size = 4K /* initial creation size of the heap */Ext_Size = 4K /* the extension size of the heap */Alloc_Strat = 0 /* a choice for allocation strategy */No_Mark = 1 /* a group deallocation choice */Blk_Xfer = 0 /* a choice for block transfer of a heap */PAG = 0 /* a choice for heap creation in a PAG */Alloc_Init = 0 /* a choice for allocation initialization */Init_Value = 0x00 /* initialization value */

����������������������������������������� _CEE4ALC allocation strategy type. ���������������������������������������� ���������� _CEE4ALC ������� ����������������� API ������������������������ IBM i Information Center

����������������������������� Heap ��� Single-Level

Bindable API ��������������������������������������������� heap. ������������������������������������ Bindable API ������������������������������������� ��� ����������������������������������.

Bindable API ������������������������ ���������:

v ������������ heap ���������. �������������������������������������� heap ���������� ���������������������.

������ Free Storage (CEEFRST) �� Bindable API ��������������������������������������������������.

������ Get Heap Storage (CEEGTST) �� Bindable API ����������������������������������� heap.

������ Reallocate Storage (CEECZST) �� Bindable API ��������������������������������������������������������������.

v ������������ heap ���������. ������������������������������������� heap �������������������������.

������ Create Heap (CEECRHP) �� Bindable API �������������� heap ����.

������ Discard Heap (CEEDSHP) �� Bindable API ��������������� heap ���������������.

136 IBM i: ������ ILE

Page 145: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ Mark Heap (CEEMKHP) �� Bindable API ����������������������������������������������������� heap ��������������������� CEERLHP.

������ Release Heap (CEERLHP) �� Bindable API ���������������������������������������������� heap.

v Heap allocation strategies

������ Define Heap Allocation Strategy (CEE4DAS) �� Bindable API ��������������Allocation Strategy ������������������������������� heap ������������������ CEECRHP.

��������������������� API ��������������������� ����������������� API ������������������������ IBM i Information Center

����������� Heap

������������������������� ������������������ malloc, calloc, realloc��� new �������������������������������� ��������������������������������������������������������������������������� Activation Group. ������������ ��������������������������������single-level ������������������������������Teraspace ����������������������������������������������������� TERASPACE(*YES *TSIFC) compiler ����������. ����������� ���������������������������� single-level ��� ������������������������ Bindable API ������������� Teraspace ��� ���� _C_TS_malloc, _C_TS_free, _C_TS_realloc��� _C_TS_calloc

���������������������������������������������������� Teraspace �������� ����� 6, “������������������ Teraspace ��� Single-Level”, ������ 63.

������������������������������������������� Bindable API ����� CEExxxx ����������� ILE Cmalloc(), calloc(), realloc(), ��� free()���������������������� ��������:

v ������������������������������������������������ malloc(), calloc(), ��� realloc() ����������������������������������������������� ��������� bindable API ���� CEEFRST ���CEECZST ���.

v �������������������������������� bindable API ���� CEEGTST ���������������������������������������� free().

v ���������������������������������������������� bindable API ���� CEEGTST �������������������������������������� realloc().

����������� ���� COBOL ��� RPG ������������������������������ heap. ���������������������������������������������������������� ILE ������������� Bindable API.

RPG ������������������ ALLOC, REALLOC ��� DEALLOC ���������������� %ALLOC��� %REALLOC ���������������������������� heap ����� RPG ��������������������� heap��� single-level ���������������� heap ��� teraspace ������������������������������������teraspace ������������ ��������������� heap ��� teraspace ������������������������������������ inherit ���� single-level ��������������������������� heap ��� single-level ������������

����� 10. ��������������������������� 137

Page 146: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������������������������������� heap ��������������� ���������������� ALLOC �������������� Control RPG �������� ������ API ������������ CEEGTST, CEECZST, ��� CEEFRST������������������������������ heap ��� single-level �������������� _C_TS_malloc(),_C_TS_realloc(), ��� _C_TS_free()������������������������������ heap ��� teraspace

Thread Local Storage

���������� ILE C, ILE C++ ��� ILE RPG �������� thread local storage (TLS) ������ TLS������������������������������������������ ������������������� TLS ���� TLS���������� ���������������������� TLS ��������������������������������� ������������������� �������������������� TLS ����������������������� thread ��� ����������������������������� ����������������������������������������� �������������������������� ��������������������� high-level language (HLL) ��������������

������ TLS ����������������������������� ����������������������������� ��������� TLS����������� thread ������������������������� ������������������������ TLS ������������������

�������� 9. ������������������������ TLS ������������������

��������������� ������ TLS

�������������������������������������������?

���������������������������������� activate

����� thread ����������� TLS �����������

������������������������? ���������������������������������� activate2

����� thread ����������� TLS �����������

�������������������������������������������������?

���������������������������������� deactivate

����� thread ��������

����� thread �����������������������������?

������ thread ������������������������������

������.

������������������ single-levelstorage ���� teraspace storage?

����������� activation group ���������� �������������������1

������ TLS ����������������������������� ��������1

1 ���������� ����� 6, “������������������ Teraspace ��� Single-Level”, ������ 63 �������������������������

2 ������������������������������������� ������ ������������������������������ HLL ���������������

����������������������� TLS ����� thread �������������� ��������������������������������������thread ���� �������� ���������������������������������������������� thread ������

138 IBM i: ������ ILE

Page 147: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������� TLS ������������������������� thread ������������������ ������������ (����������������� ����� 16, “�����������������������������������”, ������ 201) �������������������������� ��������������� ������������ ������������������� TLS ���������� �����thread ����

����� 10. ��������������������������� 139

Page 148: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

140 IBM i: ������ ILE

Page 149: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 11. �����������������������������

������������������������������������������������������������������� ���������������������������������������������, ���������������������� ������������� “�������������������” ������51

�������������������������������������������� �������������������������������������������������� ���������������������� exception ������������ condition �������������� ������������� ILE condition ����������������� Register a User-Written Condition Handler(CEEHDLR) bindable API ��������������������������� exception ���������� Send ProgramMessage (QMHSNDPM) API ����������������� ������������������������ ����� ��������� ��������������������������������������������������������������� ��������������������� ILE

Handle Cursors ��� Resume Cursors

���������������� exception ����������������� 2 ��� ����������� handle cursor ��� resume cursor����������������������������� ������������ exception ���������������������������� handlecursor ��� resume cursor ������������������������������������� ���������� ������������������������������������������������������������� ����������������������

handle cursor��� ������������������������ ��� exception handler ����������� ����������������������� exception ��������� ��������� handle cursor ����� �������������������������������������� exception ����������� call stack entry ��������������������������:

v �������������������������

v ����������������������� ILE

v ����������������� HLL

Handle cursor ������������������������������� exception ���������������� ����������������������������������� exception ��������������� ��� exception ������������������������exception �������������������� call stack entry handle cursor ���������������������������� (��������������������������) ������ call stack entry �����������.

Resume Cursor��� ������������������������������������ exception �������� ������������������������������������������ exception ����. ���� �������������������� resume cursor������������������������������ exception. ������ call stack entry �����������������������������exception ���� resume point ����������������������������������������� �������������������������������������������������. ��������������������� Move Resume Cursor (CEEMRCR)bindable API ��������� resume cursor ����� resume point �����������.

������ 44 ������ 142 ��������������� handle cursor ��� resume cursor.

© ������������ IBM Corp. 1997, 2016 141

Page 150: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Handle cursor ��������������������������������� exception �������� 2 ������������������������������� exception ���������������� P2. ���� P10 ��� ��������������������������������������������. �������� ������������� P10 ��������� exception ����������� ���������������������������������� resume cursor ����������������������� P3. �������������������������������� P3�������� exception ������������������� P2.

�������������������������� exception P10 ����������������� resume cursor ��� ����������Move Resume Cursor (CEEMRCR) bindable API. ����� API ����������������� 2 ���. ��������� exception ������������� resume cursor ��������������������������������:

v Call stack entry ����� handle cursor

v Call stack entry ����������� handle cursor

�� ������ 44�������������������� resume cursor ����� ���������� P2 ���� P1 �����. �������resume cursor ����������������� exception ������������������������ ������������������������������ exception ������������������������������� resume point �������.

การเรียกแบบสแต็ก

โ P1พรซีเดอร "

CALLPRC P2

โ P2พรซีเดอร "

CALLPRC P3

ขอยกเวน# #

ตัวจัดการรายการ

จัดการเคอรเซอร" "

จุดการกลับสู !การทำงาน

โ P3พรซีเดอร "

เกิดขอยกเวน# #

ตัวจัดการขอยกเวน# #

โพรซีเดอร P10"

ILE

ILE

ILE

RV2W1044-0

จุดการกลับสูการทำงาน!

จุดการกลับสูการทำงาน!

จุดการกลับสูการทำงาน!...

������ 44. ��������������� Handle Cursor ��� Resume Cursor

142 IBM i: ������ ILE

Page 151: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������������������� Exception

�������������� exception ��������������� ������������������ exception �����������. ������������ ����������� ILE C �������� control action, ������ branch point ����������������message ID. ����������������������������������������������������������������������:

v �������������������������

v ����������������������� ILE

v ����������������� HLL

���������������������������

�������������������������������������������������� ����������������������������������� resume cursor. ��������������������������������������������� ������������������exception message ���������������������������������. ������������������������������������������ ������� exception. ����������������������� �������������������������� exception�����������������������������������.

������������������������������� ����������������������������������� exception. ���������������������������������������� �������������� exception ����������������������������������� ������������������ exception ���������������������. ��������������������������������������������� ����������������� exception ������������ Change Exception Message(QMHCHGEM) API ������� bindable API CEE4HC (Handle Condition). ) ����������������resume point ������������������������������������������ Move Resume Cursor(CEEMRCR) bindable API. ��������������������������������� ������������������������������������������������� exception ������.

��������������� ILE condition ������������������������������������ return code value ��������������������. ������������ ����������������������������������� Register a User-WrittenCondition Handler (CEEHDLR) bindable API ����������������� API ������������������������ IBM i Information Center

�������������������� HLL �������������� exception message ���������������������������������������������������������������� �������������������������������������������� resumecursor ����������������� HLL ��������������������� ILE HLL programmer’s guide

���������������� Message

��������������������������������������������������� exception ���������������������exception ������������������������������������������. ������������������������������������exception ��������������������������������������������. �������������� exception ������ callstack entry ���������������������������� ������������������������������ exception. ��������������������������� exception �������������������������������������������������exception.

����� 11. ����������������������������� 143

Page 152: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������������������������������������������� exception ���������������������������� (handle). ������������������������������ exception ������ ��������������������������. ������������������������������������� exception ����������������������������������� exception ������ call stack entry ������. ��������������������������������������������������� exception ���������������������������������� exception ���������� call stackentry �����������.

��������������� ILE condition ����������������������������������������� return code value��������������������. ����������������������������������������������� Register a User-Written Condition Handler (CEEHDLR) bindable API ����������������� API ������������������������ IBM i Information Center

�������������������� HLL ������������������������������������������� exception �������������� HLL ���������������������������������������������������������������������������� ��������������������������������� HLL ��� HLL ����������������������� exceptionmessage ��������������������. �������������������������� HLL ��� ILE �����������������exception ����������������� HLL �����������������������.

������� Promote ������

���������������������������������������� �������������������������� exception message���������������������. ���������������������������������� exception ��������������������������������������� exception ���������������� exception ����. ����������������������������������������������������� ������������ ILE condition ��������.

������������������������������� Promote Message (QMHPRMM) API ����� promote������. ������������ promote ���������� status ��� escape ��������. ���� API ���������������������������������������� handle cursor ������ �������������������� exception ���������������������� API ������������������������ IBM i Information Center

��������������� ILE condition ���������� promote ���������������������� return code value��������������������. ����������������������������������������������� Register a User-Written Condition Handler (CEEHDLR) bindable API ����������������� API ������������������������ IBM i Information Center

���������������������������� Unhandled Exception

��� exception message ����������������� ��������������� ���������������������������������. ��� exception ��� notify message ����������������������������, ��������� exception������������������ notify message �����������������������. ��� exception ��� status message��������������� exception �������������������������������������������������. ���exception ��� escape message ��������������� escape message ������ function check ������������������� resume cursor ����������. ������ exception ������������������ function check ���

144 IBM i: ������ ILE

Page 153: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������ stack ������� ��������������� �������������� escape message ������CEE9901������������������������� stack entry ��������.

�������� 10���������������������������������������������� exception ������������������������������.

�������� 10. ������������������������������ Unhandled Exceptions

�������������������������������condition

���������������������� Signal aCondition (CEESGL) BindableAPI

Exception ����������������������

Status 0 (Informative message) �������� condition ��������������� ���������������������������������.

Status 1 (Warning) �������� condition ��������������� ���������������������������������.

Notify 0 (Informative message) Not applicable. ��������������� notify �������������������������.

Notify 1 (Warning) Not applicable. ��������������� notify �������������������������.

Escape 2 (Error) �������� condition ��������������� ��������������� escape ���������������������������������call stack entry ����������resume point ��������.

Escape 3 (Severe error) �������� condition ��������������� ��������������� escape ���������������������������������call stack entry ����������resume point ��������.

Escape 4 (Critical ILE error) ��������������� escape ���������������������������������call stack entry ����������resume point ��������.

��������������� escape ���������������������������������call stack entry ����������resume point ��������.

Function check 4 (Critical ILE error) Not applicable ������������������������������� CEE9901 �������������(caller) ��� ���������������.

��������: �������������������������������������������������������������� activation group������������ ��������������� ���� call stack entry ��������������� activation group.

Nested Exceptions

Nested Exception��� exception ��������������������� exception ����������������������. ����������������������������� ������������ exception ���������������������������. ����������������������������������������� ������ ���������� handle cursor ��� resume cursor. ��������� exception��������������������� exception �����������������. �������������� handle cursor ��� resume cursor����������������. ����� exception ����������������������������� ������������ exception ���������������������.

����� 11. ����������������������������� 145

Page 154: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������� nested exceptions ���� ���� 2 ����������������� call stack:

v Call stack entry ���������������� exception ������

v Call stack entry ������������������������� exception ������

���������������������������������� exception handling loop �������������������������nested exception ��� call stack entry ������������ exception ������. ���������� promote nestedexception ������� function check message ����������� function check message ��������� callstack entry ��������. ������������������ nested exception ���� function check message ����������������������������������������������� Abnormal End (CEE4ABN) bindable API.���������������� CEE9901 ������������������������ ���������������.

���������� resume cursor ������������������� nested exception ���� ����������������������exception ���������. ������������������������ ���������������:

1. ���� resume cursor ����� call stack entry ����������� call stack entry ������� exception ������.

2. �������������������������������������������������

Condition Handling

ILE conditions������������������� ��������������������������������������������� ������� ILE condition token ������������������� ILE condition Condition handling��������������� ILE ����������������������������� ���������� ������������������������������������������ ����������� ��������������������. ������������ condition handling ������������������������������������������������������ condition handling.

ILE condition handling ����������������������� ���:

v ���������������������������������� ILE condition ����������

v ����������������������������� ILE condition

v Condition token architecture

v Optional condition token feedback codes for bindable ILE APIs

�����������������������������������������������������.

���������������� Condition

ILE Condition Token �������������������� 12 ���� �������������������� ���������������� condition. ��������������������� ������������������ (severity), ����������������������������� (associated message number), ������������������������� condition. condition token������������������������������������, ��� message service, ��� bindable API ����������������.��������������������������������� fc ����������������� ILE bindable API ���������������������������������������� condition token.

146 IBM i: ������ ILE

Page 155: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��� exception �������������������������������������� condition token �������������������������������������������. ����������������� condition token ��������� Construct a ConditionToken (CEENCOD) bindable API. �������������� signal ��� condition ������������������������ token ���������� Signal a Condition (CEESGL) bindable API.

��������� Condition Token

������ 45������������� condition token. ����������������������������������������.

Condition Token ����������������������������������� ������ 45

Condition_ID���� identifier ���� 4 ��������������� Facility_ID ����������� condition ��� token �������. ILE bindable API ������������������������������ condition ��� case 1.

Case ������������� 2 ��������������������� Condition_ID �������������������� token.ILE ����������������� case 1.

Severity����������������� 3 ���������������������������� condition. �������� Severity��� MsgSev ���������������������� ������������������������ condition. ���������� �������� 10 ������ 145 ��������������������������������� ILE. �������� �������� 12 ������ 149 ��� �������� 13 ������ 149 ������ ������������������������������������������������

Control������������� 3 ����������� flag ������������������������������������� condition.������ 3 ��������� Facility_ID ����������������������.

Facility_ID���� alphanumeric string ���� 3 ������������������������������ condition. Facility_ID����������������������������������� ����������� HLL �������� 11 ������ 148 ������������� facility ID �������� ILE.

0

0

32 34 37 40 64

16

Condition_ID

MsgSev Msg_No

Facility_ID I_S_Info

ID เงื่อนไขของ ILE มีรูปแบบเคส 1 เสมอ:

การควบคุมความรุนแรง

เคส

RV2W1032-2

������ 45. ILE Condition Token Layout

����� 11. ����������������������������� 147

Page 156: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

I_S_Info������������� 4 ��������������������������������������� condition. condition ��������������� reference key �������������������������� condition token. ��� message referencekey ������� 0 ��������������������������.

MsgSev����������������� 2 ���� ���������������������������� condition. MsgSev ���Severity ����������������������. ���������� �������� 10 ������ 145 ��������������������������������� ILE. �������� �������� 12 ������ 149 ��� �������� 13 ������149 ������ ������������������������������������������������

MsgNo ����������������� 2 ���� ��������������������������������� condition. ������Facility_ID ��� MsgNo �����������������

�������� 11�� IDs ������������������ �������� ILE ����������������������������������������

�������� 11. Facility ID �������� Message ��� ILE Condition TokensFacility ID FacilityCEE ILE common libraryCPF ������� IBM iMCH �������������������������� IBM i

�������� Condition Token

�������������� condition token �������������� bindable API �����������������:

��������������������������������� ���������� condition token ��� 4 ����������������������� 0�������. ���������������� condition token ���� 0 ���������������������� bindable API�������������������.

Equivalent Tokens��������������� condition token 2 ��� equivalent ���������� (������������ conditiontoken ������������� instance of the condition token �������) ����������������� 8 ���������� condition token. ���������������������������������� instance ���������condition ��������.

Equal Tokens��������������� condition token 2 ��� ���������������������� (��������� instancecondition ����������������) ��������������������������� 12 ������� condition token���� 2 ���. ������ 4 ������������������������� instance ����������� condition.

������������������� ILE ��������������������������������

������ ������ ������������������� condition ������������������� ILE. ���� ID ����������� ILE����������������������������������� condition ��������������.

148 IBM i: ������ ILE

Page 157: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������� (runtime message) ��� FFFxxxx:

FFF ��� facility ID ���� ID ���� 3 ������������������������������������������������ ILE ���ILE language. ���� �������� 11 ������ 148���������������� ID ��� facility ��������������.

xxxx ����������������������������������. ���������� 16 ���������������������������������������������� condition.

�������� 12��� �������� 13���� ������������������������ ILE condition ���������������������������

�������� 12. ��������������������������� *ESCAPE �������������������� ILE Condition

�����������������������IBM i

������������������ ILECondition

�������������������������IBM i

0-29 2 2030-39 3 3040-99 4 40

�������� 13. ��������������������������� *STATUS ��� *NOTIFY �������������������� ILECondition

�����������������������IBM i

������������������ ILECondition

�������������������������IBM i

0 0 01-99 1 10

IBM i Messages ��� Bindable API Feedback Code

������������������� bindable API ���������������������� feedback code ��������� feedbackcode ������� return code check ������������. feedback code ���������� condition token ���������������������������������������������������������������������������. ���� ������������feedback code ���������������� condition token ���. ��� feedback code ������������������bindable API ���������������� condition ����������� exception ������������������������bindable API.

���������������������� feedback code ����������������������������������������� feedback ���bindable API ������� condition �������������������������������������:

1. Informational message ���������������������� bindable API �������������������������������condition.

2. bindable API ������� condition token ������ condition �����������. bindable API ������������������������� instance specific information. instance specific information ��� condition token��� message reference key ��� informational message. ��������������������������condition.

����� 11. ����������������������������� 149

Page 158: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

3. ��� condition ��������������������������(������������������������ 4) ���������exception message ���������������� bindable API.

4. ��� condition �����������������������������(������������������������� 4) conditiontoken �������������������� �������� bindable API.

5. ����� condition token ������������������������������� �������������������:

v ��������������������������������.

v �������������� condition ������ Signal a Condition (CEESGL) bindable API.

v ��� Get, format, ��� dispatch ��������������������������� Get, Format, andDispatch a Message (CEEMSG) bindable API.

v ��������������������������������������������� Get a Message (CEEMGET) bindableAPI.

v ��� Dispatch a Message (CEEMOUT) bindable API ��������������������������������������������������������������������.

v ���������������� API ����������������������� informational message ��������������������������������������������.

�������������������� feedback code ��� ������������� bindable API, ���� exception message ���bindable API ���������������� bindable API ����.

150 IBM i: ������ ILE

Page 159: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 12. ���������������������������

��������������� (source debugger) ����������������������� OPM, ILE, �������������������������������� CL ���������������������� ������� OPM ���

������������������������������� ������������������������ ������������������������������������������������������������������������������������������������������ ILE (HLL) �������������������� ��������������������������������������������������������� (���� �������������) ���������������������������������������� ILE HLL

���������

����������������������� ������������������������������. ������������� ����������������������������������������������������������������������������������������.

�������������������������������������� Start Debug (STRDBG).

���������������������

������������������������������������� 2 ������:

v ��������������������������� OPM. ������� OPM ����������������������������������� ������������� OPM ����������������������������������� ILE.

v ��������������������������� ILE. ������� ILE ���������������������������������������. ���������������� OPM �������������������������������� ��������������������:

– ��������������� CL,COBOL, ���� RPG.

– �������������������������� OPM �����

– ����������� OPMSRC (OPM source level debug) ��������� STRDBG ��������������*YES

��������������������� ILE ����������������������������. ��������������������������� statement, source ���� list views �������������.

������������ OPM ��������������������������� ILE ��������������������������� ILE��� OPM �������������������������������������. ����������������������������������������������������� OPM �� ��������������������� ILE ���������������������������������������������������������������������������������������� ILE (HLL) ������ ���������OPM (������ ���� CL, �����������������).

© ������������ IBM Corp. 1997, 2016 151

Page 160: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�����������������������������������

����������������������������������������������������������. ������� OPM, ������� ILE,��� ��������������� ILE �����������������������������������������. ������������OPM ���������������������������������������������������� ���������������������������OPM ��� 20 �������. ������������������� ILE, ��������������� ���������� OPM����������������������� ILE �������������������������������������������������������������. ��������������� �������������������������������������������������������������������16 ������������ 1 �����.

��������������� *CHANGE ���������������������������� ��������������������������������������������. �������������������������� ���������������������������������������������������� call stack.

������������������������������� ILE ������������������ 1 �������������. �������������������� ILE ������������������� �������������������������������������������������������������������. ������������������������������������������������������������������������������������������������������.

������������������������������������������������������������������.

���������� Observability ��� Optimization �����������

����� optimization ��� observability ����������������������� ��������������������������������������������������������������������

�������� Optimization

��� optimization ��������������������� ��������������������������� ����������������������������������������������������� ��������������������������������� optimization ������� 10 (*NONE).�������������������������������������������������������� ��������������������������������������. ������������������������������������������� optimization ���� 30 (*FULL) ���� 40.����������������������������������������������������������.

���������������������������������

���������������������������������������������������������������������������������. ���������������������������������������������������������������������� ������������������������������������������������������������������������������� ILE ��������������������������������.���������������������������������������������������������������������������������������������������������.

�������������������������������������� �������������������������������������������������������������� Change Module (CHGMOD).

152 IBM i: ������ ILE

Page 161: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Module Views

�������������������������������������������������������������������������������������������������������� ILE ������������. ������������������������������������������������������������������������. ���������������������������������������������� View������������������������������ view ����������������������������. ������������������������:

*NONE������� ����� debug views ������������.

*STMT������� ������������������������������ ��������������������������������������������������� ��� statement number ��������������������������. ��������������������������������������������� view ������������������������������������������������������.

*SOURCE������� ������������������������������� ���������������������������������������������.

*LIST ������� list view ������������������������������. ������������������������������������������������������� ��������������������������������������� ������������������������. view ���������������������������������� ��������������������������. �������������������������������������������������������� ��������������������������������������������. ���������������������������������������������������������������������������������������������. ������������������ DDS ������������� (����ILE C includes, ILE RPG /COPY files ��� ILE COBOL COPY files).

*ALL ������� debug view ���������������������. ������������ list view ��� �������� �����data ����������������.

ILE RPG ������������������������� ������� *COPY ������������ source view ��� copy view. ������copy view ��� view ����� /COPY source member ������������������.

���������������

������������������������������������������������������������������������������ �����������������������. �������������������������������������������������������������������������������������������������. ������������ ������������������������������������������������������������������ ��������������������������������������������������� � ������(breakpoint). ��������������������������������������������������������������������������������������������������������������� �����. ������������������������������, �������������������������������������� CL Programming

����� 12. ��������������������������� 153

Page 162: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������������������� OPM ��� ILE

������������������������������� OPM ��� ILE ������������������������ OPM �������source ������� ILE Debugger API ������������ ��������� ILE Debugger APIs �������������� API��������������������� ��� IBM i Information Center �������������������������������OPM ��� ILE ����������������� ������� ILE ��� OPM ������������������������������������������������������������������ ��������������������� OPM ����������������� AS/400RPG, COBOL ���� CL. ���������������������� OPTION ���� *SRCDBG ���� *LSTDBG����������������

�������� Watch

��������� Watch ������������������������� execute ����������. ��������������������������������������������������������. ������������������������������������������������������������������ resolve �������������������������� �����������������������������������������������������. ����������������������������������� ��� execute ����������. ������������������������������������������ � ���������������������������������������������������������� �������������������������������������������������������������.

Exception ���������������������

��������� unmonitored exception ���� ��������������������������������������� ��������������������������������. ��������������������������������������������������������������������������� ��������������������������� Display Module Source. ������������������ ������������������������������������. ������������������������������������������������������������. ����������������������������������.

������������������������������������������

��������������������������������������:

v Coded character set identifier (CCSID) �������������� ������� 290, 930, ���� 5026 (JapanKatakana).

v Code page ����������� ������� (device) ����������� ����� ��� ��� 290, 930, ���� 5026(Japan Katakana).

�����������, ��������, ������������ 16 ���������������������������. ���������������:

BREAK 16 WHEN var=X’A1B2’

��������������������� code page ��������������������������� ������������������� identifiername ������������� (������������ EVAL). ������������������������������ ILE RPG, ILECOBOL, ���� ILE CL ������� Identifier �������������������������������������������������������������� ������������������������������������.

154 IBM i: ������ ILE

Page 163: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 13. �����������������������������

������������������������������������������������ ������������������������������������� ILE����������������������, ������������������������������������������������������ ������������� “��������������������������������� (Data Management Scoping Rules)” ������ 59

�������������������������������������������� ILE HLL programmer’s guide.

����������������������������

������������������������������������������������������������������������������������������� ��������������������������������. �������������������������������������������.������ ������������������������������������������������������������������.

���������������������� ����������������������������������������� open data path (ODP). ������������������������� open ��������� HLL open verbs, ������ Open Query File(OPNQRYF), ���������� Open Data Base File (OPNDBF). ODP ��������������activation group ���������������������. ������������� OPM ���� ILE �������������������������������� ODP ������������� call-level number ������������ override ���������������������������������� HLL open verbs ��� ���������������������� openscope (OPNSCOPE) �������� override, ������ OPNDBF, ��������� OPNQRYF.

OverridesOverrides ����������������������������������, �������� activation group, ��������������� ������������������������� override �����������������override scope(OVRSCOPE) . ��������������������������������������� ��������� override������������������������������ override. ���������� override ��������������������������� ������������������������ call ������������� override ��� activation group ���������� ��������������������������������� activation group

Commitment definitions�������� Commitment ����������������������������� activation group �������� job. ���������������������������������������������� control scope(CTLSCOPE) �������� Start Commitment Control (STRCMTCTL). ������������������������������ commitment definitions �������������� �������������������������� �� IBMi Information Center

SQL cursor ������������������ SQL ������������������������������������������� ������������������ ��������������������������������� ILE C ������������������� ILE C ��������������CREATE PROCEDURE, CREATE FUNCTION ���� CREATE TRIGGERLANGUAGE SQL

© ������������ IBM Corp. 1997, 2016 155

Page 164: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������ SQL ������� ������������������������������ SQL ��������������� ����������������������������������������������������������� �����������������������������������������������

��������������������������� ���������� ������������� IBM i DB2® for i SQL

������������ SQL �������������������������������������� SQL Cursor ����������������������� activationgroup �������������������������������������� SQL. ������������������������������� source job ������� target job ����������� job ����������.

���������������������������������� Open Print Application (QUIOPNPA) ��� Open Display Application API���������������������������������������������. API ��������������������������������������������������������� (UIM) �������������� activation group ��� job.������������������������������ ������������������������������� �������������� API ���������������������������� IBM i Information Center

������������������������� (��������������������)�������� Enable Link (QOLELINK) API �����������������������������. ��������� API������������������������������������-����������� ����������������������������������������������������� ������������ API ������������������������������ ��������������������������� ����������� call ���������������������������������������������������� ��������������API ���������������������������� IBM i Information Center

������������ Common Programming Interface (CPI)Activation group ������������������������������������������������. ���� activationgroup ������������������������������ Enable Link (QOLELINK) API ���������������������������������. ������������������������������������������������� CommonProgramming Interface (CPI) ����������������� API ����������������������������IBM i Information Center

Hierarchical file systemOpen System File (OHFOPNSF) API ����������������������������� hierarchical filesystem (HFS). ����������������������� open information (OPENINFO) �� API ����������������������������������� activation group ����������� job ���. �������������������������������������������������� �������������� API ���������������������������� IBM i Information Center

��������������� Commitment Control

ILE ���������������� 2 ��������� commitment control ���:

v ����� commitment definition �����������������������������������. transaction ����������������� commit ��� roll back ��������������������. ����������� ILE ���� ��������������commitment definition �������� 1 �����������.

156 IBM i: ������ ILE

Page 165: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ��������������������������������� activation group������������������������������ ������commit ������������������. ������������������� ILE ��������� commit �������������������������.

Commitment control ����������������� ������������������������������ ���� ����������������������������� transaction �����. Transaction�������������������������������������������������������������������������������������������������������������. commitment control���������������������������������������������������������:

v �������������������������������� (commit operation)

v ���������������������� �������� (rollback operation)

������������ �������������������������������� commitment control ����������������� OPM���������� ILE.

������ Start Commitment Control (STRCMTCTL) ������������������������������������������������� commitment control ���. ����� commitment control �������������������������STRCMTCTL ����������� commitment definition����. ���� ���� commitment definition ������������������������������������� STRCMTCTL ��������. commitment definition ����������������������������������������������������������� commitment control ������������. ���������commitment control �� commitment definition �������������������������������� commitment���������. ������������ End Commitment Control (ENDCMTCTL) ����������������������commitment definition. ������������������������������ commitment control, ������������Backup and Recovery.

Commitment Definitions ��� Activation Groups

Commitment definition ��������������������������������������������������������� job.commitment definition ������������������� job ��������� transaction ���������������������������������. ������������������������ commit ������� roll back ����������������� commitment definition������������������������.

��������: �������������� ILE ��������������������������� commitment control ������ ����������������������������������������������������� ������� job ����������� commitment definition ������������� job �������������������� ILE ��������

������� Original program model (OPM) �������������������������������������������������single-level ������������������ OPM ����� commitment definition *DFTACTGRP ��������������� commitment definition *JOB �������������� CMTSCOPE(*JOB) ����������STRCMTCTL.

����������������� Start Commitment Control (STRCMTCTL) �����������������commitment definition ��������������� commitment scope (CMTSCOPE). ������������commitment definition ������������������������� job ������ commitment definition ����.����������������������� commitment definition ��� activation group ����������������������

����� 13. ����������������������������� 157

Page 166: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

STRCMTCTL. ����������������������������������������������������� �������� commitmentdefinition ���� ��������������������������������� ������� commitment definition Commitmentdefinitions ������������������ activation group �������������� commitment definitions ���activation group level commitment definition ������������������� activation group ������ activationgroup �������������������������� activation group (*DFTACTGRP) commitment definition������� Commitment definitions ����������� activation group ����������������������������������������������������� activation groups ��������������������

Commitment definition �������������������������������� job ������ ���. ���������������������������������������� *JOB commitment definition. ���������������� �� activationgroup �������� commitment definition ������������������� activation group ����� job-levelcommitment definition ������������������������� commitment definition �����������������������������������������������������������. �������������� ���� commitment definition ����������������������������������.

������ activation group ������������ ���� commitment definition ���������������������������������������������������� activation group ����. ������������������ activation group ���������commitment definition �������������������� activation group ������������������������������������������ commitment definition ������������������������.

��������������������������� commitment control ����������������������������� �����commitment definition ��������������������. ������������� commit definition ��������activation group ��������������������������������. ��������������������������� ��������� � ������������������������������������� activation group ����������� commitment definition ����������������.

���������������� Commitment Control

Commitment control ������������������ job �������� activation group ��������������������������������� End Commitment Control (ENDCMTCTL). ������ ENDCMTCTL ������������������ commitment definition ������ activation group ��������������������������������������. ������ ENDCMTCTL ��������������� commitment definition ����� 1 �����������.��� commitment definition �������� �������������������������������.

��� commitment definition �������� activation group ���������, ���������������������� activationgroup �������������������������������� ������ commitment control ����������� ������commitment definition ����������������� �������������� ���������������������� commitmentcontrol �����������.

��� commitment definition ����� job ������������ ���������� �������������������������������commitment definition ����� job ��������������������������������� commitment control��������. ������ commitment control ��������������������� STRCMTCTL ��������������������������������.

158 IBM i: ������ ILE

Page 167: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Commitment Control �������� activation group ���������

��������������������������������������������:

v Activation group ���������

v Job ����������������

�������������� commitment definition �������� activation group ������������ ��������������������������:

v �������������������� commit ����������������� commitment definition �������� activationgroup

v Activation group �����������������

��������������������� commit ������ commitment definition ��������������������������� commitment definition ��. ����������������������������������������������:

v Activation group �������������������������

v ������������������������������� ����������������� commitment control ����������������activation group.

������������ rollback ����������������������� commitment definition �������� activationgroup ������������������� ��������� activation group �������������������� ����������������� notify object ��������� commitment operation �������������������������. �������commit ��� rollback �����������������������������������������������������������. ��� �������������������� rollback ������������� notify �������������������. ��� activation group �������������������������������������������������������������������� rollback ������������������.������ activation group ��������������������������������������������������������� �������� commit �������������������������.

Commit operation ���� rollback operation ���������������� ������������ activation group ����������������� *JOB ���� *DFTACTGRP commitment definition. ��������� commitmentdefinition ��������������������������������������������������� activation group. �����commitment definition �������������������������������� ENDCMTCTL ����������������������� job ������������.

���������������� �������������������� activation group ����������������� activation group����������. ������������������������������������������ activation group �����������������commitment control ����. ������������ close ������������� ���������������������������commit �������������������� commitment definition �������� activation group ������� record��� ����������������� I/O �������������������������������������� commit operation ��� ����������.

���������������������� commit operation ���� rollback operation ����������� commit ���rollback exit program API ������ commitment resource API. ����� API commitment resource���������������� commitment definition �������� activation group ������� commit ��� rollbackexit program API ����������� �������� commitment resource API �����������������.

����� 13. ����������������������������� 159

Page 168: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������������� ���������������� ��������:

v Rollback operation �������� commitment definition �������������������������� activationgroup ��������������������

v ���������������������������� commitment definition

160 IBM i: ������ ILE

Page 169: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 14. Bindable Application Programming Interface ��� ILE

ILE bindable application programming interface (bindable APIs) ���������������� ILE. ��������� ILE �����������������������������������������������������������������. ������������,������ HLL ������������������������������������������������. ����������, ��������������������������������������������� bindable APIs ��������. ��� HLL ���������������������������� bindable API ������������, ������ HLL �����������.

Bindable API ����������������� HLL. ��������������������������������������������������.�������� ����, ������������������������������� bindable APIs ��������������� ��������,�����������������������������������������������������������������������. ��������������condition management ��������������������������������������� condition ����� HLL �������.

Bindable APIs ����������������������� :

����������������� Activation group ��� control flow

����������������� Condition

���������������������������

���������������������������������

����������������������

�����������������������

�������������������������������������������������� operational descriptor

�����������������������������

��������������������������������

���������������������������� ILE bindable APIs �������������� API ���������������������������� IBM i Information Center

Bindable APIs ��� ILE ���������������

Bindable APIs ����������������������� HLL ��������� ILE ��������������. ILE �� bindableAPIs �����������:

Bindable API ��������� Activation Group ��� Control Flow

Abnormal End (CEE4ABN)

Find a Control Boundary (CEE4FCB)

Register Activation Group Exit Procedure (CEE4RAGE)

Register Call Stack Entry Termination User Exit Procedure (CEERTX)

© ������������ IBM Corp. 1997, 2016 161

Page 170: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Signal the Termination-Imminent Condition (CEETREC)

Unregister Call Stack Entry Termination User Exit Procedure (CEEUTX)

Bindable API ��������������������� Condition

Construct a Condition Token (CEENCOD)

Decompose a Condition Token (CEEDCOD)

Handle a Condition (CEE4HC)

Move the Resume Cursor to a Return Point (CEEMRCR)

Register a User-Written Condition Handler (CEEHDLR)

Retrieve ILE Version and Platform ID (CEEGPID)

Return the Relative Invocation Number (CEE4RIN)

Signal a Condition (CEESGL)

Unregister a User Condition Handler (CEEHDLU)

Bindable API ����������������������

Calculate Day-of-Week from Lilian Date (CEEDYWK)

Convert Date to Lilian Format (CEEDAYS)

Convert Integers to Seconds (CEEISEC)

Convert Lilian Date to Character Format (CEEDATE)

Convert Seconds to Character Timestamp (CEEDATM)

Convert Seconds to Integers (CEESECI)

Convert Timestamp to Number of Seconds (CEESECS)

Get Current Greenwich Mean Time (CEEGMT)

Get Current Local Time (CEELOCT)

Get Offset from Universal Time Coordinated to Local Time (CEEUTCO)

Get Universal Time Coordinated (CEEUTC)

Query Century (CEEQCEN)

Return Default Date and Time Strings for Country or Region (CEEFMDT)

Return Default Date String for Country or Region (CEEFMDA)

Return Default Time String for Country or Region (CEEFMTM)

Set Century (CEESCEN)

Bindable API ��������������������� x �������������� Bindable API ������������� ����������������������������������� ������:

I ��� ���������������������������� ������� 32 ���

162 IBM i: ������ ILE

Page 171: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

S ��� ��������� 1 ������� ������� 32 ���

D ������������ 2 ������� ������� 64 ���

T ��� single floating-complex number (��������������������������������������������) ������� 32 ���

E ��� double floating-complex number (����������������������������������������) ������� 64 ���

Absolute Function (CEESxABS)

Arccosine (CEESxACS)

Arcsine (CEESxASN)

Arctangent (CEESxATN)

Arctangent2 (CEESxAT2)

Conjugate of Complex (CEESxCJG)

Cosine (CEESxCOS)

Cotangent (CEESxCTN)

Error Function and Its Complement (CEESxERx)

Exponential Base e (CEESxEXP)

Exponentiation (CEESxXPx)

Factorial (CEE4SIFAC)

Floating Complex Divide (CEESxDVD)

Floating Complex Multiply (CEESxMLT)

Gamma Function (CEESxGMA)

Hyperbolic Arctangent (CEESxATH)

Hyperbolic Cosine (CEESxCSH)

Hyperbolic Sine (CEESxSNH)

Hyperbolic Tangent (CEESxTNH)

Imaginary Part of Complex (CEESxIMG)

Log Gamma Function (CEESxLGM)

Logarithm Base 10 (CEESxLG1)

Logarithm Base 2 (CEESxLG2)

Logarithm Base e (CEESxLOG)

Modular Arithmetic (CEESxMOD)

Nearest Integer (CEESxNIN)

Nearest Whole Number (CEESxNWN)

Positive Difference (CEESxDIM)

Sine (CEESxSIN)

����� 14. Bindable Application Programming Interface ��� ILE 163

Page 172: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Square Root (CEESxSQT)

Tangent (CEESxTAN)

Transfer of Sign (CEESxSGN)

Truncation (CEESxINT)

API ��������������������������:

Basic Random Number Generation (CEERAN0)

Bindable API �������������������

Dispatch a Message (CEEMOUT)

Get a Message (CEEMGET)

Get, Format, and Dispatch a Message (CEEMSG)

Bindable API ���������������������������������

Get String Information (CEEGSI)

Retrieve Operational Descriptor Information (CEEDOD)

Test for Omitted Argument (CEETSTA)

Bindable API �������������������

Allow a Program to Issue Debug Statements (QteSubmitDebugCommand)

Enable a Session to Use the Source Debugger (QteStartSourceDebug)

Map Positions from One View to Another (QteMapViewPosition)

Register a View of a Module (QteRegisterDebugView)

Remove a View of a Module (QteRemoveDebugView)

Retrieve the Attributes of the Source Debug Session (QteRetrieveDebugAttribute)

Retrieve the List of Modules and Views for a Program (QteRetrieveModuleViews)

Retrieve the Position Where the Program Stopped (QteRetrieveStoppedPosition)

Retrieve Source Text from the Specified View (QteRetrieveViewText)

Set the Attributes of the Source Debug Session (QteSetDebugAttribute)

Take a Job Out of Debug Mode (QteEndSourceDebug)

Bindable API ����������������������������

Create Heap (CEECRHP)

Define Heap Allocation Strategy (CEE4DAS)

Discard Heap (CEEDSHP)

Free Storage (CEEFRST)

164 IBM i: ������ ILE

Page 173: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Get Heap Storage (CEEGTST)

Mark Heap (CEEMKHP)

Reallocate Storage (CEECZST)

Release Heap (CEERLHP)

API �����������������������������

API ����������������������������� (DSM) �������������������� I/O ��������� ��������������������������������������������� ������������� ILE ��������.

API ���� DSM �����������������������������������������:

v Low-level services

Low-level services APIs ���������������������������� 5250 data stream commands API.����������� query ��������������������������������; ����������, ������, ����������������������������������������������������������������; ���������������������������������������������������.

v Window services

Window services API ����������������, ��, ����, �������������������������; ����������������� ������������� ���������������������������������.

v Session services

Session service APIs ������������� paging ����������������������������, ������, ������������������� ������������������������������������������.

��������������������� DSM bindable APIs ����������������� API ���������������������������� IBM i Information Center

����� 14. Bindable Application Programming Interface ��� ILE 165

Page 174: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

166 IBM i: ������ ILE

Page 175: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 15. ���������������������������������

������������������������������������������������������������ ������������������������� ILE������:

v “Adaptive Code Generation” ������ 192

v “��� Optimization �����������������” ������ 182

v “����������������������������� (Interprocedural Analysis - IPA)” ������ 175

v “���������� Licensed Internal Code” ������ 184

v “��������������� (Program Profiling)”

��������������� (Program Profiling)

���������������������������������������� optimization �����������������������,�����������������������, ���������������� ILE �������������������������� ���������������������������������������������������� �����������������������. ���������������������������������������������� instruction cache ����� paging �������������������� ,���������������������������������������. ����������������� semantic (semantic behavior) �������������������������������������������.

������������������������������������������������������������������������������������.���������, ������������������������������������������������������������������������������������������������������������������������������������/��������. ������������������������������������������������������������������������������� optimizingtranslator �����������������������������������������������������. ������������������������������������������������������������������������, �������������������������������������������������������������������������������������.

������������������������������������������ ILE �������������������������������������������:

v ��������������������������������� V4R2M0 ��������������������.

v ��������������������������������������� V5R2M0, ���������������������������������������������.

v ����������������������������� optimization ����� *FULL (30) ���������������. ��������������� V5R2M0 ���������������, �������������������������������������optimization��������������� 30 ���, �����������������������������������������������������������.

��������: �������������������� optimization, ����������������������������������������������������������.

© ������������ IBM Corp. 1997, 2016 167

Page 176: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������

���������������������������������������� 2 ����������:

v ��� block order

v ��� procedure order ��� block order

������������������ block order ����������������������������� condition. ������������������������ block order ��������������, ��������� optimization ���������������������������������������������� optimizining translator. ���������� optimization ��������������������������������������������������������������������������������������������������������������������. ������������������������������������������� �������������������������������������������������������������������������� prefetch ���������.

������������������ procedure order ����������������������������������������������������������������������������. �������������������������������������������������������������������������������������������������. �����������������������������������������������������������������������������.

����������������������������������������� block order ������������������������, ����������������������������������������������������������������.

�������������������������������

���������������� ������� ���������� 5 ������� ���:

1. ���������������������������������������.

2. ������������������������������������������������������� Start Program Profiling(STRPGMPRF).

3. ������������������������������������������� code path ���������������������������. ���������������������������������������������������������������� ������������optimization, ��������������������������������������������������������������������������������������������.

4. ���������������������������������������������� End Program Profiling(ENDPGMPRF).

5. ������������������������������������������������������������������������������������������� ��������������������������������������������������������������������.

������������������������������������������

��������������������������������������������������������������� 1 ��������������������������������������������������� ������������������������������������������������������������������������� *MODULE ������� 1 ����������������������������������������

168 IBM i: ������ ILE

Page 177: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������� �������������������������������������������, ����������������������������������������������������������������������������� ���������� 2 �����������������������������������������������������������

���������������������������������������������������������������������������������������������������������� ILE ��������� ������ change module (CHGMOD) ��������������������������� *COL ��������������� profiling data (PRFDTA) ����������������������� ��� ILE ����������������������, ������������� ILE ����������������������� optimization ����������������*FULL (30)

�������������������������������������������������������������� Change Program(CHGPGM) ���� Change Service Program (CHGSRVPGM), ����������������

v ����������� *COL������������� profiling data (PRFDTA) ��������������������������������������������������������������������:

– ������������������������ V4R2M0 ��������������� ������������������������V5R2M0 ���������������������������������������������������������������� ��������������������������������������� ���������������������������������������������

– ���������� optimization ���������������� 30������������������V5R2M0���������������, �������������������������������������optimization��������������� 30 ���, �����������������������������������������������������������

��������: ������������������������������������������ ��������������������������������������������� V5R2M0 ����������������������������������������� V5R2M0 ���������������, ������������������ ����������������������������������������������������������������������� V5R2M0 ����������������������, ������������������������������������������������������������������������������������

���������������������������������������������������������������������������������������������������� ������� ��������������������������������������������������������������� ����������������������������������������������������������� (����������� FRCCRT) ���������,�������������������������������������������������������������������� optimizing translator

������������������������������������������������������ ����������observability ��������������������������������������������������������������������������:

v ��������������������������������������������

v ����������������������������������������������������������������������

��������� Display Module (DSPMOD), Display Program (DSPPGM), ���� Display ServiceProgram (DSPSRVPGM) ���������� DETAIL(*BASIC), ����������������������������������������������������������������� �������������������������������� ������������� 5(������������) ������ DETAIL(*BASIC) ������������������������������� enable ������

����� 15. ��������������������������������� 169

Page 178: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������� ���������� “�����������������������������������������������������������������������������������” ������ 173 �������������������������

��������: ��������������������������������������� (�����������������������������������������������������) ���������������� ,����������������������������������� enable ��������������������������������������� ���������� “���������������������������������������������������” ������ 171 �������������������������

���������������������������

������������������������������������������� ������������������������������������������������������������������������������. �������������������������������������������������������������������������������������������������������������������������������������. �������������������������������������������������������������.

��������� Start Program Profiling (STRPGMPRF) �������������������������������. ������������End Program Profiling (ENDPGMPRF) ��������������������. ������������������������ ����������������������� *EXCLUDE �������������������������������������������� IPL

����������������������, �������������������������� ��� ����������������������������������������������������������������������������������������� ������������������������������������������������� activate ����������������������� STRPGMPRF �������

��������������������������������������������������������� ������������, ��������������������� ������������������������������ ������������������������������, ���������������������������������������� ������������������������������

��������:

1. ������������������������������������, ���������������������������������������������������� enable �������������������������������� ������������������������������������������ ″�������″ �������������������� �������������������������������������������������������������� ������������������������������������������������������������������ “���������������������������������������������������” ������ 171 �������������������������.

2. ��������������������������������������������� DASD ����������������������������� ���������������������������������������������������������� ������������ ������������������������� DASD ��������������� page out ��������������� ��������������������������������������������������� DAS ������������ Clear Pool (CLRPOOL) �������������������������������������������������

������������������������������������

����������������������������������� ��������������:

1. ��������������������������������������������������������������������������������(procedure order profiling data) ��������� ����������������������������������.

170 IBM i: ������ ILE

Page 179: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

2. ����������������������������������������������������� (basic block profiling data)�������������������������������������������������������������������������

3. ����������������������������������������������������������������������������������������. ��������������������������������������������������� .

4. �����������������������������������������������������observable���������:

v *BLKORD (basic block profiling observability)

v *PRCORD (procedure order profiling observability)

��������������������������������������, ������������������������. ���������������������������������������������������������������������������� “�������������������������������” ������ 168. ��������� ���������������������������������������������������� enable�������������������������.

�����������������������������������������������������, ������������������������������������������������� . ������������������������������������������������������������������������� �������� (������� block order ������ block and procedure order).

���������������������, ������������ Change Program (CHGPGM) ���� Change Service Program(CHGSRVPGM). �������������������� profiling data (PRFDTA) ������������:

v Block order profiling data (*APYBLKORD)

v ���������������block order��� procedure profiling data(*APYALL) �������(*APYPRCORD)

�������� ���������������� *APYALL.

������������������������������������������observability������������������ . �����������observability��������������������� Change Program (CHGPGM) ��� Change ServiceProgram (CHGSRVPGM).

v *BLKORD observability �����������������������������������block order ��������������������. ������������������������������������������� block order ����������������������������������������������������.

v ����������������������� procedure order ���������������������������observability����*PRCORD ��� *BLKORD����������. �������������������������������������������procedure order ��������������������������������������������������������������� .

������������, �������������������� block order ������������������� ������ *BLKORDobservability �����. ������������������������������� block order ����. ������������������������� ��������������������������� ���������������������������������� block order ��.

���������������������������������������������������

������������������������������������������������������������� Change Program(CHGPGM) ���� Change Service Program(CHGSRVPGM) ���������������������������

����� 15. ��������������������������������� 171

Page 180: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������������������������������������������������������������� ������������,���������������������������������������������������������� optimization ���� *FULL ������������� 40, ���� ������������� ������������������������������� ��������������������������������������������������������������������restore ���������������� FRCOBJCVN(*YES*ALL) ����������� Restore Object (RSTOBJ)

������������, ������������������������������������������������������������� UpdateProgram (UPDPGM) ���� Update Service Program (UPDSRVPGM) ��������������������������������������������������������������������������������������������� ������������,������� P1 ��������������� M1 ��� M2 ����� M1 ��������������� P1 ��������������������������� �������� M2 ��� ������������������������������� enable ����, ���������������� P1 ��������� M1 ���� M2 ����������������������� enable ���������������������� ������������������������������������������� ������������,�������� M1 ������������������������������������������������������������ *NOCOL ��������������� profiling data (PRFDTA) ��������� Change Module CHGMOD) , ���������������� P1 ���� M1 �����������������P1�������������������������� ��������

��������������������������������������������������������� *CLR ��������������� profiling data (PRFDTA) ��������� Change Program (CHGPGM) ���� Change ServiceProgram (CHGSRVPGM) �������������������������������� *CLR ������������ activate

�������������������������������������������������������������, ������������������������������������:

v ������������������ profiling data(PRFDTA) �������� Change Program (CHGPGM) ����*NOCOL

v ������������������ profiling data(PRFDTA) �������� Change Service Program(CHGSRVPGM) ���� *NOCOL

�������������������������������������������������������������������������������� ���������������������� PRFDTA �������������� *NOCOL ���������� CHGMOD �����������������������������������������������������������

�����������������������������������������

��������������������������������������������������������� Change Program (CHGPGM)���� Change Service Program (CHGSRVPGM) ����������������������������������������������������������������������:

v ������������������������������������������.

��������: ���������� optimization ������������������������������������ ����������������������������������� 30 ���. ����������������������������������������� optimization.

v Profiling observability ��������������������.

172 IBM i: ������ ILE

Page 181: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������� ������������������������������������������ ��������������������������������������enable ������� ����������������������, ������������� ���������� observability ��������������������. ������������������������������������� enable ����������������������.

�������������������:

v ������� A ������������������ procedure order ��� block order �����. �� *BLKORDobservability ��������������������� *PRCORD observability ���������. ���������CHGPGM ������������������������������������������������������� A ,�����������������������������. ������������������������������� A ������������������ block order��������. �������������������������������������� procedure ��������������.

v ������� A ������������������ procedure order ��� block order �����. ���� *BLKORD ���*PRCORD observability ������������������ A. ��������� CHGPGM �����������������������������������������������A ,����������������������������. ������������������������������� A ���������������������block order ������� procedure order ��������.������� A ���������������������������������������������������������.

v ������� A ������������������ block order ������. �� *BLKORD observability ������������������. ��������� CHGPGM ����������������������������A , ����������������������������������. �����������, ������� A �������������������������������� block order.

v ������� A ������������������ procedure order ��� block order �����. ������� observability��� *PRCORD ��� *BLKORD ���������� �������������. ��������� CHGPGM ���������������������������������������(��������������������). �������������� A ���������������������� block order ��� procedure order �������� ���������������������������������������������������������������������������. ������������������������ enable������������������������������������������������������������������.

������������������������� (*APYALL, *APYBLKORD ���� *APYPRCORD ) ����� ���������������������������� ����������������������������������������������� PRFDTA(*NOCOL) �������� CHGPGM ���������� CHGSRVPGM ���. ������������������������������������������������������. �������������������� ���������������������� PRFDTA(*COL), ��������������������������������������������, ���������������������� PRFDTA(*NOCOL).

����������������������������������������������� ��������������

����������������������

��������� Display Program (DSPPGM) ���� Display Service Program (DSPSRVPGM), ���������� DETAIL(*BASIC) ������������������������ program profiling data ���������� ������″Profiling data″ �������������������������:

v *NOCOL - ������� ���������������������������������������������

v *COL - ������� �������������� 1 ���������������������������������������������������������� ����������������������������������������������������

����� 15. ��������������������������������� 173

Page 182: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v *APYALL - ������������������������� block order ��� procedure order �������������������� ��������������������������������� enable ��������

v *APYBLKORD - ������������������������� block order ���������������������������������������� 1 ���������������������������� ���������������������������������������� enable������������������������������������ ��������������������������������� enable ��������

v *APYPRCORD - �������������������������������������������������������� ����������������������������������������������������� ��������

������������������������������ procedure order �������������:

v ���������������������� *APYALL ���� *APYPRCORD (���������������� *APYALL)

v ����� observability *BLKORD ����������������������������

������������������������ profiling data ���������������������������������, ������������ DSPPG���� DSPSRVPGM DETAIL(*MODULE) ����������� 5 ���������������������������������������������������������������������� ������ ″Profiling data″ �������������������������:

v *NOCOL - ������� ����������������������� enable ����������������������

v *COL - ������� �������������������� enable ���������������������� ����������������������������������������������������

v *APYBLKORD - ���������������� block �������������������������������������� ����������������������������������� ��������������������������������� enable ��������

�������������������� DETAIL(*MODULE) ����������� field ����� �������������������������������������������������������������� program profiling data ������

v ������������������ ������� ��������������������������������

v ����� procedures block reordere�d ��������������������������������������� basic blockreordered

v �������� procedures block order measured ����������������������������������������������������� block order �������������������������������� block order ���������������������,����������������������������������������������������������� ������������� �������������������������������������������� ������������������������������������������������������������������������������������

��������� DSPMOD ���������������������������������������������� ������ ″Profiling data″

������������������������������������� ��������������� *APYBLKORD �������� basic block data���������������������������������������������������

v *NOCOL - ������� ����������� enable ����������������������

v *COL - ������� �������� enable ����������������������

174 IBM i: ������ ILE

Page 183: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������������� (Interprocedural Analysis - IPA)

������������������������������������������ Interprocedural Analysis (IPA) ����������������������������������� IPA �������� CRTPGM ��� CRTSRVPGM.

�������������,optimizing translator ���������������������������������������������������. ��������������������������� (Intraprocedural Analysis) �������������������Optimization �������������������������������������������������������������������������������������������������������. ���������������������������������������������������������������������. ��� optimizing translator ��������������������������������� �����������������������������������. ������������������������������������������������������������������ IPA�������������������������������������������������������������������������������������. ������������������������������������������������������ IPA ���� IPA ��������� optimize ����������������. ����������������� optimize ��������������������������������������optimizing translator. ������ optimizing translator ����������� IPA �����������Optimization ����������������:

v ����� inline ���������������������.��� Inline ���������������������������������������������������������. ������� Inline ������������������������������������������������, ����������������������������������������������� ��������������������������������� optimize �������������������.

v �������������������.������������������������������������������������������������������������������������������������������. ���������������������������������������������������� ����������������. ������������������������������������������������������������������� “�������������������� IPA” ������ 181.

v ���������������������.���������������������������������������������� ����������������������������������������������������������������������. �������������������������������� �������������������������.

v ������������������������������.�������������������������������������������������������.

v ������������������������.����������������������������������������������������������������.

v ��������������������������������������������.�������������������������������������������������������������� Inline ��� 100 % ����������������������.

v ��������������������Intraprocedural ����������������. IPA �������������������Floating Point ����������������������������������������������������. �������������������������������������������������������� ����������������������������� ��������������������������.

v ��������������� alias �������������� Intraprocedural. IPA ����������������������������������� ������������������������������������������������������������������������������� �����������������. �������������������� ������������������������������� optimize�������������������������. IPA ��������������������������������������������������.

����� 15. ��������������������������������� 175

Page 184: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������������������������������������������� ����������������������,IPA ����������������������������������������������������� ����������������������.

v ��������������� Intraprocedural copy IPA �������������� ����������������������������������������������. ��������������������������������������������������������. ��������������������������������������������.

v ��������������� intraprocedural ������������������� ����������� store. IPA ��������������������������������������������� ���������������������������������������.

v ������������������������(�������)������� value arguments. IPA ����������������������� (�������) �������������������� �������������������������������������������������������������.

v ��������������������������������(stack) variables. IPA ������������������������������� (stack) ��������� ������������������������������������������������������������������������.

����������������������������������� IPA ���������� ������������������������������������� ������������������������������������������������ Optimize ��� IPA ������������������������������������������������������ IPA �������������. �����������������������������������������������������������������������������������������������������. ������������ (�������������), ���������������������������������������������������������������������. ���������������������������, ������������������������������������������������������.�������������������������������������������������������������������������������������������. ��������������������������������������������������������������������������������:

v ������������������

v ����������������������

v �������������������������������������������������������������

v ������������������������������������������������������������

��� Optimization ����������������������������������������������� ILE ��� ����������������������������������:

v ������������������������������������������������������������������� V4R4M0�����������������.

v �������������������������������������������������������������� Optimization ���� 20(*BASIC) ���������������.

v ������������������������������������������������ IL �����������������. ���������������������������� MODCRTOPT(*KEEPILDTA) ���������������� Intermediate language (IL)�����������.

��������: ���������������������� optimize ����������������������������������������������������������������������.

176 IBM i: ������ ILE

Page 185: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������� Optimize ����������������� IPA

������������������ IPA ����� Optimize ��������������������������������, ��������������������������:

1. ������������������������������������������������������������������������������������� MODCRTOPT(*KEEPILDTA) �������� Optimization Level ���� 20 ��������������� (������������� 40). ������������������ DSPMOD �������������� DETAIL(*BASIC) ������������������������������������������ ������������������������. �����Intermediate language data���������������� *YES �������������� IL ��������. ���������Optimization level ����������������� Optimization ������������.

2. ���������� IPA(*YES) �������� CRTPGM ���� CRTSRVPGM. ������������������ IPA�����, ����������������������������������������������� IPA.

��������������������������������������� IPA optimize ������������������� �������������������:

v ���� IPACTLFILE(IPA-control-file) ������������������������������������ IPA ��������� .�������������� “IPA control file syntax”����������������������������������������������������������.

������������ IPA(*YES) �������� CRTPGM ���� ������������������������� (���������������� ALWUPD(*YES)). ����������������������������� ALWLIBUPD �������� CRTSRVPGM.��������������� IPA(*YES), ���������������������� ALWLIBUPD(*NO).

IPA control file syntax

������������� IPA ���������������������������� IPA ���������. ����������������� �������������, ��������������������� QSYS.LIB (������������, /qsys.lib/mylib.lib/xx.file/yy.mbr). ����������� IPACTLFILE �����������������������.

IPA ���������������������������� �����������������������������������������������.

���������������������������������������������:

exits=name[,name]�������������������������������������������������. �������������� optimize ���������������� (���� �������������������������������������) �����������������������������������������������������. ���������������������������������������������������������IL ������������������.

inline=attribute���������������������������������������������������������������������� Inline.�������������������������������������������������:

����� 15. ��������������������������������� 177

Page 186: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

auto ��������������� Inline ������������ ����������������� inline ������������������ inline-limit ��� inline-threshold. �������� noinline �������������Inline ������������. �����������������.

noauto ���������� IPA ������������ Inline ������������������������������� ��������������������������.

name[,name]���������������������������������������� Inline. ���������������������� Inline������������.

name[,name] from name[,name]�������������������������������������������� Inline ����������������� ��������������������������. ���������������������� Inline ������������.

inline-limit=num������������������������� (�������������� abstract) ��������������������������������� Inline ������. ������� Abstract ��������������������������� Executable�������������. ������������������������������������������� Inline ����������������������, �������������� �������������� ��������������. ���������������������������������������������� inline=auto. �������������� 8192.

inline-threshold=size����������������� (�������������� abstract) �������������������������������� Inline������������. ���������������������������������������������� inline=auto. �������������� 1024.

isolated=name[,name]���������������������� ″isolated″. ������������ Isolated ����������������������������������(�������������������������������������������������������) ��������������������������������������������������������������������������. IPA �������������������������������������������� Isolate.

lowfreq=name[,name]���������������������������������������������������������. ���������������������������� �����������������. IPA �������������������� �������������������������������������������� optimize �����������������������������.

missing=attribute������������������������������������������� Missing. �������� missing ����������������������������������������� IL ���������� ���������������������������� unknown, safe,isolated, ���� pure. ���������������������� IPA �������� Optimize ���������������������������������������������������������������������� IL �����������������.

IPA �����������������������������������������������. ����������������������������������������������� Resolve �������������������� ������������������.

178 IBM i: ������ ILE

Page 187: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������������������� unknown. ������� Unknown��������� IPA������������������������� ������������������������������������������������ ������������������������������������������������. �������������������������������������������������:

unknown��������������� ″unknown″ ��������. �������������������������������unknown ��������. ��������������������������������.

safe ��������������� ″safe″ ��������. ������������������������������� save ��������.

isolated��������������� ″isolate″ ��������. ������������������������������� Isolate������.

pure ��������������� ″pure″ ��������. ������������������������������� pure ��������.

noinline=name[,name]����������������������������������������������� Inline.

noinline=name[,name] from name[,name]����������������������������������������������� Inline, ��������������������������������������� ���������������������.

partition=small| medium|large|unsigned-integer�������������������������������������� IPA ���������. ������������������������������������������������� ������������������������. ������������������������, ������������������������������� �������������������������.

��������������������������� Medium.

������������������������������������, ����������������� unsigned-integer �������������������������. ���������������������������������, ����������������������������������. �������������������������������������, ����������������������������������������.

pure=name[,name]���������������������� pure. ���������������� Safe ��� Isolate. ������������ pure ����������������������������. ���������������������������������������������������������������������������������� ��������.

safe=name[,name]���������������������� safe. ������������������������������������ ������������������������������ IL ���������������������. ������� safe �����������������������������������������.

unknown=name[,name]���������������������� unknown. ������������������������������, Isolated ���� Pure.

����� 15. ��������������������������������� 179

Page 188: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������� IPA

v ������ IPA �����������������������. ���������������������������������� ������������������������������� �����������������������������������������.

v IPA ��������������������������������������������������������������������������.

v ����������� Optimize ���������������������� IPA ����������������������������������������������, �����������������������������������������������������������������.

v ��������� IPA �������������������� Inline, �������������������������� API ���������������Relative Stack Frame Offset (���� QMHRCVPM).

v �������������������� inline, IPA ��� inliner ��� IPA �������������� �������������������������. �������������� ������������ backend inliner, ���������� ������� INLINE ���������������, ���������. ����������������� ������������ IPA ����������������� IPA.

���������������������� IPA

v ��������������� UPDPGM ���� UPDSRVPGM ��������������������������������������� IPA ����� Optimize �������.

v ���������������������������������������������� IPA ��� optimize ���� source debugfacilities �������. ������������ IPA �������������������������������������������� IL ������������������������������������������������������������������������������. �����������,����������������������������������������������������������������� IPA ���.

v ����������������� ���������������� 10,000 ���������. ��������������������������������������,��������������������, �����������������������������������. �������������������������, ��������������� CRTPGM ���� CRTSRVPGM �������� ����������������������������������. ������������������������� partition ������������ “IPA control file syntax” ������ 177.

v ������������������� IPA ������������������������������������� ����������������������SQL ����. ����������������������������� ���������������������������� IL, ������������������������� ����������������. ��������������������������������������������������������� IL, ������������������������������������������������� IPA ������������������� SQL ������. ������������,������������������� C ����������� SQL ��������. �������������������������������������� CRTSQLCI; ������������, ��������������������� MODCRTOPT(*KEEPILDTA).

�������������������������������������� *MODULE ��������������� SQL ��� IL.

1. ������������������ SQL C ���������� CRTSQLCI. ���� OPTION(*NOGEN) ��������������������� TOSRCFILE(QTEMP/QSQLTEMP). ������������������������������� SQL ����������� SQL ����������������������������������������������������������������.����������������� C ���������������������������������������������������� QTEMP/QSQLTEMP.

2. ���������������� C �� QTEMP/QSQLTEMP����������� MODCRTOPT(*KEEPILDTA)���������������������. ��������������������������� C *MODULE ��� SQL, �����������������������������������������������������������������������������������������

180 IBM i: ������ ILE

Page 189: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���. ���������� *MODULE �������������� IL �������. �. ������, �����������������������*MODULE �������� CRTPGM ���� CRTSRVPGM ��������������� IPA(*YES).

v IPA ��������� optimize ����������������������������� optimization ����� 10 (*NONE).IPA ��������������������������� IL ����������������������optimization ������������������.

v IPA ��������� optimize ������������������� IL. �����������, IPA ��������� optimize ������������������������������������������� ������� MODCRTOPT(*KEEPILDTA). ������������������������������� C ��� C++.

v �������������, ���������� entry point ����������, ������������������������������, ������������������������������ �������������������, �������� IPA ���������. ���������������������, ��������� ����������������������������������������������������������������� �������������������, �������� IPA ���������. ���������������������������������������� ����������������������������������������, ��� ���������. IPA ������������� ������������������������������, ������������������������������� optimize.

v IPA ������������ optimize ��������������� ���������������������������� ������� RTBND(*LLP64) �������� Create C++ Module (CRTCPPMOD) ���� Create Bound C++ Program(CRTBNDCPP) �������������������� virtual �� ����� IPA ���������� optimize �������������������������� virtual ���������������� MODCRTOPT(*NOKEEPILDTA)

v IPA ������������ optimize ��������������� ���������������� ����������������������

v IPA ������������ optimize ��������������� ���������������������� thread local storage

�������������������� IPA

�������������������������������������������� IPA ���������������������������� ���.IPA ����� *MODULE ��������������������. ��������������������������� 2 ���������:

v ��������������������������������������������� ����������������������������������������������������������.

v ��������������������������������������������������������������������������������������.

�������������������� 3 �������:

v �����������������. ����������������� ����������������������������.

v �������������. ���������������������������� Primary Entry Point ����������.

v ������������ �����������������.

IPA �������������������������������������������������������:

v �������� ’partition’ ������������������������������������������� IPACTLFILE. ����������������������������������������������.

v ������������������������������������. ��������������������������������������������������������������.

����� 15. ��������������������������������� 181

Page 190: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v �������������� Resolution ���������������������������������������������������������.IPA ����������������������������������������������������������������������������������. �����������������, �����������������������������������������������������������������������������������.

������������������������������� Licensed Internal Code Options (LICOPTs). ��������������� 2����� LICOPT ������������� IPA ��������������������������������������������������������������������������. ������ “Partition Map” ������ 216 ��������������������� Partition Maplisting . ���� IPA �������������������������������������, ������ *MODULE ��������������������������������������������������������������������. IPA ������� ������������� *MODULE������������������������ (������������, QD0068xxxx���� xxxx��������� 0000 ��� 9999).

���������������������� DSPPGM ���� DSPSRVPGM ���������������. ������� ’Program entryprocedure module’ ���������������������� *MODULE �������������������� *MODULE.����� ’Library’ ��������������������������������������������������������������������������. ��������� ���� ����������������������������������������������������� ���������������������������� ��������������������������������������������� Optimize ��� IPA, ���������’Program attribute’ ������������ DSPPGM ���� DSPSRVPGM ������� IPA, �������������������������������������������������������� ��������������������������

��������: ����� IPA ����������������, IPA ����������������� �������������������������� @nnn@���� XXXX@nnn@, ���� XXXX �����������������, ��� nnn ���� ������������������. ������������������������������� ������������ Static ��������������������������.

��� Optimization �����������������

��� optimization ����������������� ������� optimization ������������ ����������������������������������������������� ��������������������������� ������������������ C++ ������������������������ ��� nonvirtual �������������������������� �������������������������������������������������������������������������������������� ��������� ���������������������������������������������������������������������

���������� Optimization �����������������

����������� Argument optimization (ARGOPT) ������������������������ *YES ��� *NO ����������������������� CRTPGM ��� CRTSRVPGM ����� ����������� optimization ����������������� ������� ARGOPT(*YES) ����� ���������������������������������������������optimization ����������������� ������������� *NO

����������������������������������� Optimization �����������������

����� ARGOPT(*YES) ������������������������������� ���������� optimization ����������������� ������������� ������������������������������������ �������������������������������������� ������������ �������������������� ����������������������������������� optimization�����������������:

182 IBM i: ������ ILE

Page 191: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ��������������� optimization ������������� pragma-based:

��� optimization ��������������������������� ARGOPT(*YES) ������ optimization ��������������������������� #pragma argopt directive �������������������������� C ��� C++����������� ���������������

�������� #pragma argopt �������������� ������ �������������������� ������ ARGOPT(*YES)����������� ����������� #pragma argopt ���������������������� ������������������

����������� #pragma argopt ������������ ������������������� ARGOPT(*YES) ������������������������������ �������������������������� ��������� #pragma argopt ������ ������������� �������� optimization ����������������������� optimize �������� ����������������������� ������������������� Virtual �� C++ ��������������� ���������������������������

������ ������������������������ #pragma argopt directive �������� ��������������������������

ILE C/C++

������������ ��� optimization ����������������������������� ��� optimization ��������������� pragma-based ������������������ #pragma directives ���������������������� ������ optimization ���������������������������������������������������� ��� ���������������������� ��������� ��� optimization �������������������������������� ������������������������ ����������� optimization ��� pragma-based ��������� ���� C ��� C++ ��������

�������� #pragma argopt directive ������������ ������������������� ������ optimization����������������������� optimize ������������������� virtual ���������������������������������������������� ������������� ��� optimize ��������������� argopt pragma ����������������������������������������� ������������� optimization �����������������

v ������������ 16 ����:

������������������� Space ���� 16 ���� ����������������������������� optimize ���������� �������� Space ������������ ���������������� ���� ������ ������ ���� ������������������ ����������� �������� Space �� C and C++ ������ char* ��� int* ������������ ��������������������������������� 16 ���� ��������� ����������������� IBM i �������� ���� ������������������������������������ �������� optimized ��� ������������ optimization �������������������������� ���� �������� void* ������ C ��� C++ �������� ����������������� ��������optimize �������

v DTAMDL(*LLP64):

������������ C ��� C++ �������������������������� ���� DTAMDL(*LLP64) �������������������� optimization ���������� ������������� ������������ DTAMDL(*P128)����������������� ��������� ��������������������������� ���� 8 ���� ���������������������������������������� ���������������������� ���������� ��������������������������� ���� 16���� ������������� optimization ����������

v �������������:

������������������� ARGOPT(*YES) ������ ������������������������� V6R1M0 �����������

����� 15. ��������������������������������� 183

Page 192: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������������������� ������ optimization ����������������� ������������������������������������� ARGOPT(*YES) ������������������������������ V6R1M0 ����������� ������������������ ����������������������������������������������������������������V6R1M0 ���������������� optimization �����������������

v ��������������������������:

��������� ARGOPT(*YES) �� ���������������������� ��������������������������������������� ��������� �������������������������������������������������� ����� �����������������������������������������

��������������� ����� ������������ Update Program (UPDPGM) ���� Update ServiceProgram (UPDSRVPGM) ������������������������������ ARGOPT(*YES) �������������������������������������� ��������������������������������� ��������������������������������������������������� ���������������������������������������������������������������������������� ����

v ���������������������������:

��� optimization ����������������� ��������������� dynamic program calls ��������� ��������C ��� C++ ��� ���������������������� _System ������������ optimization �����������������

v �������������������������������:

��������������� optimization ����������������� ������������������������������������

v ������������ interprocedural analysis (IPA):

������������������ optimization ��� ������������������������ IPA ��������������������� optimization ����������������� ������� ����������� IPA ��������������������� optimization���������� �������

���������� Licensed Internal Code

Licensed Internal Code options (LICOPTs) ��������������������������������������� LicensedInternal Code ����� �������������������������������������������������������� ������������������������ ������������������������������ ���������������������������������������� ���optimization ������������� ����������������������������� �������������� �����������������Licensed Internal Code

����������������������������

������� Licensed Internal Code ���������������������������:

[No]AlwaysTryToFoliate

������ optimizing translator ����������������������������������� 40 ��������� ����������������������������������� call foliation,���������������������� stack frames ������������������ call stack ���������� ����������������������� ��������� ���������� stack frames ��������� ��������������������������������� ��� ���������������������������� ������������

184 IBM i: ������ ILE

|

|

|

|

|

Page 193: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������� runtime stack overflow ������������������������� ����������������������� ��������������������� �� call stack ������������� ����� ��������������������������������.

[No]CallTracingAtHighOpt

����������������������������������������� trap ���������� ��������������������������������� ������� Stack ����� optimize ����� 40 ���������������������� ��������� trap ��������������������� job trace ������������������������������������������������ ��������������� 6.1 ���������� ��������������������� ��������������������������������������� trap ���������������� ��������������� optimize ����� 40 ������� 6.1 ��������� ��������������� ������ �������������������� trap ��������������������������������������� ��������������� ������������ optimize ����� 40

[No]Compact

��������������������������������������������������, �������������������������������������. ������������������ Optimize ��������������� ��������������� Inline. ��������������������������������.

CodeGenTarget=

������� CodeGenTarget ����������������������������������������� ������������������� ���������������������������������������������� ����������������������������������������������� ������������������������� ������������������ LICOPT ���

��� ��������

CodeGenTarget=Current optimizing translator ���������������������������������� �����������������

CodeGenTarget=Common optimizing translator ����������������������� ��� ���������������������������������������������������

CodeGenTarget=Legacy optimizing translator ������������������������ ����������� �������POWER6 �������������� PowerPC® AS �����������

CodeGenTarget=Power6 optimizing translator ������������������������������������ �����POWER6 �������������� PowerPC AS

CodeGenTarget=Power7 Optimizing translator ������������������������������������ �����POWER7® �������������� PowerPC AS

CodeGenTarget=Power8 optimizing translator �����������������������������������������POWER8® �������������� PowerPC AS

���������������������������������������� ����� “CodeGenTarget LICOPT” ������ 196

[No]CreateSuperblocks

�������������������������������� superblock , ���������������������������������� basicblock ������������� control flow ����������������������. ���������������������������optimization ��������������� superblock ���� trace unrolling ��� trace peeling. ���

����� 15. ��������������������������������� 185

|

|

|

||

|||

Page 194: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�����superblock �������� optimization ����������������������������������������; ���������������������������������������� optimization. �������������������������������������������������������. �������������������������������������

[No]DetectConvertTo8BytePointerError

������������������������������� 6.1 ���� ����������� ������������������������� 16 ���������������� 8 ��������������� MCH0609 exception �������������� 16 ���������������������� Teraspace ���� ��� Null

[No]EnableInlining

������������������������ inline ������������������������ optimizing translator. �����inline�����������������������������������������������������������������inline����������������� . �������������������������������������

[No]FoldFloat

��������������������������������� Floating-Point �������������. ���� LICOPT ��������������������������������� ’Fold float constants’. ����� LICOPT ���������� ���������������������������������������

LoopUnrolling=<option>

���������� LoopUnrolling ���������������������������� loop unrolling ��� optimizingtranslator. ��������������� 0 ������������������ loop unrolling ,���1 ��������������� loopunrolling ������������������������������������������������� ��� 2 ��������������� loopunrolling ��������������. ������������� 2 �����������������������������������. �������������1.

[No]Maf

��������������������������-��������� Floating-Point. �������������������������������������������������. ���������������������������������, �����������������������������. ���� LICOPT ��������������������������������� ’Use multiply add’. �����LICOPT ���������� ���������������������������������������

[No]MinimizeTeraspaceFalseEAOs

���������� Effective Address Overflow (EAO) ����������������������� ����������������������������������� 16 ���� ������������������������������������������������������������������ teraspace ��� single-level storage (SLS) ������������� teraspace �������������������������������� EAOs ��� ��������������������������������������������POWER6 ���������� “Adaptive Code Generation” ������ 192 �������������������������.����������� EAO ������������������������������������, �����������������������������������������������������. MinimizeTeraspaceFalseEAOsLICOPT ������������������������� ������������������������������������������������ ������������������������������������ �������������� ������������������������������� ��������� ����� EAO ����������� ��������������������������� LICOPT ��� ��������������� ��������������������������������������������������� Teraspace ������������� ����������� 16 MB ��������������� ��������������������������������.

186 IBM i: ������ ILE

Page 195: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

[No]OrderedPtrComp

�������������������������������������������������������� Unsign ����������������������� (�������, ��������, �����������). ���������������������, ������������������������������������ �������������������������������. ��������������������������������.

[No]PredictBranchesInAbsenceOfProfiling

������������������������������������, �������������������������� Static Branch Prediction�������������� Optimize �������. �����������������������������������, ����������������������������������������������� Branch ����� ��������������������. ��������������������������������.

[No]PtrDisjoint

�������������������������� alias ������������������������ aggressive ���� �����optimizing translator ������������������������ ����������������������������������������������������������������������������������� ������������������������������������������������ ���������������. ���������������� C ��������������������� �������������������������:

void* spp;... = ((long long*) &spp) [1]; // Access low order 8 bytes of 16-byte pointer

Default: NoPtrDisjoint

[No]ReassocForIndexedLdSt

����������������� optimizing translator ������������������������������ ������������������������������������� ������������������������� �������������������������������������������������� �������������������� �������������������������� ���� displacement �������������� ����������������������������������������������� ������ displacement ��������� ��������� ����������������������������������� ������������� displacement ������������������ ��� displacement �����������������������������

������������� Licensed Internal Code ������ ReassocForIndexedLdSt

[No]TailCallOptimizations

���������� optimization ������� 40 ������������������� optimizing translator �� tail calloptimizations ����������� ����� stack frames ������������ runtime call stack ������������������ (���������) ������� stack frames �������� ���� ��������������������������������(����������������������) �� ������������ Runtime Stack Overflow ���������������� ����������������������� ��������������������� �� call stack ������������ ������������������������������ LICOPT ���������

tail call��������������������������������������������� ��������������� ��������������optimizing translator ���������� tail call optimizations ����������������������� caller����������� stack frame �������� stack ���������������������������� ����������� stackframe �������� ��� caller �������������� callee ������������������������������� ���optimization ��������������� tail call �������������� branch operation ������� ������������������������������� ������������������������ ���������������������� ����������������

����� 15. ��������������������������������� 187

Page 196: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������������� caller ��� optimization ������ stack frame ���������������caller ��� callee ��������������������� caller ��� caller

������������ ����������� A ������������� B ����������� B ���������� tail call ������������� C���������� tail call optimizations �������� B ������������� stack frame �������������������������� C ������������� C ������������ ��������������������������������� A ������������������������������� B ���������� tail call optimizations �������� C ��������������������� B ����������������������������� A ������������

������������������������������������ tail call optimizations ����������������������������������������������� ���������������������������� stack frame ������������ ���������� LICOPT ������������ NoTailCallOptimizations����������������������������������

������������� LICOPT ������ TailCallOptimizations.

TargetProcessorModel=<option>

�������� TargetProcessorModel������������ ������������������������������������������������������� ���������������������������������������������������� �������������������������������������������������������� ����� ���������������������� TargetProcessorModel ,���������������������������� ���������������������������������������������

����������������������� ��� TargetProcessorModel ����������������������

IBM i 7.3 ��� IBM i 7.2 6 POWER8

IBM i 7.1 5 POWER7

IBM i 6.1 4 POWER6

V5R4 ����������� 3 POWER5

TargetProcessorModelLICOPT ��������������������������������������������������������������������������� ���������������������������� ��������������-������������������������� ���������� �����������������������������

v ���������������������� ��������������� ������������ TargetProcessorModelLICOPT����������������������������������������������������������������������� ���������������������� ����������������������� CodeGenTargetLICOPT ��������������

v ����������������� ��������������� ��� TargetProcessorModelLICOPT ������������������������� CodeGenTargetLICOPT ���� POWER6, POWER7 ���� POWER8, ����������������������������������������������������������������������� ����������������������

v ��������������������������������� ������������� TargetProcessorModelLICOPT������������ CodeGenTargetLICOPT ���� Current ��������������������������������������������������������������������������������������������������������������������������

v ������������������ ��������������� ��� TargetProcessorModelLICOPT ������������������������� CodeGenTargetLICOPT ���� Common ��������������������������������������������������������������������������������� �������������������������

188 IBM i: ������ ILE

|

|

|

|

||||

|||

|||

|||

||||

|

|

|

|

|

|

Page 197: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

POWER8 ������ IBM i 7.3 and IBM i 7.2, POWER7 ������ IBM i 7.1, POWER6������ IBM i 6.1 ������ POWER5 ��������������������������������

v ��������������������������������� ��� TargetProcessorModel LICOPT ������������������������� CodeGenTargetLICOPT ���� be Legacy ���������������������������������������������������������� POWER5

v �������������������������� ������������������������������������������������������������������� ������������������������������������ �������������������� TargetProcessorModel��� CodeGenTargetLICOPTs ��������������� ����������������� �����������������������������

����������� ���������������������������� ��������������������������� ������ �������������������������� ’no’ ������ �������������������������������������������������������������.������������ Boolean ������������� 2 ���������, ������������������������������ ’���’ ����’����’. ���������������������� ����������������������� ’���’��������������������������������’����’ �������. ������������������������������������������������������������������.

������������

������������� Licensed Internal Code options (LICOPTs) ����� ������������� �������������������������������������������� ������ Change Module (CHGMOD), Change Program(CHGPGM) ��� Change Service Program (CHGSRVPGM) ��������������������������������������� LICOPT ������� ��������� LICOPTs �������������������� �������� LICOPTs ����������������������������������������� ������������������������������ LICOPTs ���������� ��� �������������������� LICOPTs ���������

������������������ Licensed Internal Code Options ���������������� ���:

> CHGMOD MODULE(TEST) LICOPT(’maf’)

���������������� CHGPGM ���� CHGSRVPGM ���������� Licensed Internal Code �������������������������������������� ILE. ������������������ Licensed Internal Code �������������ILE ���:

> CHGPGM PGM(TEST) LICOPT(’nomaf’)

�������������������������������� Licensed Internal Code ���������������������:

> CHGSRVPGM SRVPGM(TEST) LICOPT(’maf’)

���������� LICOPT ������������������������� ���������������� *ADD �� ����������� LICOPT ���������������� LICOPTs ���������������������� ��������������� ������� LICOPT (’maf’, *ADD)

��������

������������������������������������������������������������������� LicensedInternal Code.

v ������������������������������ Licensed Internal Code ���������� OPM ���.

����� 15. ��������������������������������� 189

|

|

Page 198: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ���������������� ILE ����������������������������������������������.�����������.�����V4R5M0 ������������.

v ���������������������� Licensed Internal Code ������������������������������ V4R5 ���������������������������������������������� V4R5 ���������������. ������������������������������ ��������������������� LICOPTs ���.

��������

�������� CHGMOD, CHGPGM, ��� CHGSRVPGM ��������������������������������������� LICOPT ������������������. ����������������������, ���������������� 2 ���������������������������:

> CHGMOD MODULE(TEST) LICOPT(’nomaf’)> CHGMOD MODULE(TEST) LICOPT(’NoMaf’)

���������������������� Licensed Internal Code ������� �������������������������������������������� (,). ���������������������������������������������������������. �������������������:

> CHGMOD MODULE(TEST) LICOPT(’Maf,NoFoldFloat’)> CHGMOD MODULE(TEST) LICOPT(’Maf, NoFoldFloat’)> CHGMOD MODULE(TEST) LICOPT(’ Maf , NoFoldFloat ’)

���������������� Boolean, ����������������������������������������������� 2 �����������������. �����������, ������������������������������:

> CHGMOD MODULE(TEST) LICOPT(’Maf,NoMaf’) <- NOT ALLOWED!

������������, ��������������������������������������������. ������������, ���������������������:

> CHGMOD MODULE(TEST) LICOPT(’Maf, NoFoldFloat, Maf’)

����������������������

������������������������������, ������� �������������������������������� Licensed InternalCode ����������� �������� V4R5M0 ������������, ��������������������������������������������������������� ���������������� save ����������������������������.

���������� IBM i ������������ Licensed Internal Code ��������������� (����������������������������� PTF) ����������������������������������������������������������������������������. ������������������, ������� ����������������������������������� �����������������������������������. ����������� �������������������� Licensed Internal Code ������������������������������������� ��� ����������� LICOPT ��������������������������� ��� LICOPT ������������������������� ���������������������������������� LICOPT(*SAME) �� ������ CHGMOD,CHGPGM ���� CHGSRVPGM �������������������������������������� �������� ��������������

190 IBM i: ������ ILE

Page 199: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������������������������� ��������������� ���� ��������� ����������������������������������������������� LICOPT �������� CHGMOD, CHGPGM ���� CHGSRVPGM ���������

�������������� Licensed Internal Code ������������������ ILE

������ DSPMOD, DSPPGM, ��� DSPSRVPGM ���������������� Licensed Internal Code ������������. DSPMOD ����������������������������� Module Informational section. ���������������:

������� Licensed Internal Codes. . . . . . . . . . . : maf

������ DSPPGM ��� DSPSRVPGM ����������� Licensed Internal Code ������������������������������������������������ Module Attribute �������������

���������� Licensed Internal Code ������������������� 1 ����� ����������������������������������������������������������� (+) ������������������. ����������������������������������Licensed Internal Code ��������������������� ������:

> CHGMOD MODULE(TEST) LICOPT(’maf, maf, Maf’)

������� DSPMOD ��������������:

������� Licensed Internal Codes. . . . . . . . . . . : +maf,+maf,Maf

����������� ’+’ ����������������������������������������������������������������

���������������� ’*’ ������������� Licensed Internal Code Options �������������������������������������������� ILE ��������. ����������������������������������������������������������������������������. ������������������������� ������������� “����������������������”������ 190. ������������, ��������������������������������������������� N+1 ���������������������:

> CHGMOD MODULE(TEST) LICOPT(’NewOption’)

��������������������������������������������������������������� ����������������������������������������������������:

> CHGMOD MODULE(TEST) FRCCRT(*YES) LICOPT(*SAME)

������� Licensed Internal Code ��������� DSPMOD ����������:

������� Licensed Internal Codes. . . . . . . . . . . : *NewOption

����������� ’*’ ������������������������������������������������

����� 15. ��������������������������������� 191

Page 200: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Adaptive Code Generation

������������� ����������������������������������� ���������������������������������������������������������� ������������� ���������� ���������������������������������������������������������������������� ��������������������������������������������������� ���������������������������������������������������� ����������������������������������������������������������� ������������� ���������� abstract machine interface (MI) ������������������������������������������������

optimizing translator �������������������� ������������ MI ��������� optimizing translator ������������������������������� ������������ optimizing translator ������������������������������������������ ������������ ��������������������������������������������������� ��������������������������������������������������� ��������

��������������� 6.1 optimizing translator ���������������������� ����������������������������������������������������������� �������������������� �������������������� ���������������������������������������������������������������������� �������������������� ������������������� ������������������������������������������������������ ���������������� ������������ ����������������������������������� ����������������������������������� ��������������� ��������������������������������������� �������� ������������������ ������������������������������������������������������������������������� �������������

�� 6.1 ��������������������������������������������� ����������������������� ���������������������������������� ������������� ��������������������������������������������������������� ����������������������� ��������������������������������� ���������������������������� ���������� ��������������������������������������������������������������� ������������������������������������������������������ adaptive code generation ������� adaptive code generation(ACG) ���������������������������������������� ����������������������� ����������������������������������������������������� ��������� ���� ���������������������������adaptive code generation ��� ��������������������������

������������ ACG

������������������������� adaptive code generation (ACG) �������� �����������������������������������

������������������ �������������������������� �������������������������������������������� IBM i ������������ ����������������������� �������������������������������������������������������� 6.1 ��� floating-point unit �������������������������������� ACG ���������������������������� unit ����� ����������������������� ���������������������������unit ��������������� ����������������������� ������������������������������������ ���������������������� ��������������������������

192 IBM i: ������ ILE

Page 201: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������� ��������������������� �������������������������� ����������������������������� ����������������������������������� POWER6 �������������� PowerPC AS

��������� ����������������������������������������������������������� ����������������������������� ��������������������������������������������������������������� ���������� ������������������������� ���������������������������������������������� ������������������������������������������

������������������� �������������� ���������������������������������������������������� ������������ ������������ optimizing translator

�������������������������������������������������������������������� ���� ��������������������������� ������� ��������

����������������

������������������������������������������ ���� Create C Module (CRTCMOD) optimizingtranslator �������������������������������������������� ������������������������������������������������������ ������������������������������������������������������������������ �������������� ������������������� optimizing translator ����������������������������������������� �����������������������������

������������������������������������������ ���� Create Program (CRTPGM) ���� CreateService Program (CRTSRVPGM) ������������������� ����������������������������������� ���������������������������������������������� ������������������������������������������’ ����������� ��������������� ������������������’

������������������������������������������������������ ������ �������������������������������������������������������������������� ��������������������� �������� ��������������������������������������� ������������������������������������ ��������������������������������������������� �������������������������������������������� �����������������������������������������������

����������������������������������������������� ��������������������������� ��������������������������� �������� ��������������������������������������� ������ �������������������������� ��������������������������������� ��������������������������� ����������������������������� ������������ ���������������������������������������� ����������������������� �������������������������������� ������������� optimizing translator ���������������������������������������������������� ������ ���������������������������������������������� ���������������� �������������������������������� ���������������������������������������� ���������������� ������������������������������������������������������

����� 15. ��������������������������������� 193

Page 202: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������

��������������������������������� adaptive code generation �������������������� ������������������������������������ ���������������������� Force Conversion on Restore(QFRCCVNRST) �������������������� Force Object Conversion (FRCOBJCVN) �����������FRCOBJCVN �������������� Restore (RST), Restore Object (RSTOBJ) ��� Restore Library(RSTLIB)

��������������� QFRCCVNRST

��������������� Force Conversion on Restore (QFRCCVNRST) �� ��������������������������

��� ��������

0 ���������������

1 ���������������������������������������������� (����������������)

2 ��������������������������������������������� ����������������� ��������������������� ������������������ �������������������������������

3 �����������������������������, ������������������������������������� ������������������������������ ����������������������������������� ��������������������� ���������

4 ������������������������������������������ ������� �����������������������������������������

5 ������������������������������������������������

6 ������������������������������������������ ���������

7 ��������������������������

������������ QFRCCVNRST ���� 2 ���� 3 ���������������������������������� ������������������ ���������������������������������������������������������� Restore (RST,RSTOBJ, RSTLIB) ������������������������������������ ���������� ����������������������������������������������� ���� �������������������������������������� �������������������������� optimization �������� ������������������������������ ���������������� ������������������������������������������

����������� FRCOBJCVN

����������� Force Object Conversion (FRCOBJCVN) �������� Restore (RST), Restore Object(RSTOBJ) ��� Restore Library (RSTLIB) �������������� ������ adaptive code generation �������������������� ����������������������������������� ��������� RSTOBJ ������������������

194 IBM i: ������ ILE

Page 203: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��� ��������

RSTOBJ FRCOBJCVN(*SYSVAL) ����������������������������������� Force Conversion onRestore (QFRCCVNRST) (������ ����������)

RSTOBJ FRCOBJCVN(*NO) ����������������������������������������

RSTOBJ FRCOBJCVN(*YES*RQD)

������������������������������������� �������������������������������������������������������������� �������������������������������������������������

RSTOBJ FRCOBJCVN(*YES*ALL)

������������������������ �������������������� ����������������������������������� ���������������������������������������������

��������������� RSTOBJ FRCOBJCVN(*YES *RQD) �������� �������������������� ������������������������������� ���������������� ����������������������������������������������������������� ������ ����������������������� ��������������������������������������QFRCCVNRST ���������������������������������������������������� �������������� ����������������������������

���������������

�������������������������������������� ������������������������������ ��������������������������������������������������������������������������� ������������ ���������������������������������������������������� ��� ���������������������������������������������������������� ������������������ �������� ���� ������������������������������������� 6.1 ������ ����������������������������������������������������� ����������’������ ���������������������������� ����������������������������������������������������������������������������������������� ��������������� ��������:

v ���������������������������������������������� (������������������ ���������������������������������)

v �������������������������������������������������������������� ������ ��������������������������������������� ������ ������������������������������������������

���������������������� ����������������������������������������� ������������������������������������������������������������� ����������� ����������������������������������������������:

v ����������� CodeGenTarget Licensed Internal Code (LICOPT) ����� ������������������������������������

v ���� CodeGenTarget LICOPT �������� Change Program (CHGPGM) ���� Change ServiceProgram (CHGSRVPGM)

v �����������������������������������������������������������

����� 15. ��������������������������������� 195

Page 204: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

CodeGenTarget LICOPT

������������������������������� Licensed Internal Code (LICOPT) ������������������������������������� ������ ���� Create C Module (CRTCMOD) ��� Create Bound C Program(CRTBNDC) ����������� LICOPT ��������� optimizing translator ������������������������������������� ������������������������������� ������������������� LICOPT CodeGenTarget ���������������������������������� adaptive code generation ����������� CodeGenTarget ����������������������������������

������������������� CodeGenTarget=Common ��������������� ����������������������������������������������������������������������� ��������� �������������� ����������������������������� �������������������������������������� ������������ ��������������������������������������������� ���������������������������������������

�������������������������������� ������������������� ����������������������������������������������������� ������������������������ ������������������ Change Program(CHGPGM) ���� Change Service Program (CHGSRVPGM) ������������������CodeGenTarget LICOPT ������������ ���������������� ��� optimizing translator ����������������������������������������

��������������������������������������� POWER6, POWER7 ��� POWER8 �������������� PowerPC AS ��� CodeGenTargetLICOPT ���������������������������� �������������������������������� adaptive code generation.

�������������������������� POWER8 (POWER8 ������������������������� POWER7��� POWER6) �������������������������������������:

v ���� CodeGenTarget=POWER8

v ����������������� POWER8 ������� CodeGenTarget=Current

�������������������������� POWER7 (POWER7 ������������������������� POWER6������������������ POWER8 ��� ) �������������������������������������:

v ���� CodeGenTarget=POWER7

v ����������������� POWER7 ������� CodeGenTarget=Current

v �������������� IBM i 7.3 ������� CodeGenTarget=Common

�������������������������� POWER6 ������������������������� POWER7 ���� POWER8�������������������������������������:

v ���� CodeGenTarget=POWER6

v ����������������� POWER6 ������� CodeGenTarget=Current

v �������������� IBM i 7.2 ������� CodeGenTarget=Common

���������������������������������� POWER6, POWER7 ��� POWER8 �����������������������:

196 IBM i: ������ ILE

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

Page 205: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ���� CodeGenTarget=Legacy

v �������������� IBM i 6.1 ���� IBM i 7.1 ������� CodeGenTarget=Common

�������������������������������� POWER6 ������:

v floating-point unit ��������������������������������

v ����������������������������������������������������������� ILE

�������������������������������� POWER7 ������:

v ������������������������������������������������������������� ���� �������������������������������� floating-point

��������������������������������� POWER8 ������:

v ���������������������������������������������������������

��������������������� ������������ Display Module (DSPMOD) ��������� DETAIL(*BASIC)�������������� LICOPT ������������������ ���������������������������������������������������� LICOPT ��������������� ������������������� ��������� Display Program (DSPPGM)���� Display Service Program (DSPSRVPGM) ��������� DETAIL(*MODULE) ��������������� 5 �������������������������� ������������� Licensed Internal Code �������������������������������������� CodeGenTarget=model ��������� ����� ��������������� LICOPT�������������������������������������� ���������������������� ����������� LICOPT ����������� ��������������������������������QIBM_BN_CREATE_WITH_COMMON_CODEGEN ��� ����� LICOPT �������� �������������������������������������

������������������������������������������������ Licensed Internal Code ����� “��������������Licensed Internal Code ������������������ ILE” ������ 191

������������������ QIBM_BN_CREATE_WITH_COMMON_CODEGEN

������������������� ������������������������ CodeGenTarget LICOPT ������������������������������������������ ��������� ������������������������������������������������������������ LICOPT ������������������ ������������������������������QIBM_BN_CREATE_WITH_COMMON_CODEGEN ����� ������������������������adaptive code generation �����������������

������������������������������� ������������ Work with Environment Variable(WRKENVVAR)

���������������������������������������QIBM_BN_CREATE_WITH_COMMON_CODEGEN �������������������

����� 15. ��������������������������������� 197

|

|

|

|

Page 206: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��� ��������

0 ���������������������� ������ LICOPT CodeGenTarget ���������� ������������� CodeGenTarget������ CodeGenTarget=Current (������ ����������)

1 ���������������������� ������ LICOPT CodeGenTarget ���������� ������������� CodeGenTarget������ CodeGenTarget=Common

2 ���������������������� ������ CodeGenTarget=Common ������������ LICOPT CodeGenTarget��� ��������������

v ��� 0 ����������������������������

v ��� 1 ���������������������������������������������������������� �������� �����������������������������������������������

v ��� 2 ������������������������������������������������������� ��������������������������

��������: ���������������������������������������� �������������� �������������������������������� ���� Change Program (CHGPGM) �����������������������������������

������������� ACG

������������������ Display Module (DSPMOD), Display Program (DSPPGM) ��� DisplayService Program (DSPSRVPGM) ������������������ ������������������������������������������������������������� ��� CodeGenTarget LICOPT ������������������������������������ ACG �������

���������������������������

��������� Display Program (DSPPGM), Display Service Program (DSPSRVPGM) ���� DisplayModule (DSPMOD) ��������� DETAIL(*BASIC) ������������� ��������������������������������������������������������������������������� ������� ����������� Conversion���������� *YES ���� *NO ��������� Conversion ������������ *YES ��������������������������������������������������� ���������� ������������� CHGPGM FRCCRT(*YES) ����Start Object Conversion (STROBJCVN) ��������������������� �������������������������� ��“��� Optimize ��������������������” ������ 199 ��������������������� �������������������������������������������

�������������� Conversion required ��� *YES ������ ��������������� ����������������������������������������������� (�� *FORMAT ���������������) ��������������������������������������������������������� ����������������������������������������������������������������� ��������������������������������������������������������� ������������������������� �������������� Conversion required ��� *NO ���������������������������������������������������������������

����������������������������������������������������������� �������������� Conversiondetails ����������������������� �����������

198 IBM i: ������ ILE

Page 207: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��� ��������

*FORMAT ����������������������������������������� ��������������������������������� (��������������������������������������������� ����������� 6.1 ����������������������������������������������������� 6.1) �������������������������������������������������������������������

*FEATURE ����������������������������������������� �������������������������������������������������� ���������������� ��������������������������������������������������������������������

*COMPAT �������������������������������������� ������ ��������������������������������������������������������������� ������������������������������������������ ������������ ���������� �������������������������������������������������������������������������������� ����������������������, ����� ������������������ �������������������������������

*COMMON �������������������������������������� ������������������� ���������� �������������������������������������������������������������������������� ����������������������, ����������������������� ��� ����������������������������

������������������������������

����������������� adaptive code generation ����������� ����������������, ����� ������������������������������������������ �������������������������� ACG ����������������� ������������ 6.1 ������������������� ��� CodeGenTarget LICOPT ����������������������������������������� �������� LICOPT ������������� ����������������������������� ����������������

����������������, ����� ������������������ �������� ����������� LICOPT(’CodeGenTarget=Common’) ����� LICOPT ������ ����� ������������� optimizing translator������������������ ������������������������������������������������ �������������� ������������������������������������������������� ������� ��������������� build machine ���������������������������������� ���������������������������������������������������������� ����������������������������������������������� �������� 6.1

��������: ��������������� optimizing translator ��������� ������������ ��������������������������������������������������������� ������������������������

��� Optimize ��������������������

��������������������������������������������������� ������������������� ���� ���������������������������������� FRCOBJCVN(*YES *ALL) �������� Restore ������������������������������������� ������������������������������������������� ����������������������� ������������optimizing translator ������������������������ ����������������������������������������������������������������������������

����� 15. ��������������������������������� 199

Page 208: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������������������������������������������� �������������������������������������� ��������� Display Module (DSPMOD), Display Program (DSPPGM) ����Display Service Program (DSPSRVPGM) ��������� DETAIL(*BASIC) ������� ����������

v ������������������������������������������ ����� All creation data ��� *YES ������������������ Change Module (CHGMOD), Change Program (CHGPGM) ��� Change ServiceProgram (CHGSRVPGM) ��������� FRCCRT(*YES) ����������� ����������������������

v ����������������������� ����������������������������� ����� All creation data ��� *UNOBS���������������������� �������������������������������������� ����������������������FRCOBJCNV(*YES *ALL) �������� Restore

v ����������������������������� �������������������������� ��������� *NO ���������������������������������������������������� ������������������������������������������������������������������������������ ���������������� 6.1 ������������������

ACG �������������������

���������������������������������������������� ��������� ���������������� ������������������������������������������� ��������������������������� ������������������ adaptive codegeneration ���������������������������������������������������������������� ��������������������������������������������������������� ����������������������������������������������������������� ������������������� ��������������������������������������������

200 IBM i: ������ ILE

Page 209: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 16. �����������������������������������

Shared storage ������������������������������������������������ thread ���������������������� 2���������. ��������������������������� ����������������������������������������� ������������������������������������������������������������������������������������������������������������������������������.

������������������������������ ILE ��������������� ���������������������������������������������������������� ����������������������� ILE ������������� MI ����. ���������������������� Application Programming Interface �������������������� ILE ��������������������.

���������������������

����� ��������������������� ��������������� �������������������� ���������������� Thread ������� 2���������. ������������������������������������� ������������������������������������������������������������� ����������������������������������������������������:

v MI space objects

v Primary associated spaces of other MI objects

v POSIX shared memory segments

v Implicit process spaces: ������ ���������������������������, ��������������������������� Heap ��� activation-base

v Teraspace

����������������������������������������������������������������� ���������������������������������������������������� Thread ����� ����������������������������������������.

�����������������������������

������������������������������������������������������������ ������������������������������� 2 �������������������������������������������������������������� �������: RaceCondition��� Storage Access Ordering Problem.

v Race Cnditions ������������������������������������������������� ������������������������������ Thread ���������������������� 2 ���������.

��������������� Race Condition ������������������������������ Thread ���������� �������� Thread �����������������������������������������������������. ������������������������������� Storage Synchronization �����������������������������Thread ���������������������������������������������������. �������������������, ������������� ����������������������������������������������������������

© ������������ IBM Corp. 1997, 2016 201

Page 210: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ��������������� Storage Access Ordering �������������������������������������������������������������� �����������������������������. ������ Thread ���������������������� 2����������������������������������������������������������������������������������������������������������������� ��������������������������. ������������ ��������������������:Thread 1 ���������������������������������� 2 ������ ��� Thread ������������������������������������������������������������.

������������������������������ Shared Storage Access Ordering ���������������������������� Storage Synchronization ��������� Thread ��������������������������������������������. ��������������������������������������������������������������.

��������������������������������������

����� Thread ���������������������� ������������������������������������������������� �������������� Thread ������������������������������������������� Thread ������� . ��������������������������������������������������������� Storage Synchronization �����������Thread ���������������������������������������.

������������������������������������������ Storage Synchronization: Thread ������� 2 ��������������������������� shared storage ������ ��� ������������������������ Thread �����������������������������������������������������. ������������������������������������������������������������ Storage Synchronization ������������������������. Thread �������������������������������������������������������� (��������������������������������������) ��������. ������������� thread �������������������������������������������������������������������������������������������������������.

���������������������������������������� Race Conditions �������������� Storage Access Ordering��������������������������������������.

volatile int X = 0;volatile int Y = 0;

Thread A Thread B-------------- -------------

Y = 1; print(X);X = 1; print(Y);

�������������������������������������������������������������� B.

X Y ������������ ��������

0 0 Race Condition Thread B �������������������������������Thread A.

0 1 Race Condition Thread B ����������� ��� Y ����������� X ����������������������� Thread A.

1 1 Race Condition Thread B read both variables after the updates ofThread A.

202 IBM i: ������ ILE

Page 211: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

X Y ������������ ��������

1 0 Storage Access Ordering Thread B ��������� X ���������������� Thread A��������� Y ������������������� datasynchronization �������������������������������������������������������������.

���������������������� 1: �������� 1 ��� ��������������

������������������������������������������������������� ��������������������������������������������������������������������� multi-threaded. ����������������������������� thread ��������������������������������� thread ������������������������������������������.

������� �������������������������������������������� synchronization �����������������.�������������������������������������������������������������� (����������������������) ������������������������������� 2 ������������������������ (����������������). ) ������������ ��������� thread ���������������������������������������������� (DATA). ��������� thread �������������� shared flag (FLAG) �������������� thread �������������������������������������������������������.

Initializing Thread All Other Threads------------------- ---------------------------

DATA = 10 loop until FLAG has value 1FLAG = 1 use DATA

��������� thread ���������������������������������������������������������������������������������. ������������ thread ����� �������������������������������� thread ����������������������������������������. ���������������������� thread ����� ��������������������������������������� DATA.

���������������������� 1

��������������������������������������������� ������������������������������������� data ���flag ������������������������������������ thread synchronization ������������������. ����������������� Thread Synchronization ������������� ��������������������� ��������������semaphore

����������������������������� ����������������:

v ������������ semaphore ����������� thread ���������������.

v ������� initialize semaphore ��� count ������� 1.

Initializing Thread All Other Threads------------------- ---------------------------

DATA = 10 Wait for semaphore count to reach 0Decrement semaphore use DATA

����� 16. ����������������������������������� 203

Page 212: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Storage Synchronizing Actions

���������������������������������������������������������������� ���������������������:Thread ����������������������������������������������� ���������������������������������������������������. ����������������������� Storage Synchronizing Actions.

Synchronizing action ����������� thread ������������������������������������������������������� ���������������������� synchronizing action �� logical flow ��� thread ���������������������������������������������� logical flow ����������� synchronizing action. ���������������thread ���� ������������ synchronizing action ��� thread ���������. ��������������� ��� thread���������� 2 �������������������������������� 2 ������� ��� synchronizing action ����������������������������� �����������������: ���������������������������������������� thread ���������������������������������� synchronizing action ���������� ������������������������������������.

������������ 2 ������������������������������ 2 ������� ���������������� storagesynchronizing action ��������������� 2 ����������������������������������������������. ������������������������� thread ���������������������������������������������������������������������������.

Thread synchronization action ���������������������������������� storage action:

Mechanism Synchronizing Action First Available in VRM

Object Locks ����, ������� All

Space Location Locks ����, ������� All

Mutex ����, ������� V3R1M0

Semaphores �����, �� V3R2M0

Pthread Conditions ��, Signal, Broadcast V4R2M0

Data Queues ��������, ������������ All

Message Queues ��������, ������������ V3R2M0

Compare-and-Swap �������������������������������� V3R1M0

Check Lock Value(CHKLKVAL)

�������������������������������� V5R3M0

Clear Lock Value (CLRLKVAL) Always V5R3M0

��������� ������������������� synchronization ��� thread ������������� synchronization ���storage action:

204 IBM i: ������ ILE

Page 213: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Mechanism Synchronizing Action First Available in VRM

SYNCSTG MI Instruction Always V4R5M0

��������: ��������������������������������������������������� shared storage ������� thread������� 2 ������������������� ��������� thread �������������������������������������������synchronizing action ����������. ����������������������������������������������������. ������������������������������������������������������������������������������������������optimization ��� ����������������������������������������.

���������������������� 2 : ������������������� 2 ���

���������������������������� synchronization ��������� ������������� thread ������� 2 �������������������������������� informal locking protocol. ���������������������� ��������������� thread 2���������������������� shared storage thread. ��������������������������������������������������� 2 �������������������� ������ flag ���������������������������� thread ����������������������������.

Thread A Thread B-------------------------------------- --------------------------------------/* Do some work on the shared data */ /* Do some work on the shared data */for (int i=0; i<10; ++i) { for (int i=0; i<10; ++i) {

/* Wait until the locked flag is clear */ /* Wait until the locked flag is clear */while (locked == 1) { while (locked == 1) {sleep(1); sleep(1);

} }

locked = 1; /* Set the lock */ locked = 1; /* Set the lock */

/* Update the shared data */ /* Update the shared data */data1 += 5; data1 += 4;data2 += 10; data2 += 6;

locked = 0; /* Clear the lock */ locked = 0; /* Clear the lock */} }

������������������ shared memory pitfall �������

Race ConditionsLocking protocol ���������������������������������� data race condition ���. ������� 2 ������������ locked �����������������������������������������������������. � ���������, ���������������������������������������������, ������������, ����������� — �������������������������������������������.

����������������� Storage Access Ordering��������������������� race condition ����������������������. ���������������������������������������������� lock ��������������������������������������������������������������������������. ��������������������������������������� thread �����������thread ������������������� ������� locked flag �������������� 1 ��������������������

����� 16. ����������������������������������� 205

Page 214: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������. ��������������������� thread ������������������������������������������������������������������� locked flag ������� 0. �������������������������������������������������������������.

���������������������� 2

��������������� race condition ������������ storage ordering ������������������������������������������� ������������� synchronization ������������������������������ ������������� ����thread ��������������������������������������������� �����������������������������������������. ������������������������������������ space location lock ���������� ������������������������������������ Check Lock Value ��� Clear Lock Value

THREAD A THREAD B-------------------------------------- ------------------------------------for (i=0; i<10; ++i) { for (i=0; i<10; ++i) {/* Get an exclusive lock on the shared /* Get an exclusive lock on the shared

data. We go into a wait state until data. We go into a wait state untilthe lock is granted. */ the lock is granted. */

locksl( LOCK_LOC, _LENR_LOCK ); locksl( LOCK_LOC, _LENR_LOCK );

/* Update the shared data */ /* Update the shared data */data1 += 5; data1 += 4;data2 += 10; data2 += 6;

/* Unlock the shared data */ /* Unlock the shared data */unlocksl( LOCK_LOC, _LENR_LOCK ); unlocksl( LOCK_LOC, _LENR_LOCK );

} }

������������������������������������������� lock �������������� thread ����� 1 ���������������������������������������� 1 ����� ����������������������� race condition ���. ����������������������storage access ordering ������� �������������������������������������������������������shared storage 2 ���������������.

�������� �������������: ������ Check Lock Value / Clear Lock Value

Space location lock ����������������������������������������� ��������������������������������������������������������������. ������������ space location lock ����������� time-out ���������������� ����������� ����������������������� lock ������������������. Space locations locks���������������������������������� shared locks. ���������������������������������, ������������������������������������������������������������.

���������������������� Check Lock Value��� Clear Lock Value. �����������, ������� MI ���������������������� ���������������������� ������������������������������, �������� ��������contention ��������������.

����������������, ��������� CHKLKVAL �����������������������������������. ����������������������� (�������������������������������������), thread ��������������� �����������������������, ���������������������������������� ���. �����������������������������, ��������� CLRLKVAL ������������. �������������, ��������, ��������������������������,

206 IBM i: ������ ILE

Page 215: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

threads ���������������������������� 8-byte. ������������������������� ���������� LOCK�����, �������� ������� initialize ���������, ������������� initialize ��� static ���� ��� initialize����������� prior synchronized �����������������

THREAD A THREAD B-------------------------------- ---------------------------------/* Do some work on the shared data */ /* Do some work on the shared data */for (i=0; i<10; ++i) { for (i=0; i<10; ++i) {

/* Attempt to acquire the lock using /* Attempt to acquire the lock usingCHKLKVAL. By convention, use value CHKLKVAL. By convention, use value1 to indicate locked, 0 to indicate 1 to indicate locked, 0 to indicateunlocked. */ unlocked. */

while (_CHKLKVAL(&LOCK, 0, 1) == 1) { while (_CHKLKVAL(&LOCK, 0, 1) == 1) {sleep(1); /* wait a bit and try again */ sleep(1); /* wait a bit and try again */

} }

/* Update the shared data */ /* Update the shared data */data1 += 5; data1 += 4;data2 += 10; data2 += 6;

/* Unlock the shared data. Use of /* Unlock the shared data. Use ofCLRLKVAL ensures other jobs/threads CLRLKVAL ensures other jobs/threadssee update to shared data prior to see update to shared data prior torelease of the lock. */ release of the lock. */

_CLRLKVAL(&LOCK, 0); _CLRLKVAL(&LOCK, 0);} }

������, threads ��� Check Lock Value �������������������� race-free ��� ����������������,��� Clear Lock Value ���������������������� ������������������� ������������������� racecondition ������������������������������������������ ����������������������������� storage accessordering ������� �������������������, �����������������������, Check Lock Value ��� ClearLock Value ���� synchronizing actions ������ Check Lock Value ������������������������ ���������������������� ���������������� thread ���������������������� �������������� ������ Clear LockValue ������������������������������������������� ���������������� ��������������������subsequent ���������� thread ��� ���������� synchronizing action �����

����� 16. ����������������������������������� 207

Page 216: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

208 IBM i: ������ ILE

Page 217: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM,

���� UPDSRVPGM

���������������������������������������������������������������� ������������������������������������������� binder

Binder Listing

Binder listing ��������� Create Program (CRTPGM), Create Service Program (CRTSRVPGM),Update Program (UPDPGM), ��� Update Service Program (UPDSRVPGM) ��������������������������� . ��������������� binder listing ��������� CRTSRVPGM ������������������������������� FIANCIAL �������� “������������ Binder” ������ 100.

��������������������� listing ��� 3 ���� ��������������� detail (DETAIL) ���������CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM:

*BASIC

*EXTENDED

*FULL

Basic Listing

�������������� DETAIL (*BASIC) ���������� CRTPGM, CRTSRVPGM, UPDPGM, ����UPDSRVPGM listing ������������:

v ������������������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM

v ���������

v ������������������������������������������������������������

������ 46 ������ 210, ������ 47 ������ 210, and ������ 48 ������ 211 ���������������������.

© ������������ IBM Corp. 1997, 2016 209

Page 218: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Create Service Program Page 1

Service program . . . . . . . . . . . . . . . . . : FINANCIALLibrary . . . . . . . . . . . . . . . . . . . . : MYLIB

Export . . . . . . . . . . . . . . . . . . . . . . : *SRCFILEExport source file . . . . . . . . . . . . . . . . : QSRVSRCLibrary . . . . . . . . . . . . . . . . . . . . : MYLIB

Export source member . . . . . . . . . . . . . . . : *SRVPGMActivation group . . . . . . . . . . . . . . . . . : *CALLERAllow update . . . . . . . . . . . . . . . . . . : *YESAllow bound *SRVPGM library name update . . . . . : *NOCreation options . . . . . . . . . . . . . . . . . : *GEN *NODUPPROC *NODUPVAR *DUPWARNListing detail . . . . . . . . . . . . . . . . . . : *FULLUser profile . . . . . . . . . . . . . . . . . . . : *USERReplace existing service program . . . . . . . . . : *YESTarget release . . . . . . . . . . . . . . . . . . : *CURRENTAllow reinitialization . . . . . . . . . . . . . . : *NOStorage model . . . . . . . . . . . . . . . . . . : *SNGLVLArgument optimization . . . . . . . . . . . . . . : *NOInterprocedural analysis . . . . . . . . . . . . . : *NOIPA control file . . . . . . . . . . . . . . . . . : *NONEAuthority . . . . . . . . . . . . . . . . . . . . : *LIBCRTAUTText . . . . . . . . . . . . . . . . . . . . . . . :

Module Library Module LibraryMONEY MYLIB CALCS MYLIBRATES MYLIB ACCTS MYLIB

ServiceProgram Library Activation*NONE

BindingDirectory Library*NONE

������ 46. ����������������������� CRTSRVPGM

Create Service Program Page 3

Brief Summary Table

Program entry procedures . . . . . . . . . . . : 0

Multiple strong definitions . . . . . . . . . : 0

Unresolved references . . . . . . . . . . . . : 0

* * * * * E N D O F B R I E F S U M M A R Y T A B L E * * * * *

������ 47. ���� Brief Summary Table

210 IBM i: ������ ILE

Page 219: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Extended Listing

�������������� DETAIL (*EXTENDED) �������� CRTPGM, CRTSRVPGM, UPDPGM,���� UPDSRVPGM listing �������������������������������� DETAIL (*BASIC) ���������������������. extended ��������� extended �������������� import (reference) ������resolve ����������� export (definition) ������������. ������������ CRTSRVPGM ����UPDSRVPGM listing ������������ binder language ������, signature ���������������, ��� import(reference) ����������� export (definition). ������������������������������������ ���������������

Create Service Program Page 2

Extended Summary Table

Valid definitions . . . . . . . . . . : 418Strong . . . . . . . . . . . . . . . : 418Weak . . . . . . . . . . . . . . . . : 0

Resolved references . . . . . . . . . : 21To strong definitions . . . . . . . : 21To weak definitions . . . . . . . . : 0

* * * * * E N D O F E X T E N D E D S U M M A R Y T A B L E * * * * *

Create Service Program Page 4

Binder Information ListingModule . . . . . . . . . . . : MONEYLibrary . . . . . . . . . : MYLIBBound . . . . . . . . . . : *YES

Number Symbol Ref Identifier Type Scope Export Key

00000001 Def main Proc Module Strong00000002 Def Amount Proc SrvPgm Strong00000003 Def Payment Proc SrvPgm Strong00000004 Ref 0000017F Q LE AG_prod_rc Data

Create Service Program Page 23

Binding Statistics

Symbol collection CPU time . . . . . . . . . . . . . . . . . : .018Symbol resolution CPU time . . . . . . . . . . . . . . . . . : .006Binding directory resolution CPU time . . . . . . . . . . . : .403Binder language compilation CPU time . . . . . . . . . . . . : .040Listing creation CPU time . . . . . . . . . . . . . . . . . : 1.622Program/service program creation CPU time . . . . . . . . . : .178

Total CPU time . . . . . . . . . . . . . . . . . . . . . . . : 2.761Total elapsed time . . . . . . . . . . . . . . . . . . . . . : 11.522

* * * * * E N D O F B I N D I N G S T A T I S T I C S * * * * *

*CPC5D0B - Service program FINANCIAL created in library MYLIB.

* * * * * E N D O F C R E A T E S E R V I C E P R O G R A M L I S T I N G * * * * *

������ 48. ���� Binding Statistics

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 211

Page 220: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

00000005 Ref 0000017E Q LE AG_user_rc Data00000006 Ref 000000AC _C_main Proc00000007 Ref 00000180 Q LE leDefaultEh Proc00000008 Ref 00000181 Q LE mhConversionEh Proc00000009 Ref 00000125 _C_exception_router Proc

Module . . . . . . . . . . . : RATESLibrary . . . . . . . . . : MYLIBBound . . . . . . . . . . : *YES

Number Symbol Ref Identifier Type Scope Export Key

0000000A Def Term Proc SrvPgm Strong0000000B Def Rate Proc SrvPgm Strong0000000C Ref 0000017F Q LE AG_prod_rc Data0000000D Ref 0000017E Q LE AG_user_rc Data0000000E Ref 00000180 Q LE leDefaultEh Proc0000000F Ref 00000181 Q LE mhConversionEh Proc00000010 Ref 00000125 _C_exception_router Proc

Module . . . . . . . . . . . : CALCSLibrary . . . . . . . . . : MYLIBBound . . . . . . . . . . : *YES

Number Symbol Ref Identifier Type Scope Export Key

00000011 Def Calc1 Proc Module Strong00000012 Def Calc2 Proc Module Strong00000013 Ref 0000017F Q LE AG_prod_rc Data00000014 Ref 0000017E Q LE AG_user_rc Data00000015 Ref 00000180 Q LE leDefaultEh Proc00000016 Ref 00000181 Q LE mhConversionEh Proc00000017 Ref 00000125 _C_exception_router Proc

Module . . . . . . . . . . . : ACCTSLibrary . . . . . . . . . : MYLIBBound . . . . . . . . . . : *YES

Number Symbol Ref Identifier Type Scope Export Key

00000018 Def OpenAccount Proc SrvPgm Strong00000019 Def CloseAccount Proc SrvPgm Strong0000001A Ref 0000017F Q LE AG_prod_rc Data0000001B Ref 0000017E Q LE AG_user_rc Data0000001C Ref 00000180 Q LE leDefaultEh Proc0000001D Ref 00000181 Q LE mhConversionEh Proc0000001E Ref 00000125 _C_exception_router Proc

Service program . . . . . . : QC2SYSLibrary . . . . . . . . . : *LIBLBound . . . . . . . . . . : *NO

Number Symbol Ref Identifier Type Scope Export Key

0000001F Def system Proc Strong

Service program . . . . . . : QLEAWILibrary . . . . . . . . . : *LIBLBound . . . . . . . . . . : *YES

Number Symbol Ref Identifier Type Scope Export Key

0000017E Def Q LE AG_user_rc Data Strong0000017F Def Q LE AG_prod_rc Data Strong00000180 Def Q LE leDefaultEh Proc Strong00000181 Def Q LE mhConversionEh Proc Strong

Create Service Program Page 14

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(’Term’)EXPORT SYMBOL(’Rate’)EXPORT SYMBOL(’Amount’)EXPORT SYMBOL(’Payment’)

212 IBM i: ������ ILE

Page 221: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

EXPORT SYMBOL(’OpenAccount’)EXPORT SYMBOL(’CloseAccount’)

ENDPGMEXP******** Export signature: 00000000ADCEFEE088738A98DBA6E723.STRPGMEXP PGMLVL(*PRV)EXPORT SYMBOL(’Term’)EXPORT SYMBOL(’Rate’)EXPORT SYMBOL(’Amount’)EXPORT SYMBOL(’Payment’)

ENDPGMEXP******** Export signature: 000000000000000000ADC89D09E0C6E7.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

Full Listing

�������������� DETAIL (*FULL) �������� CRTPGM, CRTSRVPGM, UPDPGM, ����UPDSRVPGM listing �������������������������������� DETAIL (*EXTENDED) ������������ cross-reference listing. ��������������������� ������������������������������������������������������

Create Service Program Page 15

Cross-Reference Listing

--------Refs--------Identifier Defs Ref Ref Type Library Object. . . . .. . . . .. . . . .xlatewt 000000DD *SRVPGM *LIBL QC2UTIL1yn 00000140 *SRVPGM *LIBL QC2UTIL2y0 0000013E *SRVPGM *LIBL QC2UTIL2y1 0000013F *SRVPGM *LIBL QC2UTIL2Amount 00000002 *MODULE MYLIB MONEYCalc1 00000011 *MODULE MYLIB CALCSCalc2 00000012 *MODULE MYLIB CALCSCloseAccount 00000019 *MODULE MYLIB ACCTSCEECRHP 000001A0 *SRVPGM *LIBL QLEAWICEECZST 0000019F *SRVPGM *LIBL QLEAWICEEDATE 000001A9 *SRVPGM *LIBL QLEAWICEEDATM 000001B1 *SRVPGM *LIBL QLEAWICEEDAYS 000001A8 *SRVPGM *LIBL QLEAWICEEDCOD 00000187 *SRVPGM *LIBL QLEAWICEEDSHP 000001A1 *SRVPGM *LIBL QLEAWICEEDYWK 000001B3 *SRVPGM *LIBL QLEAWICEEFMDA 000001AD *SRVPGM *LIBL QLEAWICEEFMDT 000001AF *SRVPGM *LIBL QLEAWICEEFMTM 000001AE *SRVPGM *LIBL QLEAWICEEFRST 0000019E *SRVPGM *LIBL QLEAWICEEGMT 000001B6 *SRVPGM *LIBL QLEAWICEEGPID 00000195 *SRVPGM *LIBL QLEAWICEEGTST 0000019D *SRVPGM *LIBL QLEAWICEEISEC 000001B0 *SRVPGM *LIBL QLEAWICEELOCT 000001B4 *SRVPGM *LIBL QLEAWICEEMGET 00000183 *SRVPGM *LIBL QLEAWICEEMKHP 000001A2 *SRVPGM *LIBL QLEAWICEEMOUT 00000184 *SRVPGM *LIBL QLEAWICEEMRCR 00000182 *SRVPGM *LIBL QLEAWICEEMSG 00000185 *SRVPGM *LIBL QLEAWICEENCOD 00000186 *SRVPGM *LIBL QLEAWICEEQCEN 000001AC *SRVPGM *LIBL QLEAWICEERLHPCEESCEN 000001AB *SRVPGM *LIBL QLEAWICEESECI 000001B2 *SRVPGM *LIBL QLEAWICEESECS 000001AA *SRVPGM *LIBL QLEAWICEESGL 00000190 *SRVPGM *LIBL QLEAWICEETREC 00000191 *SRVPGM *LIBL QLEAWICEEUTC 000001B5 *SRVPGM *LIBL QLEAWICEEUTCO 000001B7 *SRVPGM *LIBL QLEAWI

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 213

Page 222: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

CEE4ABN 00000192 *SRVPGM *LIBL QLEAWICEE4CpyDvfb 0000019A *SRVPGM *LIBL QLEAWICEE4CpyIofb 00000199 *SRVPGM *LIBL QLEAWICEE4CpyOfb 00000198 *SRVPGM *LIBL QLEAWICEE4DAS 000001A4 *SRVPGM *LIBL QLEAWICEE4FCB 0000018A *SRVPGM *LIBL QLEAWICEE4HC 00000197 *SRVPGM *LIBL QLEAWICEE4RAGE 0000018B *SRVPGM *LIBL QLEAWICEE4RIN 00000196 *SRVPGM *LIBL QLEAWIOpenAccount 00000018 *MODULE MYLIB ACCTSPayment 00000003 *MODULE MYLIB MONEYQ LE leBdyCh 00000188 *SRVPGM *LIBL QLEAWIQ LE leBdyEpilog 00000189 *SRVPGM *LIBL QLEAWIQ LE leDefaultEh 00000180 00000007 0000000E *SRVPGM *LIBL QLEAWI

00000015 0000001CQ LE mhConversionEh 00000181 00000008 0000000F *SRVPGM *LIBL QLEAWI

00000016 0000001DQ LE AG_prod_rc 0000017F 00000004 0000000C *SRVPGM *LIBL QLEAWI

00000013 0000001AQ LE AG_user_rc 0000017E 00000005 0000000D *SRVPGM *LIBL QLEAWI

00000014 0000001BQ LE HdlrRouterEh 0000018F *SRVPGM *LIBL QLEAWIQ LE RtxRouterCh 0000018E *SRVPGM *LIBL QLEAWIRate 0000000B *MODULE MYLIB RATESTerm 0000000A *MODULE MYLIB RATES

IPA Listing Components

���������������������������������������� IPA ��������:

v Object File Map

v Compiler Options Map

v Inline Report

v Global Symbols Map

v Partition Map

v Source File Map

v Messages

v Message Summary

������ CRTPGM ���� CRTSRVPGM ����������������������������������������������������� ������� Inline Report ������������������������������������ IPA(*YES) ��� DETAIL(*BASIC ����*EXTENDED). ������ CRTPGM ���� CRTSRVPGM ����������� Inline Report ��������������������� IPA(*YES) ��� DETAIL(*FULL) ��������.

Object File Map

����������� Object File Map ������������������������������������������������������� IPA.���������������� ���� Source File Map ������������ FILE ID �������������������.

Compiler Options Map

�������� Compiler Options Map ����������������������������������������������� IL ���������������������������������������. ������������������������������������������������������������� IPA. �������������������������� ������������������������������ ������ �������� #pragma ��������������.

214 IBM i: ������ ILE

Page 223: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Inline Report

�������� Inline Report ��������������������������� IPA. ����������� ����� ’subprogram’ �������������������������������� C/C++ ��������������� C++. ���������������������:

v �������������������������������. IPA ��������������������������������������������.

v �������������������������������������:

– ������� #pragma ��� noinline ����������������.

– ������� #pragma ��� inline ����������������.

– IPA ���������������� inline �������������������������.

– ��������������������������� inline �������������.

– ������������������������.

– IPA �������������� inline ������������������������������������� IL ����.

v �������������������������������:

– IPA ����� inline ������������������������������.

– IPA �������� inline ������������������������������������������.

– IPA �������� inline �������������������������������������������������.

– �������������������������� inline ��� IPA �������� inline ���

– �������������������������� inline �������������������.

– ���������������������������� �������������������������������������������.

v ����������������������������� inline:

– IPA ������������������������������������������� ��������������������� staticinternal.

– IPA ��������������������������������������������:

- ������������������ external. (���������������������������������������������.)

- �������������������������.

- �������������������������������.

v ��������������� Relative �������������� (�� Abstract Code Units).

v �������������� Relative �������������� (�� Abstract Code Units) ������������Inline.

v ����������������������������� ������������������������������ IPA ����� Inline �������������������.

v ���������������������������������������������������� Compile Unit ����������������IPA ����� Inline �����������.

v ��������������� ������ Threshold ��� Limit ����������. ���������������������������������������� ������������������ ���������������������� @nnn@���� XXXX@nnn@, ���� XXXX �����������������, ��� nnn ��������������������.

�������������������������������������������������������������������� ����������:

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 215

Page 224: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ����������������������.

v ����������������������.

v ���������������������������� Inline.

������������������������������������������������������������� �������������������� Inline ������ Selective. ������������������������������������������������������������� IPA.

Global Symbols Map

�������� Global Symbols Map ������������������������������������������������������������������������������������� Global Variable Coalescing Optimization. �������������������������������� ����������� (�������������������������). ���������������������������������.

Partition Map

�������� Partition Map ������������������������������������������� IPA. ���������������������������:

v ����������������������������������������������.

v �������������������������������������.

v �����������������������������������������������.

v �������������������������������������.

Source File Map

�������� Source File Map ��������������������������������������.

Messages

��� IPA ���������������� ����������������������������� �������������������������������������������������� Messages. ����������������������������� �����������������������������IPA. �������������������������������������������������. �������� Messages ��������������������������������������������������. ��������������������, �������, ������������������������������ ��������, ������ (�����������), ���������� (�����������).

Message Summary

�������� Message Summary ���������������������������� ������������������������������������.

�����������������������������������

��������������� “Basic Listing” ������ 209, “Extended Listing” ������ 211, ��� “FullListing” ������ 213 ����������������������� ��������������������� DETAIL(*FULL) ���������������������������� FINANCIAL �� ������ 35 ������ 105 ������������������������������,binder information listing, ��� cross-reference listing

216 IBM i: ������ ILE

Page 225: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Binder Information Listing �����������������������������

Binder Information Listing ( “Extended Listing” ������ 211) ��������������������������������������� ������:

v �����������������������������������������������������.

�������� Bound����������� *YES ��������������������� ���������������������������������������������. ����������� Bound����������� *YES ��������������������� �����������������������������������������������. ����������� Bound����������� *NO ���������������������������������������� ����������������������������������. ������������������������������ export ��������� import ��������� resolve.

v Number

������������������������������������������������������������ ������ ID ��������������������� export (definition) ���� import (reference) ��������.

v Symbol

������������������������ symbol ������� export (Def) ���� import (Ref).

v Ref

������������������������������ ID �������� export (Def) ����������������������import. �������������� “Extended Listing” ������ 211 ID �������� import 00000005������������ ID �������� export 0000017E.

v Identifier

����������� symbol ������ export ���� import. ������� symbol import ������ ID �����00000005 ��� Q LE AG_user_rc. ���������� symbol export ������ ID ����� 0000017E����� Q LE AG_user_rc �������.

v Type

���������� symbol �������������� ����������������������� Proc. ������������� symbol ������������� ����������������������� Data.

v Scope

����������� ������������������������ symbol ������ export ��������������������������������� public interface ������������������. ���������������������� ������� symbol ������export ������������������������������������. ��������������������������������� ������� symbol������ export ��������������������������������������������������� (SrvPgm). ������ symbol������ export ���������������� public interface ������������ Scope���������� SrvPgm.

v Export

������������������������������������������������ export ���������������������������.

v Key

�������������������������������������� weak export ������. �������������������������������.

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 217

Page 226: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Cross-Reference Listing �����������������������������.

Cross-reference listing ��� “Full Listing” ������ 213 ��������������������������������������binder information. cross-reference listing ������������������������������ ������:

v Identifier

����������� export ��������������������� symbol resolution.

v Defs

���� ID �������� export ��������.

v Refs

���������������������������� ID ����������� import(Ref) ������ resolve ������ export (Def).

v Type

�������������� export ��������������� *MODULE ���� *SRVPGM.

v Library

���������������������������������������������� binding directory.

v Object

��������������������������� export (Def).

Binding Statistics �����������������������������.

������ 48 ������ 211 �������������������� ������������������������� FINANCIAL. ������������� ���������������������������������������������������������������. ���������������������������������������������������������. �����������������������������������������������. ������������������������ Total CPU time��������������������������������������������������.

������������� Binder Language

����������������������� binder language ��������������������������������������������������������. ������������� DETAIL(*EXTENDED) ���� DETAIL(*FULL) �������� CreateService Program ��������������������������������������� spool file.

���������������������� (information message) �����������������:

v Signature padded

v Signature truncated

���������������������������������� (warning error) �������������� �����������:

v Current export block limits interface

v Duplicate export block

v Duplicate symbol on previous export

v Level checking cannot be disabled more than once, ignored

v Multiple current export blocks not allowed, previous assumed

218 IBM i: ������ ILE

Page 227: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������������������� (serious error) �������������� �����������:

v Current export block is empty

v Export block not completed, end-of-file found before ENDPGMEXP

v Export block not started, STRPGMEXP required

v Export blocks cannot be nested, ENDPGMEXP missing

v Exports must exist inside export blocks

v Identical signatures for dissimilar export blocks, must change exports

v Multiple wildcard matches

v No current export block

v No wildcard match

v Previous export block is empty

v Signature contains variant characters

v SIGNATURE(*GEN) required with LVLCHK(*NO)

v Signature syntax not valid

v Symbol name required

v Symbol not allowed as service program export

v Symbol not defined

v Syntax not valid

Signature Padded

������ 49������� binder language listing ������������������.

�����������������������.

������������������

���������������������������������.

��������������������������������������� �������������� signature ��������������� 16 ����.

Binder Language Listing

STRPGMEXP SIGNATURE(’Short signature’)******** Signature padded

EXPORT SYMBOL(’Proc_2’)ENDPGMEXP

******** Export signature: E2889699A340A289879581A3A4998540.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 49. ���� Signature Padded ��������� signature ����������������������� 16 ����.

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 219

Page 228: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Signature Truncated

������ 50������� binder language listing ������������������.

�����������������������.

������������������

���������������������������������.

��������������������������������������� �������������� signature ��������������� 16 ����.

Current Export Block Limits Interface

������ 51������� binder language listing ������������������.

������ ����������������������������������.

PGML (*PRV) export block ����������������������� PGMLVL(*CURRENT) export block.

Binder Language Listing

STRPGMEXP SIGNATURE(’This signature is very long’)******** Signature truncated

EXPORT SYMBOL(’Proc_2’)ENDPGMEXP

******** Export signature: E38889A240A289879581A3A499854089.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 50. ���� Signature Truncated ��������� Signature ������������� 16 ����.

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(A)EXPORT SYMBOL(B)

ENDPGMEXP******** Export signature: 00000000000000000000000000000CD2.STRPGMEXP PGMLVL(*PRV)

EXPORT SYMBOL(A)EXPORT SYMBOL(B)EXPORT SYMBOL(C)

ENDPGMEXP******** Export signature: 0000000000000000000000000000CDE3.******** Current export block limits interface.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 51. ���� PGMLVL(*PRV) Exporte Symbol ������� PGMLVL(*CURRENT)

220 IBM i: ������ ILE

Page 229: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����������������������� �������� �����������������������������

����������������������������:

v PGMLVL(*PRV) ��������������������� C.

v ���������� C ���������������������� �������������������������.

�������������������������� ILE ������������������ C �������������������� ����������������������.

������������������

1. �������� PGMLVL(*CURRENT) export block �� symbol ������ export ������� PGMLVL(*PRV) export block.

2. ��������� CRTSRVPGM ��������

������������� EXPORT SYMBOL(C) �������������� STRPGMEXP PGMLVL(*PRV) exportblock ���������������������� PGMLVL(*CURRENT) block ��������������.

Duplicate Export Block

������ 52������� binder language listing ������������������.

������ ����������������������������������.

�� block ��� STRPGMEXP ��� ENDPGMEXP ������� 1 block �������� export symbol ������������������������������.

����������������������� ������������������������������������� signature �������������������������������������������������.

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(A)EXPORT SYMBOL(B)

ENDPGMEXP******** Export signature: 00000000000000000000000000000CD2.STRPGMEXP PGMLVL(*PRV)

EXPORT SYMBOL(A)EXPORT SYMBOL(B)

ENDPGMEXP******** Export signature: 00000000000000000000000000000CD2.******** Duplicate export block.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 52. ���� STRPGMEXP/ENDPGMEXP Block ������������

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 221

Page 230: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������

1. �������������������������� ������:

v �������� PGMLVL(*CURRENT) export block ������������. ������������������������������.

v �� export block ��������������.

2. ��������� CRTSRVPGM ��������

������������� ������ STRPGMEXP ����������� PGMLVL(*CURRENT) ������������������������������������� EXPORT SYMBOL(B) ������:

EXPORT SYMBOL(C)

Duplicate Symbol on Previous Export

������ 53������� binder language listing ������������������������������ symbol ������.

������ ����������������������������������.

������������� symbol ����������� export ������������������������� 1 ������� STRPGMEXP��� ENDPGMEXP block.

����������������������� ������������������������������������� ������ symbol ��������� ������������������������������� export. ��� symbol ������������������������������� signature ���������������.

������������������

1. ���������������������������� binder language ������������ 1 ������.

2. ��������� CRTSRVPGM ��������

������������� ��������� EXPORT SYMBOL(A) ��������� 2 �����.

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(A)EXPORT SYMBOL(B)EXPORT SYMBOL(A)

******** Duplicate symbol on previous exportEXPORT SYMBOL(C)

ENDPGMEXP******** Export signature: 000000000000000000000000000CDED3.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 53. ���� Duplicate Exported Symbols

222 IBM i: ������ ILE

Page 231: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Level Checking Cannot Be Disabled More than Once, Ignored

������ 54������� binder language listing ������������������.

������ ����������������������������������.

�� STRPGMEXP block ������� 1 block ������������ LVLCHK(*NO).

����������������������� ������������������������������������� �������� 2 ���������������LVLCHK(*YES).

������������������

1. ���������� STRPGMEXP block ����������� LVLCHK(*NO) �������� block �����.

2. ��������� CRTSRVPGM ��������

������������� PGMLVL(*PRV) export block ���� block ���������������� LVLCHK(*NO). ���������� LVLCHK(*NO) ������������� PGMLVL(*CURRENT) export block ��������������.

Multiple Current Export Blocks Not Allowed, Previous Assumed

������ 55 ������ 224 ������� binder language listing ������������������.

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT) LVLCHK(*NO)EXPORT SYMBOL(A)EXPORT SYMBOL(B)

ENDPGMEXP******** Export signature: 00000000000000000000000000000000.STRPGMEXP PGMLVL(*PRV) LVLCHK(*NO)******** Level checking cannot be disabled more than once, ignored

EXPORT SYMBOL(A)ENDPGMEXP******** Export signature: 000000000000000000000000000000C1.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 54. ���������� STRPGMEXP �������������������� LVLCHK(*NO).

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 223

Page 232: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ ����������������������������������.

��� PGMLVL(*CURRENT) ������������������������������������������� STRPGMEXP ������� 1 ������. export block ��� 2 ������������ PGMLVL(*CURRENT) ��������������� PGMLVL(*PRV).

����������������������� �������� �����������������������������

������������������

1. ���������� PGMLVL ������������������� PGMLVL(*PRV).

2. ��������� CRTSRVPGM ��������

������������� ������ STRPGMEXP �������� 2 ��������������.

Current Export Block Is Empty

������ 56������� binder language listing ������������������.

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(A)EXPORT SYMBOL(B)EXPORT SYMBOL(C)

ENDPGMEXP******** Export signature: 0000000000000000000000000000CDE3.STRPGMEXP

EXPORT SYMBOL(A)******** Multiple ’current’ export blocks not allowed, ’previous’ assumed.

EXPORT SYMBOL(B)ENDPGMEXP******** Export signature: 00000000000000000000000000000CD2.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 55. ��������������� PGMLVL(*CURRENT) �����������������

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)ENDPGMEXP******** Export signature: 00000000000000000000000000000000.***ERROR Current export block is empty.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 56. ����� Symbol ��� Export ��� STRPGMEXP PGMLVL(*CURRENT) Block.

224 IBM i: ������ ILE

Page 233: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ �����������������������������������

������������� symbol ������ export ��� *CURRENT export block.

��������������������������������.

������������������

1. �������������������������� ������:

v ������������ symbol �������� export.

v � �� STRPGMEXP-ENDPGMEXP export block �������������������� block ������������ PGMLVL(*CURRENT).

2. ��������� CRTSRVPGM ��������.

������������� �������������������������������������� binder language source file �������������STRPGMEXP ��� ENDPGMEXP:

EXPORT SYMBOL(A)

Export Block Not Completed, End-of-File Found before ENDPGMEXP

������ 57������� binder language listing ������������������.

������ �����������������������������������

����������� ENDPGMEXP ��������������������.

��������������������������������.

������������������

1. �������������������������� ������:

v ����������� ENDPGMEXP ���������������������.

v �������� STRPGMEXP ��� �������������� ENDPGMEXP ������������� ������������ symbol������������ export ���������.

2. ��������� CRTSRVPGM ��������.

������������� �������������������������������������� STRPGMEXP:

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)***ERROR Syntax not valid.***ERROR Export block not completed, end-of-file found before ENDPGMEXP.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 57. ����������� ENDPGMEXP ���������������������������.

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 225

Page 234: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

EXPORT SYMBOL(A)ENDPGMEXP

Export Block Not Started, STRPGMEXP Required

������ 58������� binder language listing ������������������.

������ �����������������������������������

����������� STRPGMEXP ����������������� ENDPGMEXP.

��������������������������������.

������������������

1. �������������������������� ������:

v ����������� STRPGMEXP ����.

v �� symbol ������ export ��������� ENDPGMEXP �����.

2. ��������� CRTSRVPGM ��������.

������������� ������������ 2 ������������������ binder language source file ��������������ENDPGMEXP.

STRPGMEXPEXPORT SYMBOL(A)

Export Blocks Cannot Be Nested, ENDPGMEXP Missing

������ 59 ������ 227 ������� binder language listing ������������������.

Binder Language Listing

ENDPGMEXP***ERROR Export block not started, STRPGMEXP required.***ERROR No ’current’ export block

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 58. ����������� STRPGMEXP.

226 IBM i: ������ ILE

Page 235: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ �����������������������������������

����������� ENDPGMEXP ����������������� STRPGMEXP �����������.

��������������������������������.

������������������

1. �������������������������� ������:

v ����������� ENDSTRPGM ���������� STRPGMEXP ��������.

v �������� STRPGMEXP ���������� symbol ������ export �����.

2. ��������� CRTSRVPGM ��������.

������������� ������ ENDPGMEXP ���������������� binder source file ��������������STRPGMEXP �������� 2.

Exports Must Exist inside Export Blocks

������ 60������� binder language listing ������������������.

������ �����������������������������������

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(A)EXPORT SYMBOL(B)

STRPGMEXP PGMLVL(*PRV)***ERROR Export blocks cannot be nested, ENDPGMEXP missing.

EXPORT SYMBOL(A)ENDPGMEXP******** Export signature: 000000000000000000000000000000C1.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 59. ����������� ENDPGMEXP

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(A)EXPORT SYMBOL(B)

ENDPGMEXP******** Export signature: 00000000000000000000000000000CD2.

EXPORT SYMBOL(A)***ERROR Exports must exist inside export blocks.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 60. ����������� Symbol ������ Export ���������� STRPGMEXP-ENDPGMEXP Block.

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 227

Page 236: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Symbol ������������ export ������������������� STRPGMEXP-ENDPGMEXP block.

��������������������������������.

������������������

1. �������������������������� ������:

v ���� symbol �������� export. ��������� STRPGMEXP-ENDPGMEXP block.

v �� symbol �����.

2. ��������� CRTSRVPGM ��������.

������������� ������������������������������������ binder language source file.

Identical Signatures for Dissimilar Export Blocks, Must Change Exports

������ �����������������������������������

Signature ��������������������������� STRPGMEXP-ENDPGMEXP block �������� exportsymbol �������������. ������������������������������������. �������������� symbol ������ export����������������� ��� ������������������������������� 1 �� 3.4E28 �����.

��������������������������������.

������������������

1. �������������������������� ������:

v ����� symbol �������� export ��� PGMLVL(*CURRENT) block.

��������������������� symbol ��������� export ����. ������������������ ���������������������������������� �������� symbol ��������� ���������������������� signature �����������. ����������������������� symbol ���������������������� export.

v �������������� symbol �������� export ���������� binder language source file ����������������������.

v ����� signature ����������������� SIGNATURE �������� Start Program Export(STRPGMEXP).

2. ��������� CRTSRVPGM ��������.

Multiple Wildcard Matches

������ 61 ������ 229 ������� binder language listing ������������������.

228 IBM i: ������ ILE

Page 237: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ �����������������������������������

����������� wildcard �������������� export ������ symbol ����� export ������� 1 ���.

��������������������������������.

������������������

1. ����� wildcard ���������������������� �������� export ������������������������ export������������������.

2. ��������� CRTSRVPGM ��������.

No Current Export Block

������ 62������� binder language listing ������������������.

������ �����������������������������������

����� STRPGMEXP PGMLVL(*CURRENT) �� binder language source file.

��������������������������������.

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT ("A"<<<)***ERROR Multiple matches of wildcard specificationEXPORT ("B"<<<)ENDPGMEXP******** Export signature: 0000000000000000000000000000FFC2.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G

������ 61. ���� Multiple Matches of Wildcard Specification

Binder Language Listing

STRPGMEXP PGMLVL(*PRV)EXPORT SYMBOL(A)

ENDPGMEXP******** Export signature: 000000000000000000000000000000C1.***ERROR No ’current’ export block

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 62. ���� No PGMLVL(*CURRENT) Export Block

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 229

Page 238: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������

1. �������������������������� ������:

v ������� PGMLVL(*PRV) ������� PGMLVL(*CURRENT).

v ����� STRPGMEXP-ENDPGMEXP block ������� *CURRENT export block.

2. ��������� CRTSRVPGM ��������.

������������� ��� PGMLVL(*PRV) ����������������� PGMLVL(*CURRENT).

No Wildcard Matches

������ 63������� binder language listing ������������������.

������ �����������������������������������

����������� wildcard �������������� export ��������� symbol ��� ��������� export ���.

��������������������������������.

������������������

1. ����� wildcard ��������� symbol ������������ export.

2. ��������� CRTSRVPGM ��������.

Previous Export Block Is Empty

������ 64 ������ 231 ������� binder language listing ������������������.

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT ("Z"<<<)***ERROR No matches of wildcard specificationEXPORT ("B"<<<)ENDPGMEXP******** Export signature: 0000000000000000000000000000FFC2.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G

������ 63. ���� No Matches of Wildcard Specification.

230 IBM i: ������ ILE

Page 239: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ �����������������������������������

�� STRPGMEXP PGMLVL(*PRV) ���������������� symbol ���.

��������������������������������.

������������������

1. �������������������������� ������:

v ����� symbol �� STRPGMEXP-ENDPGMEXP block �����������.

v �� STRPGMEXP-ENDPGMEXP block ����������������.

2. ��������� CRTSRVPGM ��������.

������������� STRPGMEXP-ENDPGMEXP block �������������������������� binder languagesource file.

���� Signature Contains Variant Characters

������ 65������� binder language listing ������������������.

������ �����������������������������������

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(A)EXPORT SYMBOL(B)

ENDPGMEXP******** Export signature: 00000000000000000000000000000CD2.STRPGMEXP PGMLVL(*PRV)ENDPGMEXP******** Export signature: 00000000000000000000000000000000.***ERROR Previous export block is empty.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 64. ���� No PGMLVL(*CURRENT) Export Block

Binder Language Listing

STRPGMEXP SIGNATURE(’\!cdefghijklmnop’)***ERROR Signature contains variant characters

EXPORT SYMBOL(’Proc_2’)ENDPGMEXP

******** Export signature: E05A8384858687888991929394959697.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 65. ���� Signature Contains Variant Characters

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 231

Page 240: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Signature ������������������������� coded character set identifiers(CCSIDs).

��������������������������������.

������������������

1. ������������������������������.

2. ��������� CRTSRVPGM ��������.

��������� ��� \! ����������������.

SIGNATURE(*GEN) Required with LVLCHK(*NO)

������ 66������� binder language listing ������������������.

������ �����������������������������������

������������� LVLCHK(*NO) ������������������� SIGNATURE(*GEN) ����.

��������������������������������.

������������������

1. �������������������������� ������:

v ����� SIGNATURE(*GEN)

v ����� LVLCHK(*YES)

2. ��������� CRTSRVPGM ��������.

Signature Syntax Not Valid

������ 67 ������ 233 ������� binder language listing ������������������.

Binder Language Listing

STRPGMEXP SIGNATURE(’ABCDEFGHIJKLMNOP’) LVLCHK(*NO)EXPORT SYMBOL(’Proc_2’)

***ERROR SIGNATURE(*GEN) required with LVLCHK(*NO)ENDPGMEXP

******** Export signature: C1C2C3C4C5C6C7C8C9D1D2D3D4D5D6D7.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 66. ������������� LVLCHK(*NO) ���� Signature ��������������.

232 IBM i: ������ ILE

Page 241: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ �����������������������������������

Signature ����������������������������.

��������������������������������.

������������������

1. ���������������������������������� signature.

2. ��������� CRTSRVPGM ��������.

��������� �������������������� ″ ����������� signature.

Symbol Name Required

������ 68������� binder language listing ������������������.

������ �����������������������������������

������������ symbol ������ export ������������������.

��������������������������������.

Binder Language Listing

STRPGMEXP SIGNATURE(’"abcdefghijkl "’)***ERROR Signature syntax not valid***ERROR Signature syntax not valid***ERROR Syntax not valid.***ERROR Syntax not valid.

EXPORT SYMBOL(’Proc_2’)ENDPGMEXP

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 67. ������������ Signature �������������

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(A)EXPORT SYMBOL(’)

***ERROR Symbol name required.ENDPGMEXP******** Export signature: 000000000000000000000000000000C1.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 68. ����� Symbol ������ Export

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 233

Page 242: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������

1. �������������������������� ������:

v ����������������������������������������� binder language.

v ������������ symbol �������� export ������������������������.

2. ��������� CRTSRVPGM ��������.

�������������, ������ EXPORT SYMBOL(″″) ������������������������ binder

Symbol Not Allowed as Service Program Export

������ 69������� binder language listing ������������������.

������ �����������������������������������

Symbol �������� export ������������������������������� export �����������������������������.��������� symbol �������������� export ������������������ ��� symbol ������������� import������������������.

��������������������������������.

������������������

1. �������������������������� ������:

v �� symbol ���������������������������� binder language.

v ��������������� symbol ���������� export ���������������� MODULE ��� ������CRTSRVPGM

v ����� symbol ����������������������� by copy �����������������������������������.

2. ��������� CRTSRVPGM ��������.

������������� ��������� EXPORT SYMBOL(A) ������������������������� binderlanguage

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(A)

***ERROR Symbol not allowed as service program export.EXPORT SYMBOL(D)

ENDPGMEXP******** Export signature: 00000000000000000000000000000CD4.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 69. ����������� Symbol ������������ Export ��� Service Program

234 IBM i: ������ ILE

Page 243: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Symbol Not Defined

������ 70������� binder language listing ������������������.

������ �����������������������������������

Symbol �������� export ������������������ ������������������������������������.

��������������������������������.

������������������

1. �������������������������� ������:

v �� symbol �������������������������������� binder language.

v ��������������� symbol ���������� export ���������������� MODULE ��� ������CRTSRVPGM

v ����� symbol ����������������������� by copy �����������������������������������.

2. ��������� CRTSRVPGM ��������.

������������� ��������� EXPORT SYMBOL (Q) ������������������������� binderlanguage.

Syntax Not Valid

������ �����������������������������������

��������������� source member ������������������� binder language.

��������������������������������.

������������������

1. ����� source member ���������� ���������������������� binder language ����������.

2. ��������� CRTSRVPGM ��������.

Binder Language Listing

STRPGMEXP PGMLVL(*CURRENT)EXPORT SYMBOL(A)EXPORT SYMBOL(Q)

***ERROR Symbol not defined.ENDPGMEXP******** Export signature: 00000000000000000000000000000CE8.

* * * * * E N D O F B I N D E R L A N G U A G E L I S T I N G * * * * *

������ 70. ����� Symbol ����������������������������.

����� 17. Output Listing ��������� CRTPGM, CRTSRVPGM, UPDPGM, ���� UPDSRVPGM 235

Page 244: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

236 IBM i: ������ ILE

Page 245: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 18. Exceptions ������������ Optimize

������������������������ MCH3601 exception message ������������������������������������� optimization ������� 30(*FULL) ���� 40. ��������� ��������������������������������������� ������������������������������������� Exception ������� MCH3601 ����������������������� optimization ������� 10(*NONE) ���� 20(*BASIC). �������������������������������������������������������������� HLL ��� ILE �������������������������������������. ���������������������������������������������������.

����������������� optimization ������� 30(*FULL) ���� 40 ILE ������������������������������������������������������������������������������ loop. �������������������������loop ���������������������������������������������������. ����������������������������������� save ��������������������������������������������� loop �����������. �������������������������������� ILE �������������������������������������������� loop ��������������������������� loop.

�������������������:

DCL ARR[1000] INTEGER;DCL I INTEGER;

I = init_expression; /* Assume that init_expression evaluatesto -1 which is then assigned to I */

/* More statements */

WHILE ( I < limit_expression )

I = I + 1;

/* Some statements in the while loop */

ARR[I] = some_expression;

/* Other statements in the while loop */

END;

������������������ ARR[init_expression] �������������������������������������� ������������������������������� Exception ������� MCH3601. ��������� ILE ���������������������������������������� ����������������� WHILE loop.

������������ MCH3601 �������� optimization ������� 30(*FULL) ���� 40 ����������������������������:

1. ����� loop ������������������������������������������������������������������.

2. �������������������������������������������� loop �����������.

© ������������ IBM Corp. 1997, 2016 237

Page 246: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

3. ��������������������������������������������������������.

���������������������������������� ����������������������� optimization ��� 30(*FULL) ���� 40�������� ��������������������������:

1. ������������������������������������������������������ loop.

2. ��������������������������������������������������.

���������������������������������������:

I = init_expression + 1;

WHILE ( I < limit_expression + 1 )

ARR[I] = some_expression;

I = I + 1;

END;

���������������������������������� ������������� optimization ����� 30(*FULL) ���� 40������ 20(*BASIC) ���� 10(*NONE).

238 IBM i: ������ ILE

Page 247: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 19. ������ CL ������������������� ILE

�������������������������� CL ������������������������� ILE ���������

������ CL ��������������

�������� 14. ������ CL ��������������

������ ��������������

CHGMOD ����������������

CRTCBLMOD �������������������

CRTCLMOD �������������� CL

CRTCMOD �������������� C

CRTCPPMOD �������������� C++

CRTRPGMOD ����������������������

DLTMOD �������

DSPMOD ���������

RTVBNDSRC �������� Binder Source

WRKMOD �������������

������ CL ��������������������������

�������� 15. ������ CL ��������������������������

������ ��������������

CHGPGM ������������������

CRTBNDC ���������������������������������

CRTBNDCBL ������������������������������������

CRTBNDCL ���������������� CL ���������������

CRTBNDCPP �����������������������������������������

CRTBNDRPG ���������������������������������������

CRTPGM ������������

DLTPGM ���������

© ������������ IBM Corp. 1997, 2016 239

Page 248: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������� 15. ������ CL �������������������������� (���)

������ ��������������

DSPPGM �������������

DSPPGMREF �����������������������

UPDPGM �������������

WRKPGM ���������������

������ CL ������������������������

�������� 16. ������ CL ������������������������

������ ��������������

CHGSRVPGM ��������������������������

CRTSRVPGM ��������������������

DLTSRVPGM �����������������

DSPSRVPGM ���������������������

RTVBNDSRC �������� Binder Source

UPDSRVPGM ���������������������

WRKSRVPGM �����������������������

������ CL ��������� Binding Directory

�������� 17. ������ CL ��������� Binding Directory

������ ��������������

ADDBNDDIRE �������������� Binding Directory

CRTBNDDIR ����� Binding Directory

DLTBNDDIR �� Binding Directory

DSPBNDDIR ���� Binding Directory

RMVBNDDIRE ����������� Binding Directory

WRKBNDDIR �������� Binding Directory

WRKBNDDIRE ����������������� Binding Directory

240 IBM i: ������ ILE

Page 249: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������ CL ��������� Structured Query Language

�������� 18. ������ CL ��������� Structured Query Language

������ ��������������

CRTSQLCI ����� Structured Query Language ������������� ILE C

CRTSQLCBLI ����� Structured Query Language ������������� ILE COBOL

CRTSQLCPPI ��������������� SQL ILE C++

CRTSQLRPGI ����� Structured Query Language ������������� ILE RPG

������ CL ��������� CICS

�������� 19. ������ CL ��������� CICS

������ ��������������

CRTCICSC ��������������� CICS® ILE C

CRTCICSCBL ����� CICS ���������� COBOL

������ CL ������������������������

�������� 20. ������ CL ������������������������

������ ��������������

DSPMODSRC �������������������

ENDDBG ���������������

STRDBG �������������

������ CL ���������������� Binder Language Source File

�������� 21. ������ CL ���������������� Binder Language Source

������ ��������������

EDTF ���������

STRPDM ���������������� Programming Development Manager

STRSEU ���������������� Source Entry Utility

��������: �������������������������������� ������������� binder language source file ���:

����� 19. ������ CL ������������������� ILE 241

Page 250: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�������� 21. ������ CL ���������������� Binder Language Source (���)

������ ��������������

ENDPGMEXP ������������� Program Export

EXPORT �����

242 IBM i: ������ ILE

Page 251: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

����� 20. �������������������

���������������������������������������������������������������� ILE ���������������� IBM i,�����������������������������������:

v ���� �������������������������� �������������������������������������������������������������� ��������������� ������������������������������������� ������� ����������������������������������������������������������������������� ������������� �������������������������������������������� ��������������������������������������������� AuxiliaryStorage Pools (ASP), ����� Mirrored Protection ������ Checksum. ��������� ������������������������������������������� (Backup) ���.

v ������������� CL programming ������������������������������������������� ��������������������������������������������������������������, CL ����������, ��� control flow���������������������������, ��������������������� ��������� CL ������������������ CL ����������������������������� �������������������������� (PredefinedMessage) ��������������������������� , ������������������������������������������� �������, �������������������� ���������������, ������.

v Communications Management

�������������������������������������������������������������, ���������������, ��� trace �����������������������������, �������������������������������, �������������������, ���������������������� ��� ��������������������������.

v ICF Programming

��� �������������������������������������������������������������� ��� ����������������������������� ������������������������� ���������������������� DataDescription Specification (DDS), �������������������, ���������, ������������������������� ������������������

v Rational® Developer for i: ILE C/C++ ������������������������

��������������������,�������, �����, ������ ILE C ���������� ILE C++ ���������������� ��������� ILE ��������������������������� IBM i ; �������� ������� ������������; ������������ I/O;localization; �����������������������������; ����������������������� C++ (RTTI)

v Rational Developer for i: �������������� ILE C/C++

������������������������������ �������������� ������������������� - C���������� ������������������� -C++

v Rational Developer for i: ��������������������� ILE C/C++

������������������ ����������������� ILE C/C++, ������������������������� preprocessor, �����, �������,��������������������������� IBM i ��������������� Qshell, ���������������� I/O

© ������������ IBM Corp. 1997, 2016 243

Page 252: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ILE C/C++ Runtime Library Functions

���������������������������� ILE C/C++, �������������������������, ���������� ��������������������������

v Rational Developer for i: ������������������������ ILE COBOL

���������������������, �������, ���, ���, �����, ��������������� ILE COBOL ���������������� IBM i�������������������������������������������� ILE COBOL ���� ��� ���������������� ILECOBOL, ���������������������������������, ���������������������������� exception�����������������������������������������/���������������������������������, �������������, ���������� ��� ���� ICF.

v Rational Developer for i: �������������� ILE COBOL

���������������������������ILE COBOL ���������������������� ILE COBOL ��������������������������� ILECOBOL �������������������������� Identification Division paragraphs, Environment Divisionclauses, Data Division paragraphs, Procedure Division statement ��� Compiler-Directingstatements.

v Rational Developer for i: ��������������������� ILE RPG

���������������������������������������� RPG IV, ������������������������ ILE RPG �� Integrated LanguageEnvironment (ILE) ���������������� IBM i ���������������������������� ���������������� ������������������������������������������ ������������� ������������������������������������������������������ exception ��������� ��������������������������� IBM i ��������� RPG ����������� ���������� ������������������������������� RPG IV ����������������������������������� �������������������������������������������������������������������������������������������������.

v Rational Developer for i: �������������� ILE RPG

��������������� ����������������������������������������������� IBM i ������������������������� RPG IV ������������������������������������, �����������������������, ������������������������������������������ (Build-In) ���� ����������������������������������������� RPG logic, ����������������,������������� edit, ������������.

v Intrasystem Communications Programming

�������������������������������������������������������������������������������� ����������������������������������������������������������������������� Intrasystem Communication ������������������.�������������� ������������������������������������������ Intrasystem Communication������ Intersystem Communications Function

v Security reference

������������������������������������������������������������������ ������������������������������������������������������������, �������������������������� �������������������������������������, ����������������������������������������������� ���������������������������

244 IBM i: ������ ILE

Page 253: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

v ������ ������������ ���������� �������������������� IBM i Information Center ������������������ ������������������������������������������������� ���������� ��������������������������, ����������������������� performance ������ ������������������������������� �����������������������������������, ����������� system value �������������������������������������������� ���� ������������������������������������������� ���������������������������������

����� 20. ������������������� 245

Page 254: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

246 IBM i: ������ ILE

Page 255: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������� 2. �������

© ������������ IBM Corp. 1997, 2016 247

Page 256: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

248 IBM i: ������ ILE

Page 257: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������

���������������������������������������������������������������������������

IBM ������������������������, ������, ��������������������������������� ����������������������������� IBM ������������������������������ ��������������������������������� ������������� ������������������, �������, ������������� IBM ������������������������������������������������� ���������, �������, ������������� IBM ������������������� ���������, �������, ��������������������������������� ����������������������������������� ���IBM ���������������� ������������ ������������������������������������������� ������������������������������ ������� ���������������������� IBM

IBM ������������������������������������������������������������������������������������������������ ����������� ������������������������������������������������������������������������������ ��������������������������������������������� ���������������� :

IBM Director of LicensingIBM CorporationNorth Castle DriveArmonk, NY 10504-1785U.S.A.

�������������������������������������������������������������� (DBCS), ���������� IBMIntellectual Property Department �������������� ����������������, ������������������,�����:

Intellectual Property LicensingLegal and Intellectual Property LawIBM Japan Ltd.1623-14, Shimotsuruma, Yamato-shiKanagawa 242-8502 Japan

���������������������������������������� ������������������������������������������������: INTERNATIONAL BUSINESS MACHINES CORPORATION ������������������ ″��������������″ �����������������������, �������������� ����������, ����������, ��������������,������������������ �������������������, �������������������������������������������������������� ���������������������������������������������������������� ����������������������������� ���������������������������������

��������������������������������������������������������������� ������� ����������������������������������������� ��������������������������������������������������������������

© ������������ IBM Corp. 1997, 2016 249

Page 258: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

IBM ���������������� ���/������������������������ ���/����������� ��������������������������������������������������������������������

������������������������������ IBM ���������������������������������������������������������������������������������������������� ���������������������������������� ����������������������������������������������� IBM ����������������������������� �����������������������

IBM �������������������������� ������������������������� ���������������������������������������� ������

��������������������������������������������������������������� �����������������������������������������: (i) ������������������� ������������������������������������������������������ (���������� ����������) ��� (ii) ������������������������������, ���������:

IBM CorporationSoftware Interoperability Coordinator, Department YBWA3605 Highway 52 NRochester, MN 55901U.S.A.

�����������������������, ������������������������� ���������������������, �����������������,�����������������������

����������������������������������������������� ��������������������������������������������������������������� IBM ����������������� IBM Customer Agreement, IBM International ProgramLicense Agreement ������������������������������������

������������������������������������������������������������������������������������������������� ��������������������������������������������������������������������� ����������������������������������������������� �������������������������������������������������������������������� ���������� ��������������������������������� extrapolation ��������������������������� ��������������������������������������������������������������������������

����������������������������������������� IBM ��������������������������������������������,��������������������������������������������������� IBM ����������������������������������������������������������������������� �������������� ����������������������������������������������������������� IBM ��������������������������������������������������������IBM �������������������������������������������

���������� �������������������������������������������� IBM ������������������� ������������������������������������ ���������������������������������������������

�������������������������������������������������� ����������������������� ��������������������������������������������������������������

250 IBM i: ������ ILE

Page 259: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

������������������������������������������������������������������ ����������������������������������������������, �������������������������� ���������������, �������������, ��������������������� ���������������������������� ������������������������������������������������

�����������������:

����������������������������������������������������������� (source language) ��������������������������������������������������� ��������������� ����������� ���������������������������������������������� ��������������������������� IBM ���������������������� ��������� ������� ���������������������������������������������������������������������������������������������������������������������������� ������������������������������������������������������������������� �������, IBM ������������������������������������������������, ������������������������, ��������������������������������������������������������������� ″��������������″ ����������������������� �������� IBM������������������������������� ���������������������������������������������

��������������������������������������� ���������� ����������������������� �������������������������� ������:

© (����������������) (��) ��������� ������������������ IBM Corp. Sample Programs

© ��������� IBM Corp. _�������������������_

���������������������������

���������������� ILE C/C++ Compiler Reference �������� Programming Interfaces ������������������������������ ��������������������� IBM i

�����������������

IBM, ������������ IBM, ��� ibm.com ������������������������������������������������������������� International Business Machines Corp., ��������������������������������������������������������������������������������������� IBM �������������� ������������������������������������� IBM ��������������� “�����������������������������������” ��� www.ibm.com/legal/copytrade.shtml

Adobe, ������������ Adobe, PostScript, ��������������� PostScript ������������������������������������������������������������� Adobe Systems Incorporated ��������������,���/���������������

Linux ��������������������������������� Linus Torvalds ��������������������, ���������� ���������������

�������� 251

Page 260: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Microsoft, Windows, Windows NT ������������ Windows ������������������������Microsoft Corporation ��������������������, ���������� ���������������

UNIX ��������������������������������� The Open Group ���������������������������������

Java™ �������������������������� Java ������� ���������������������������������������Oracle, Inc. ��������������, �����������, ���������������

��������������������������� ��������������������������� IBM ���������������

�������������������

������������������������������������������������������������������

�����������������������:������������������������������������������������������������������������������������������������������������������������������������������������������������������ ���������������������������������������������� ���������������������������������� ������������������������������������� IBM

����������������������:������������������� ������� ����������������������������������������� ����������������������������������������������������������������� �������������������������������������������������� ���������������������������� ������� ����������������������������������������������������������������������� ������������������������������������� IBM

���������������������������������������� IBM ����������������������� ����������������������� ����������������������� ����������������� �������������� ������ ��������� �������������������������� ������������������

IBM ������������������������������������������������� ����������������������������� ��������������������������������������������������������������� ��������� IBM ��������������������������������������������������������������

��������������������� ���������������������������������������������� �������������������������������������������������� ����������������������������������������������������������������

IBM ����������������������������������������������� ����������������������������� ″��������������″ ����������������������� ���������������������������� ������������������������������������������������������ ������������ �������������������������������������������������

252 IBM i: ������ ILE

Page 261: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

�����

�����������_C_TS_calloc() 73_C_TS_free() 73_C_TS_malloc() 73_C_TS_malloc64() 73_C_TS_realloc() 73_CEE4ALC allocation strategy type 136

AAbnormal End (CEE4ABN) bindable

API 146access ordering

shared storage 202ACTGRP 112ACTGRP (activation group) parameter 41

*CALLER value 121activation group creation 41program activation 38, 42

actionsstorage synchronizing 204

activationdynamic program call 128program 37program activation 46��������������� 46, 125

activation groupACTGRP (activation group) parameter

*CALLER value 121activation group creation 38program activation 38, 42

benefits of resource scoping 9bindable APIs (����������������������

�����������s) 161call stack example 38commitment control

scoping 157�������� 10

control boundaryactivation group deletion 44example 49

creation 41data management scoping 60, 157default 42deletion 44management 117

activation group (���)mixing COBOL with other languages 11multiple applications running in same

job 117original program model (OPM) 42reclaim resources 118, 120resource isolation 39resources 39reuse 44scoping 60, 157system-named 41, 44user-named

deletion 44description 41, 117

��������������� 121�������� shared open data path (ODP) 10

activation group selection for teraspace storagemodel 65

adaptive code generation (ACG) 192advanced concepts 37ALWLIBUPD parameter

on CRTPGM command 111on CRTSRVPGM command 111

ALWUPD parameteron CRTPGM command 111on CRTSRVPGM command 111

API (application programming interface)QCAPCMD 120services 9

API (���������������������������������)Abnormal End (CEE4ABN) 146activation group 161CEE4ABN (Abnormal End) 146CEEDOD (Retrieve Operational Descriptor

Information) 130CEEGSI (Get String Information) 130CEEHDLR (Register User-Written

Condition Handler) 56, 141CEEHDLU (Unregister User-Written

Condition Handler) 56CEEMGET (Get Message) 150CEEMOUT (Dispatch Message) 150CEEMRCR (Move Resume Cursor) 143CEEMSG (Get, Format and Dispatch

Message) 150CEENCOD (Construct Condition

Token) 147

API (���������������������������������)(���)

CEESGL (Signal Condition)condition token 147, 150description 53

CEETSTA (Test for OmittedArgument) 128

Change Exception Message(QMHCHGEM) 143

condition management 162, 164Construct Condition Token

(CEENCOD) 147control flow 161date 162debugger 164Dispatch Message (CEEMOUT) 150dynamic screen manager (DSM) 165error handling 164exception management 162, 164Get Message (CEEMGET) 150Get String Information (CEEGSI) 130Get, Format and Dispatch Message

(CEEMSG) 150HLL independence 161list of 161, 165math 162message handling 164Move Resume Cursor (CEEMRCR) 143naming conventions 161original program model (OPM) and

ILE 130procedure call 164program call 164Promote Message (QMHPRMM) 144QMHCHGEM (Change Exception

Message) 143QMHPRMM (Promote Message) 144QMHSNDPM (Send Program

Message) 53, 141Register User-Written Condition Handler

(CEEHDLR) 56, 141Retrieve Operational Descriptor Information

(CEEDOD) 130Send Program Message

(QMHSNDPM) 53, 141Signal Condition (CEESGL)

condition token 147, 150description 53

© ������������ IBM Corp. 1997, 2016 253

Page 262: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

API (���������������������������������)(���)

storage management 164supplementing HLL-specific runtime

library 161Test for Omitted Argument

(CEETSTA) 128time 162Unregister User-Written Condition Handler

(CEEHDLU) 56��������������� 164

applicationmultiple

running in same job 117application programming interface (API)

QCAPCMD 120services 9

argumentpassing

in mixed-language applications 129argument passing

between languages 129by reference 126by value directly 126by value indirectly 126omitted arguments 128to procedures 126to programs 128

automatic storage 133

Bbasic listing 209bind

by copy 27, 83by reference 27, 84

bindable APIservices 9

bindable API (���������������������������������)

Abnormal End (CEE4ABN) 146activation group 161CEE4ABN (Abnormal End) 146CEEDOD (Retrieve Operational Descriptor

Information) 130CEEGSI (Get String Information) 130CEEHDLR (Register User-Written

Condition Handler) 56, 141CEEHDLU (Unregister User-Written

Condition Handler) 56CEEMGET (Get Message) 150CEEMOUT (Dispatch Message) 150

bindable API (���������������������������������) (���)

CEEMRCR (Move Resume Cursor) 143CEEMSG (Get, Format and Dispatch

Message) 150CEENCOD (Construct Condition

Token) 147CEESGL (Signal Condition)

condition token 147, 150description 53

CEETSTA (Test for OmittedArgument) 128

condition management 162, 164Construct Condition Token

(CEENCOD) 147control flow 161date 162debugger 164Dispatch Message (CEEMOUT) 150dynamic screen manager (DSM) 165error handling 164exception management 162, 164Get Message (CEEMGET) 150Get String Information (CEEGSI) 130Get, Format and Dispatch Message

(CEEMSG) 150HLL independence 161list of 161, 165math 162message handling 164Move Resume Cursor (CEEMRCR) 143naming conventions 161original program model (OPM) and

ILE 130procedure call 164program call 164Register User-Written Condition Handler

(CEEHDLR) 56, 141Retrieve Operational Descriptor Information

(CEEDOD) 130Signal Condition (CEESGL)

condition token 147, 150description 53

storage management 164supplementing HLL-specific runtime

library 161Test for Omitted Argument

(CEETSTA) 128time 162Unregister User-Written Condition Handler

(CEEHDLU) 56��������������� 164

binder 27

binder information listingservice program example 217

binder languagedefinition 95ENDPGMEXP (End Program Export)

command 95, 97error 218examples 100, 109EXPORT (Export Symbol) 95, 98STRPGMEXP (Start Program Export) 95

LVLCHK parameter 98PGMLVL parameter 97SIGNATURE parameter 97

STRPGMEXP (Start Program Export)command 97

binder listingbasic 209extended 211full 213service program example 216

bindinglarge number of modules 84original program model (OPM) 14����������� ILE 7

binding directory������ CL (����������) 240

binding statisticsservice program example 218

BNDDIR parameter on UPDPGMcommand 112

BNDDIR parameter on UPDSRVPGMcommand 112

BNDSRVPGM parameter on UPDPGMcommand 112

BNDSRVPGM parameter on UPDSRVPGMcommand 112

by reference, passing arguments 126by value directly, passing arguments 126by value indirectly, passing arguments 126

CC signal 53call

procedure 29, 123procedure pointer 123program 29, 123

call message queue 52call stack

activation group example 38definition 123

254 IBM i: ������ ILE

Page 263: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

call stack (���)example

dynamic program calls 123static procedure calls 123

call-level scoping 59callable service 161Case component of condition token 147CEE4ABN (Abnormal End) bindable

API 146CEE4DAS (Define Heap Allocation Strategy)

bindable API 137CEE9901 (generic failure) exception

message 55CEE9901 function check 52CEECRHP (Create Heap) bindable API 136CEECRHP bindable API 136CEECZST (Reallocate Storage) bindable

API 136CEEDOD (Retrieve Operational Descriptor

Information) bindable API 130CEEDSHP (Discard Heap) bindable

API 134, 136CEEFRST (Free Storage) bindable API 136CEEGSI (Get String Information) bindable

API 130CEEGTST (Get Heap Storage) bindable

API 136CEEHDLR (Register User-Written Condition

Handler) bindable API 56, 141CEEHDLU (Unregister User-Written

Condition Handler) bindable API 56CEEMGET (Get Message) bindable API 150CEEMKHP (Mark Heap) bindable API 135,

137CEEMOUT (Dispatch Message) bindable

API 150CEEMRCR (Move Resume Cursor) bindable

API 143CEEMSG (Get, Format and Dispatch Message)

bindable API 150CEENCOD (Construct Condition Token)

bindable API 147CEERLHP (Release Heap) bindable

API 135, 137CEESGL (Signal Condition) bindable API

condition token 147, 150description 53

CEETREC API 44, 49, 50CEETSTA (Test for Omitted Argument)

bindable API 128Change Exception Message (QMHCHGEM)

API 143Change Module (CHGMOD) command 152

characteristics of teraspace 63Check lock value 206CHGMOD (Change Module) command 152CICS

������ CL (����������) 241CL (control language) command

CHGMOD (Change Module) 152RCLACTGRP (Reclaim Activation

Group) 120RCLRSC (Reclaim Resources)

for ILE programs 120for OPM programs 120

Clear lock value 206code optimization

errors 237levels 152performance

compared to original program model(OPM) 12

levels 34module observability 152

coexistence with existing applications 9command, CL

CALL (dynamic program call) 128CRTPGM (Create Program) 79CRTSRVPGM (Create Service

Program) 79ENDCMTCTL (End Commitment

Control) 157OPNDBF (Open Data Base File) 155OPNQRYF (Open Query File) 155RCLACTGRP (Reclaim Activation

Group) 45RCLRSC (Reclaim Resources) 118STRCMTCTL (Start Commitment

Control) 155, 157STRDBG (Start Debug) 151Update Program (UPDPGM) 110Update Service Program

(UPDSRVPGM) 110command, CL (control language)

CHGMOD (Change Module) 152RCLACTGRP (Reclaim Activation

Group) 120RCLRSC (Reclaim Resources)

for ILE programs 120for OPM programs 120

commitment controlactivation group 157commit operation 157commitment definition 157ending 158rollback operation 157

commitment control (���)scope 156, 157transaction 157�������� 10

commitment definition 155, 157Common Programming Interface (CPI)

Communication, data management 156condition

definition 58management 141

bindable APIs (���������������������������������s) 162, 164

���������������������� 148Condition ID component of condition

token 147condition token 147

Case component 147Condition ID component 147Control component 147definition 58, 146Facility ID component 147feedback code on call to bindable API 149Message Number component 148Message Severity component 148MsgNo component 148MsgSev component 148Severity component 147testing 148���������������������� 148

Construct Condition Token (CEENCOD)bindable API 147

control boundaryactivation group

example 49default activation group example 50definition 49function check at 144unhandled exception at 144use 50

Control component of condition token 147control file syntax for IPA 177control flow

bindable APIs (���������������������������������s) 161

CPF9999 (function check) exceptionmessage 54

CPF9999 function check 52Create Heap (CEECRHP) bindable API 136Create Program (CRTPGM) command

ACTGRP (activation group) parameteractivation group creation 41program activation 38, 42

����� 255

Page 264: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Create Program (CRTPGM) command (���)ALWLIBUPD (Allow Library

Update) 111ALWUPD (Allow Update)

parameter 110, 111BNDDIR parameter 83compared to CRTSRVPGM (Create Service

Program) command 79DETAIL parameter

*BASIC value 209*EXTENDED value 211*FULL value 213

ENTMOD (entry module) parameter 90MODULE parameter 83output listing 209program creation 21service program activation 47

Create Service Program (CRTSRVPGM)command

ACTGRP (activation group) parameter*CALLER value 121program activation 38, 42

ALWLIBUPD (Allow Library Update)parameter 111

ALWUPD (Allow Update) parameter 111BNDDIR parameter 83compared to CRTPGM (Create Program)

command 79DETAIL parameter

*BASIC value 209*EXTENDED value 211*FULL value 213

EXPORT parameter 91, 92MODULE parameter 83output listing 209service program activation 47SRCFILE (source file) parameter 92SRCMBR (source member) parameter 92

creation ofdebug data 152module 114program 79, 114program activation 38��������������� 114

cross-reference listingservice program example 218

CRTPGMBNDSRVPGM parameter 84

CRTPGM (Create Program) commandcompared to CRTSRVPGM (Create Service

Program) command 79DETAIL parameter

*BASIC value 209

CRTPGM (Create Program) command (���)DETAIL parameter (���)

*EXTENDED value 211*FULL value 213

ENTMOD (entry module) parameter 90output listing 209program creation 21

CRTSRVPGMBNDSRVPGM parameter 84

CRTSRVPGM (Create Service Program)command

ACTGRP (activation group) parameter*CALLER value 121

compared to CRTPGM (Create Program)command 79

DETAIL parameter*BASIC value 209*EXTENDED value 211*FULL value 213

EXPORT parameter 91, 92output listing 209SRCFILE (source file) parameter 92SRCMBR (source member) parameter 92

cursorhandle 141resume 141

Ddata compatibility 129data links 156data management scoping

activation group level 60, 157call level 59, 119commitment definition 155Common Programming Interface (CPI)

Communication 156hierarchical file system 156job-level 61, 158local SQL (Structured Query Language)

cursor 155open data link 156open file management 156open file operation 155override 155remote SQL (Structured Query Language)

connection 156resource 155rules 59SQL (Structured Query Language)

cursors 155user interface manager (UIM) 156

data sharingoriginal program model (OPM) 14

datebindable APIs (����������������������

�����������s) 162debug data

creation 152definition 19removal 152

debug environmentILE 151OPM 151

debug modeaddition of programs 152definition 151

debug supportILE 154OPM 154

debuggerbindable APIs (����������������������

�����������s) 164considerations 151description 35������ CL (����������) 241

debuggingacross jobs 153bindable APIs (����������������������

�����������s) 164CCSID 290 154CCSID 65535 and device CHRID

290 154error handling 154globalization

restriction 154ILE program 21module view 153observability 152optimization 152unmonitored exception 154������ CL (����������) 241

default activation groupcontrol boundary example 50original program model (OPM) and ILE

programs 42teraspace 42

default exception handlingcompared to original program model

(OPM) 54default heap 134Define Heap Allocation Strategy (CEE4DAS)

bindable API 137deletion

activation group 44

256 IBM i: ������ ILE

Page 265: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

direct monitorexception handler type 56, 141

Discard Heap (CEEDSHP) bindableAPI 134, 136

Dispatch Message (CEEMOUT) bindableAPI 150

DSM (dynamic screen manager)bindable APIs (����������������������

�����������s) 165dynamic binding

original program model (OPM) 14dynamic program call

activation 128CALL CL (control language)

command 128call stack 123definition 29examples 29original program model (OPM) 13, 128program activation 38service program activation 46

dynamic screen manager (DSM)bindable APIs (����������������������

�����������s) 165dynamic storage 133

EEnabling program

collecting profiling data 168enabling programs for teraspace 64End Commitment Control (ENDCMTCTL)

command 157End Program Export (ENDPGMEXP)

command 97End Program Export (ENDPGMEXP), binder

language 95ENDCMTCTL (End Commitment Control)

command 157ENDPGMEXP (End Program Export), binder

language 95ENTMOD (entry module) parameter 90entry point

compared to ILE program entry procedure(PEP) 19

Extended Program Model (EPM) 14original program model (OPM) 13

EPM (Extended Program Model) 14error

binder language 218during optimization 237

error handlingarchitecture 33, 51bindable APIs (����������������������

�����������s) 162, 164debug mode 154default action 54, 144language specific 53nested exception 145priority example 57recovery 53resume point 53

error messageMCH4439 83

escape (*ESCAPE) exception messagetype 52

exception handlerpriority example 57types 55

exception handlingarchitecture 33, 51bindable APIs (����������������������

�����������s) 162, 164debug mode 154default action 54, 144language specific 53nested exception 145priority example 57recovery 53resume point 53

exception management 141exception message 52, 148

C signal 53CEE9901 (generic failure) 55CPF9999 (function check) 54debug mode 154function check (CPF9999) 54generic failure (CEE9901) 55handling 53ILE C raise() function 53percolation 54relationship of ILE conditions to 148sending 52types 52unmonitored 154

exportdefinition 18order 85strong 90, 93, 217weak 90, 93, 217

EXPORT (Export Symbol) 98EXPORT (Export Symbol), binder

language 95

EXPORT parameterservice program signature 92used with SRCFILE (source file) and

SRCMBR (source member)parameters 92

export symbolwildcard character 98

Export Symbol (EXPORT), binderlanguage 95

extended listing 211Extended Program Model (EPM) 14external message queue 52

FFacility ID component of condition token 147feedback code option

call to bindable API 149file system, data management 156Free Storage (CEEFRST) bindable API 136full listing 213function check

(CPF9999) exception message 54control boundary 144exception message type 52

Ggeneric failure (CEE9901) exception

message 55Get Heap Storage (CEEGTST) bindable

API 136Get Message (CEEMGET) bindable API 150Get String Information (CEEGSI) bindable

API 130Get, Format and Dispatch Message (CEEMSG)

bindable API 150globalization restriction for debugging 154

Hhandle cursor

definition 141heap

allocation strategy 135characteristics 133default 134definition 133user-created 134

heap allocation strategy 135Heap support 137

����� 257

Page 266: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

HLL specificerror handling 53exception handler 56, 141exception handling 53

IILE

basic concepts 17compared to

Extended Program Model (EPM) 15original program model (OPM) 15,

17definition 7history 13introduction 7program structure 18

importdefinition 19procedure 21resolved and unresolved 83strong 93weak 93

interlanguage data compatibility 129interprocedural analysis 175

IPA control file syntax 177partitions created by 181restrictions and limitations 180usage notes 180

Jjob

multiple applications running in same 117job message queue 52job-level scoping 61

Llanguage

procedure-basedcharacteristics 15

language interactionconsistent error handling 55control 11data compatibility 129

language specificerror handling 53exception handler 56, 141exception handling 53

level check parameter on STRPGMEXPcommand 98

Licensed Internal Code options(LICOPTs) 184

currently defined options 184displaying 191release compatibility 190restrictions 189specifying 189�������� 190

LICOPTs (Licensed Internal Codeoptions) 184

listing, binderbasic 209extended 211full 213service program example 216

MMark Heap (CEEMKHP) bindable API 135,

137math

bindable APIs (���������������������������������s) 162

maximum widthfile for SRCFILE (source file)

parameter 93MCH4439 error message 83message

bindable API feedback code 149exception types 52queue 52relationship of ILE conditions to 148

message handlingbindable APIs (����������������������

�����������s) 164Message Number (MsgNo) component of

condition token 148message queue

job 52Message Severity (MsgSev) component of

condition token 148modularity

����������� ILE 8module object

creation tips 114description 18������ CL (����������) 239

MODULE parameter on UPDPGMcommand 112

MODULE parameter on UPDSRVPGMcommand 112

module replaced by modulefewer exports 113fewer imports 112more exports 113more imports 112

module replacement 110module view

debugging 153Move Resume Cursor (CEEMRCR) bindable

API 143multiple applications running in same job 117

Nnested exception 145notify (*NOTIFY) exception message type 52

Oobservability 152ODP (open data path)

scoping 59omitted argument 128Open Data Base File (OPNDBF)

command 155open data path (ODP)

scoping 59open file operations 155Open Query File (OPNQRYF) command 155operational descriptor 129, 130OPM (original program model)

activation group 42binding 14characteristics 14compared to ILE 17, 20data sharing 14default exception handling 54description 13dynamic binding 14dynamic program call 128entry point 13exception handler types 56program entry point 13

OPNDBF (Open Data Base File)command 155

OPNQRYF (Open Query File) command 155optimization

codelevels 34module observability 152

258 IBM i: ������ ILE

Page 267: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

optimization (���)errors 237interprocedural analysis 175levels 152����������� ILE 12

optimization techniqueprofiling program 167

optimizing translator 12, 34optimizing your programs with IPA 177ordering concerns

storage access 205original program model (OPM)

activation group 42binding 14characteristics 14compared to ILE 17, 20data sharing 14default exception handling 54description 13dynamic binding 14dynamic program call 13, 128entry point 13exception handler types 56program entry point 13

output listingCreate Program (CRTPGM)

command 209Create Service Program (CRTSRVPGM)

command 209Update Program (UPDPGM)

command 209Update Service Program (UPDSRVPGM)

command 209override, data management 155

Pparameters on UPDPGM and UPDSRVPGM

commands 112partitions created by IPA 181passing arguments

between languages 129by reference 126by value directly 126by value indirectly 126in mixed-language applications 129omitted arguments 128to procedures 126to programs 128

PEP (program entry procedure)call stack example 123definition 19

PEP (program entry procedure) (���)specifying with CRTPGM (Create Program)

command 90percolation

exception message 54performance

optimizationerrors 237levels 34, 152module observability 152����������� ILE 12

pitfallsshared storage 201

priorityexception handler example 57

proceduredefinition 14, 18passing arguments to 126

procedure callbindable APIs (����������������������

�����������s) 164compared to program call 29, 123static

call stack 123definition 30examples 30

procedure pointer call 123, 125procedure-based language

characteristics 15profiling program 168profiling types 168program

access 90activation 37comparison of ILE and original program

model (OPM) 20creation

examples 86, 88tips 114��������� 79

passing arguments to 128������ CL (����������) 239

program activationactivation 38creation 38dynamic program call 38

program callbindable APIs (����������������������

�����������s) 164call stack 123compared to procedure call 123definition 29examples 29

program entry pointcompared to ILE program entry procedure

(PEP) 19Extended Program Model (EPM) 14original program model (OPM) 13

program entry procedure (PEP)call stack example 123definition 19specifying with CRTPGM (Create Program)

command 90program isolation in activation groups 39program level parameter on STRPGMEXP

command 97program structure 18program update 110

module replaced by modulefewer exports 113fewer imports 112more exports 113more imports 112

Promote Message (QMHPRMM) API 144

QQCAPCMD API 120QMHCHGEM (Change Exception Message)

API 143QMHPRMM (Promote Message) API 144QMHSNDPM (Send Program Message)

API 53, 141QUSEADPAUT (use adopted authority) system

valuedescription 80risk of changing 81

Rrace conditions 205RCLACTGRP (Reclaim Activation Group)

command 45, 120RCLRSC (Reclaim Resources)

command 118for ILE programs 120for OPM programs 120

Reallocate Storage (CEECZST) bindableAPI 136

Reclaim Activation Group (RCLACTGRP)command 45, 120

Reclaim Resources (RCLRSC)command 118

for ILE programs 120for OPM programs 120

����� 259

Page 268: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

recoveryexception handling 53

register exception handler 56Register User-Written Condition Handler

(CEEHDLR) bindable API 56, 141Release Heap (CEERLHP) bindable

API 135, 137removal of debug data 152resolved import 83resolving symbol

description 82examples 86, 88

resource control 9resource isolation in activation groups 39resource, data management 155restriction

debuggingglobalization 154

resume cursordefinition 141exception recovery 53

resume pointexception handling 53

Retrieve Binder Source (RTVBNDSRC)command 91

Retrieve Operational Descriptor Information(CEEDOD) bindable API 130

reuseactivation group 44���������� 8

rollback operationcommitment control 157

RPLLIB parameter on UPDPGMcommand 112

RPLLIB parameter on UPDSRVPGMcommand 112

runtime services 9

Sscope

commitment control 157scoping, data management

activation group level 60, 157call level 59, 119commitment definition 155Common Programming Interface (CPI)

Communication 156hierarchical file system 156job-level 61, 158local SQL (Structured Query Language)

cursor 155

scoping, data management (���)open data link 156open file management 156open file operation 155override 155remote SQL (Structured Query Language)

connection 156resource 155rules 59SQL (Structured Query Language)

cursors 155user interface manager (UIM) 156

Send Program Message (QMHSNDPM)API 53, 141

sendingexception message 52

Severity component of condition token 147shared storage 201

pitfalls 201shared storage access ordering 202shared storage synchronization 201Signal Condition (CEESGL) bindable API

condition token 147, 150description 53

signature 96EXPORT parameter 92

signature parameter on STRPGMEXPcommand 97

single-heap support 135single-level storage model 64specifying Licensed Internal Code options 189SQL (Structured Query Language)

connections, data management 156������ CL (����������) 241

SRCFILE (source file) parameter 92file

maximum width 93SRCMBR (source member) parameter 92SRVPGMLIB on UPDSRVPGM

command 112stack, call 123Start Commitment Control (STRCMTCTL)

command 155, 157Start Debug (STRDBG) command 151Start Program Export (STRPGMEXP)

command 97Start Program Export (STRPGMEXP), binder

language 95static procedure call

call stack 123definition 30examples 30, 125service program activation 48

static procedure call (���)��������������� 125

static storage 133static variable 37, 117status (*STATUS) exception message type 52storage

shared 201storage access

ordering concerns 205storage access ordering concerns 205storage management 133

automatic storage 133bindable APIs (����������������������

�����������s) 164dynamic storage 133heap 133static storage 118, 133

storage modelsingle-level storage 64teraspace 64

storage synchronization, shared 201storage synchronizing

actions 204storage synchronizing actions 204STRCMTCTL (Start Commitment Control)

command 155, 157STRDBG (Start Debug) command 151strong export 90, 93, 217STRPGMEXP (Start Program Export), binder

language 95structure of ILE program 18Structured Query Language (SQL)

connections, data management 156������ CL (����������) 241

support for original program model (OPM) andILE APIs 130

symbol namewildcard character 98

symbol resolutiondefinition 82examples 86, 88����� 85

system valueQUSEADPAUT (use adopted authority)

description 80risk of changing 81

use adopted authority (QUSEADPAUT)description 80risk of changing 81

system-named activation group 41, 44

260 IBM i: ������ ILE

Page 269: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

Tteraspace 63

allowed storage model for programtypes 65

characteristics 63choosing storage model 64enabling in your programs 64interaction of single-level storage and

teraspace storage models 66pointer conversions 70selecting compatible activation group 65specifying as storage model 64usage notes 71using 8-byte pointers 69������������������ ������������������

����� 68�������������������������������� 72

teraspace storage model 64Test for Omitted Argument (CEETSTA)

bindable API 128testing condition token 148thread local storage (TLS) 138time

bindable APIs (���������������������������������s) 162

tipmodule, program and service program

creation 114transaction

commitment control 157translator

code optimization 12, 34

UUEP (user entry procedure)

call stack example 123definition 19

unhandled exceptiondefault action 54

unmonitored exception 154Unregister User-Written Condition Handler

(CEEHDLU) bindable API 56unresolved import 83Update Program (UPDPGM) command 110Update Service Program (UPDSRVPGM)

command 110UPDPGM command

BNDDIR parameter 112BNDSRVPGM parameter 112MODULE parameter 112

UPDPGM command (���)RPLLIB parameter 112

UPDSRVPGM commandBNDDIR parameter 112BNDSRVPGM parameter 112MODULE parameter 112RPLLIB parameter 112

use adopted authority (QUSEADPAUT) systemvalue

description 80risk of changing 81

user entry procedure (UEP)call stack example 123definition 19

user interface manager (UIM), datamanagement 156

user-named activation groupdeletion 44description 41, 117

Vvariable

static 37, 117

Wwatch support 154weak export 90, 93, 217wildcard character for export symbol 98

������������������������ Licensed Internal

Code 190�������������

�������� 31����������������

����� 25

���������������� 9

bindable APIs (���������������������������������s) 164

considerations 151description 35������ CL (����������) 241

���������������activation 46, 125binder listing example 216

��������������� (���)creation tips 114definition 23description 16signature 92, 96static procedure call 125������ CL (����������) 240

������������������������ ILE

exception handler type 56, 141�������� shared open data path (ODP) 10

������������ ILE

binding 7code optimization 12coexistence with existing applications 9common runtime services 9language interaction control 11modularity 8resource control 9��������������� 9�������������������������� 8

�������������������� ILE 13

���������

comparing 8- and 16-byte 69conversions in teraspace-enabled

programs 70lengths 69support in C and C++ compilers 70������������� APIs 72

��������������������������������

error handling 51����������

����������������������� ILE 8

�������������� 85

������������� 118

����� 261

Page 270: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

���������������������������������� (API)

Abnormal End (CEE4ABN) 146activation group 161CEE4ABN (Abnormal End) 146CEEDOD (Retrieve Operational Descriptor

Information) 130CEEGSI (Get String Information) 130CEEHDLR (Register User-Written

Condition Handler) 56, 141CEEHDLU (Unregister User-Written

Condition Handler) 56CEEMGET (Get Message) 150CEEMOUT (Dispatch Message) 150CEEMRCR (Move Resume Cursor) 143CEEMSG (Get, Format and Dispatch

Message) 150CEENCOD (Construct Condition

Token) 147CEESGL (Signal Condition)

condition token 147, 150description 53

CEETSTA (Test for OmittedArgument) 128

Change Exception Message(QMHCHGEM) 143

condition management 162, 164Construct Condition Token

(CEENCOD) 147control flow 161date 162debugger 164Dispatch Message (CEEMOUT) 150dynamic screen manager (DSM) 165error handling 164exception management 162, 164Get Message (CEEMGET) 150Get String Information (CEEGSI) 130Get, Format and Dispatch Message

(CEEMSG) 150HLL independence 161list of 161, 165math 162message handling 164Move Resume Cursor (CEEMRCR) 143naming conventions 161original program model (OPM) and

ILE 130procedure call 164program call 164Promote Message (QMHPRMM) 144

��������������������������������� (API)(���)

QMHCHGEM (Change ExceptionMessage) 143

QMHPRMM (Promote Message) 144QMHSNDPM (Send Program

Message) 53, 141Register User-Written Condition Handler

(CEEHDLR) 56, 141Retrieve Operational Descriptor Information

(CEEDOD) 130Send Program Message

(QMHSNDPM) 53, 141Signal Condition (CEESGL)

condition token 147, 150description 53

storage management 164supplementing HLL-specific runtime

library 161Test for Omitted Argument

(CEETSTA) 128time 162Unregister User-Written Condition Handler

(CEEHDLU) 56��������������� 164

262 IBM i: ������ ILE

Page 271: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������� — ������������������������������

IBM iProgramming������ ILE�������� 7.3

������������������ SC41-5606-11

�����������������������. ��������������������������������������? h Yes h No

��������������������������� IBM, �������������������������������������������������������������������������������������� ��� IBM

������������� ��������������������������������� ��������.

���� �������

����������������

���������������

Page 272: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

��������������������� — ������������������������������

SC41-5606-11

SC41-5606-11

IBM�����������������

�����������������

������������� ������������������������� �������������

������������� ������������������������� �������������

�����������

����������������

IBM CORPORATIONAttn Bldg 004-2 ID Clerk3605 HWY 52 NRochester, MNUSA55901-7829

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

__

_

Page 273: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,
Page 274: IBM i: @05B1@05E2@0594@05F4@0581@05E1 ILE...3. Integrated Language Environment Introduction Integrated Language Environment (ILE), ILE,

IBM®

��������������: 5770-SS1

�������������������

SC41-5606-11