File: AA-B-4.html

package info (click to toggle)
ada-reference-manual 20021112web-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 18,652 kB
  • ctags: 8,921
  • sloc: makefile: 52; sh: 20
file content (652 lines) | stat: -rw-r--r-- 57,056 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
    <TITLE>AARM95 - Interfacing with COBOL</TITLE>
    <META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
    <META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
    <STYLE type="text/css">
    DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
    TT {font-family: "Courier New", monospace}
    DT {display: compact}
    DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
    DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Index {font-family: "Times New Roman", Times, serif}
    DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
    DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
    DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left:  10.0em; margin-bottom: 0.6em}
    DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
    DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left:  15.0em; margin-bottom: 0.6em}
    UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
    DD.Hanging {margin-left: 6.0em}
    DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.IndentedHanging {margin-left: 2.0em}
    DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.HangingInBulleted {margin-left: 4.0em}
    DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallHanging {margin-left: 7.5em}
    DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallIndentedHanging {margin-left: 2.0em}
    DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallHangingInBulleted {margin-left: 5.0em}
    DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.Enumerated {margin-left: 2.0em}
    DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallEnumerated {margin-left: 2.5em}
    DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    </STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-B-3-2.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-B-5.html">Next</A></P>
<HR>
<H1> B.4 Interfacing with COBOL</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I6493"></A><A NAME="I6494"></A>The facilities
relevant to interfacing with the COBOL language are the package Interfaces.COBOL
and support for the Import, Export and Convention pragmas with <I>convention</I>_<FONT FACE="Arial, Helvetica">identifier</FONT>
COBOL.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;The COBOL interface
package supplies several sets of facilities: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>A set of types corresponding to the native COBOL types
of the supported COBOL implementation (so-called ``internal COBOL representations''),
allowing Ada data to be passed as parameters to COBOL programs</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>A set of types and constants reflecting external data representations
such as might be found in files or databases, allowing COBOL-generated
data to be read by an Ada program, and Ada-generated data to be read
by COBOL programs</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>A generic package for converting between an Ada decimal
type value and either an internal or external COBOL representation </LI></UL>

<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;The library package
Interfaces.COBOL has the following declaration: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Examples"><TT><B>package</B>&nbsp;Interfaces.COBOL&nbsp;<B>is</B><A NAME="I6495"></A><A NAME="I6496"></A><A NAME="I6497"></A><BR>
&nbsp;&nbsp;&nbsp;<B>pragma</B>&nbsp;Preelaborate(COBOL);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Examples"><TT><I>--&nbsp;Types&nbsp;and&nbsp;operations&nbsp;for&nbsp;internal&nbsp;data&nbsp;representations</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6498"></A><A NAME="I6499"></A>Floating&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>is</B>&nbsp;<B>digits</B>&nbsp;<I>implementation-defined</I>;<BR>
&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6500"></A><A NAME="I6501"></A>Long_Floating&nbsp;<B>is</B>&nbsp;<B>digits</B>&nbsp;<I>implementation-defined</I>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6502"></A><A NAME="I6503"></A>Binary&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>is</B>&nbsp;<B>range</B>&nbsp;<I>implementation-defined</I>;<BR>
&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6504"></A><A NAME="I6505"></A>Long_Binary&nbsp;<B>is</B>&nbsp;<B>range</B>&nbsp;<I>implementation-defined</I>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<A NAME="I6506"></A>Max_Digits_Binary&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>constant</B>&nbsp;:=&nbsp;<I>implementation-defined</I>;<BR>
&nbsp;&nbsp;&nbsp;<A NAME="I6507"></A>Max_Digits_Long_Binary&nbsp;:&nbsp;<B>constant</B>&nbsp;:=&nbsp;<I>implementation-defined</I>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6508"></A><A NAME="I6509"></A>Decimal_Element&nbsp;&nbsp;<B>is</B>&nbsp;<B>mod</B>&nbsp;<I>implementation-defined</I>;<BR>
&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6510"></A><A NAME="I6511"></A>Packed_Decimal&nbsp;<B>is</B>&nbsp;<B>array</B>&nbsp;(Positive&nbsp;<B>range</B>&nbsp;&lt;&gt;)&nbsp;<B>of</B>&nbsp;Decimal_Element;<BR>
&nbsp;&nbsp;&nbsp;<B>pragma</B>&nbsp;Pack(Packed_Decimal);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6512"></A><A NAME="I6513"></A>COBOL_Character&nbsp;<B>is</B>&nbsp;<I>implementation-defined&nbsp;character&nbsp;type</I>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<A NAME="I6514"></A>Ada_To_COBOL&nbsp;:&nbsp;<B>array</B>&nbsp;(Character)&nbsp;<B>of</B>&nbsp;COBOL_Character&nbsp;:=&nbsp;<I>implementation-defined</I>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<A NAME="I6515"></A>COBOL_To_Ada&nbsp;:&nbsp;<B>array</B>&nbsp;(COBOL_Character)&nbsp;<B>of</B>&nbsp;Character&nbsp;:=&nbsp;<I>implementation-defined</I>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6516"></A><A NAME="I6517"></A>Alphanumeric&nbsp;<B>is</B>&nbsp;<B>array</B>&nbsp;(Positive&nbsp;range&nbsp;&lt;&gt;)&nbsp;<B>of</B>&nbsp;COBOL_Character;<BR>
&nbsp;&nbsp;&nbsp;<B>pragma</B>&nbsp;Pack(Alphanumeric);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6518"></A><A NAME="I6519"></A>To_COBOL&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;String)&nbsp;<B>return</B>&nbsp;Alphanumeric;<BR>
&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6520"></A><A NAME="I6521"></A>To_Ada&nbsp;&nbsp;&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;Alphanumeric)&nbsp;<B>return</B>&nbsp;String;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>procedure</B>&nbsp;<A NAME="I6522"></A><A NAME="I6523"></A>To_COBOL&nbsp;(Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;String;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>out</B>&nbsp;Alphanumeric;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>out</B>&nbsp;Natural);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>procedure</B>&nbsp;<A NAME="I6524"></A><A NAME="I6525"></A>To_Ada&nbsp;(Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Alphanumeric;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Target&nbsp;&nbsp;&nbsp;:&nbsp;<B>out</B>&nbsp;String;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>out</B>&nbsp;Natural);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6526"></A><A NAME="I6527"></A>Numeric&nbsp;<B>is</B>&nbsp;<B>array</B>&nbsp;(Positive&nbsp;<B>range</B>&nbsp;&lt;&gt;)&nbsp;<B>of</B>&nbsp;COBOL_Character;<BR>
&nbsp;&nbsp;&nbsp;<B>pragma</B>&nbsp;Pack(Numeric);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DIV Class="Examples"><TT><I>--&nbsp;Formats&nbsp;for&nbsp;COBOL&nbsp;data&nbsp;representations</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6528"></A><A NAME="I6529"></A>Display_Format&nbsp;<B>is</B>&nbsp;<B>private</B>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<A NAME="I6530"></A>Unsigned&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>constant</B>&nbsp;Display_Format;<BR>
&nbsp;&nbsp;&nbsp;<A NAME="I6531"></A>Leading_Separate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>constant</B>&nbsp;Display_Format;<BR>
&nbsp;&nbsp;&nbsp;<A NAME="I6532"></A>Trailing_Separate&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>constant</B>&nbsp;Display_Format;<BR>
&nbsp;&nbsp;&nbsp;<A NAME="I6533"></A>Leading_Nonseparate&nbsp;&nbsp;:&nbsp;<B>constant</B>&nbsp;Display_Format;<BR>
&nbsp;&nbsp;&nbsp;<A NAME="I6534"></A>Trailing_Nonseparate&nbsp;:&nbsp;<B>constant</B>&nbsp;Display_Format;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6535"></A><A NAME="I6536"></A>Binary_Format&nbsp;<B>is</B>&nbsp;<B>private</B>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<A NAME="I6537"></A>High_Order_First&nbsp;&nbsp;:&nbsp;<B>constant</B>&nbsp;Binary_Format;<BR>
&nbsp;&nbsp;&nbsp;<A NAME="I6538"></A>Low_Order_First&nbsp;&nbsp;&nbsp;:&nbsp;<B>constant</B>&nbsp;Binary_Format;<BR>
&nbsp;&nbsp;&nbsp;<A NAME="I6539"></A>Native_Binary&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>constant</B>&nbsp;Binary_Format;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6540"></A><A NAME="I6541"></A>Packed_Format&nbsp;<B>is</B>&nbsp;<B>private</B>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<A NAME="I6542"></A>Packed_Unsigned&nbsp;&nbsp;&nbsp;:&nbsp;<B>constant</B>&nbsp;Packed_Format;<BR>
&nbsp;&nbsp;&nbsp;<A NAME="I6543"></A>Packed_Signed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<B>constant</B>&nbsp;Packed_Format;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Examples"><TT><I>--&nbsp;Types&nbsp;for&nbsp;external&nbsp;representation&nbsp;of&nbsp;COBOL&nbsp;binary&nbsp;data</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6544"></A><A NAME="I6545"></A>Byte&nbsp;<B>is</B>&nbsp;<B>mod</B>&nbsp;2**COBOL_Character'Size;<BR>
&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;<A NAME="I6546"></A><A NAME="I6547"></A>Byte_Array&nbsp;<B>is</B>&nbsp;<B>array</B>&nbsp;(Positive&nbsp;<B>range</B>&nbsp;&lt;&gt;)&nbsp;<B>of</B>&nbsp;Byte;<BR>
&nbsp;&nbsp;&nbsp;<B>pragma</B>&nbsp;Pack&nbsp;(Byte_Array);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<A NAME="I6548"></A>Conversion_Error&nbsp;:&nbsp;<B>exception</B>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>generic</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;Num&nbsp;<B>is</B>&nbsp;<B>delta</B>&nbsp;&lt;&gt;&nbsp;<B>digits</B>&nbsp;&lt;&gt;;<BR>
&nbsp;&nbsp;&nbsp;<B>package</B>&nbsp;Decimal_Conversions&nbsp;<B>is</B></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>32</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;Display&nbsp;Formats:&nbsp;data&nbsp;values&nbsp;are&nbsp;represented&nbsp;as&nbsp;Numeric</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>33</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6549"></A><A NAME="I6550"></A>Valid&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Numeric;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Display_Format)&nbsp;<B>return</B>&nbsp;Boolean;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6551"></A><A NAME="I6552"></A>Length&nbsp;(Format&nbsp;:&nbsp;<B>in</B>&nbsp;Display_Format)&nbsp;<B>return</B>&nbsp;Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>35</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6553"></A><A NAME="I6554"></A>To_Decimal&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Numeric;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Display_Format)&nbsp;<B>return</B>&nbsp;Num;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>36</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6555"></A><A NAME="I6556"></A>To_Display&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Num;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Display_Format)&nbsp;<B>return</B>&nbsp;Numeric;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>37</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;Packed&nbsp;Formats:&nbsp;data&nbsp;values&nbsp;are&nbsp;represented&nbsp;as&nbsp;Packed_Decimal</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>38</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6557"></A><A NAME="I6558"></A>Valid&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Packed_Decimal;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Packed_Format)&nbsp;<B>return</B>&nbsp;Boolean;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>39</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6559"></A><A NAME="I6560"></A>Length&nbsp;(Format&nbsp;:&nbsp;<B>in</B>&nbsp;Packed_Format)&nbsp;<B>return</B>&nbsp;Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>40</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6561"></A><A NAME="I6562"></A>To_Decimal&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Packed_Decimal;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Packed_Format)&nbsp;<B>return</B>&nbsp;Num;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>41</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6563"></A><A NAME="I6564"></A>To_Packed&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Num;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Packed_Format)&nbsp;<B>return</B>&nbsp;Packed_Decimal;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>42</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;Binary&nbsp;Formats:&nbsp;external&nbsp;data&nbsp;values&nbsp;are&nbsp;represented&nbsp;as&nbsp;Byte_Array</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>43</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6565"></A><A NAME="I6566"></A>Valid&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Byte_Array;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Binary_Format)&nbsp;<B>return</B>&nbsp;Boolean;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>44</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6567"></A><A NAME="I6568"></A>Length&nbsp;(Format&nbsp;:&nbsp;<B>in</B>&nbsp;Binary_Format)&nbsp;<B>return</B>&nbsp;Natural;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6569"></A><A NAME="I6570"></A>To_Decimal&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Byte_Array;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Binary_Format)&nbsp;<B>return</B>&nbsp;Num;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>45</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6571"></A><A NAME="I6572"></A>To_Binary&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Num;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Binary_Format)&nbsp;<B>return</B>&nbsp;Byte_Array;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>46</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;Internal&nbsp;Binary&nbsp;formats:&nbsp;data&nbsp;values&nbsp;are&nbsp;of&nbsp;type&nbsp;Binary&nbsp;or&nbsp;Long_Binary</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>47</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6573"></A><A NAME="I6574"></A>To_Decimal&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;Binary)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>return</B>&nbsp;Num;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6575"></A><A NAME="I6576"></A>To_Decimal&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;Long_Binary)&nbsp;<B>return</B>&nbsp;Num;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>48</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6577"></A><A NAME="I6578"></A>To_Binary&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;Num)&nbsp;&nbsp;<B>return</B>&nbsp;Binary;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>function</B>&nbsp;<A NAME="I6579"></A><A NAME="I6580"></A>To_Long_Binary&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;Num)&nbsp;&nbsp;<B>return</B>&nbsp;Long_Binary;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>49</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>end</B>&nbsp;Decimal_Conversions;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>50</FONT></DIV>
<DIV Class="Examples"><TT><B>private</B><BR>
&nbsp;&nbsp;&nbsp;...&nbsp;--&nbsp;<I>not&nbsp;specified&nbsp;by&nbsp;the&nbsp;language</I><BR>
<B>end</B>&nbsp;Interfaces.COBOL;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>50.a/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation defined: </B>The
types Floating, Long_Floating, Binary, Long_Binary, Decimal_Element,
and COBOL_Character; and the initializations of the variables Ada_To_COBOL
and COBOL_To_Ada, in Interfaces.COBOL<U>.</U></FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>51</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;Each of the types in Interfaces.COBOL is COBOL-compatible.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>52</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;The types Floating and Long_Floating correspond
to the native types in COBOL for data items with computational usage
implemented by floating point. The types Binary and Long_Binary correspond
to the native types in COBOL for data items with binary usage, or with
computational usage implemented by binary.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>53</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;Max_Digits_Binary is the largest number of decimal
digits in a numeric value that is represented as Binary. Max_Digits_Long_Binary
is the largest number of decimal digits in a numeric value that is represented
as Long_Binary.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>54</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;The type Packed_Decimal corresponds to COBOL's
packed-decimal usage.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>55</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;The type COBOL_Character defines the run-time
character set used in the COBOL implementation. Ada_To_COBOL and COBOL_To_Ada
are the mappings between the Ada and COBOL run-time character sets. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>55.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>The character mappings
are visible variables, since the user needs the ability to modify them
at run time. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>56</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;Type Alphanumeric corresponds to COBOL's alphanumeric
data category.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>57</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;Each of the functions To_COBOL and To_Ada converts
its parameter based on the mappings Ada_To_COBOL and COBOL_To_Ada, respectively.
The length of the result for each is the length of the parameter, and
the lower bound of the result is 1. Each component of the result is obtained
by applying the relevant mapping to the corresponding component of the
parameter.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>58</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;Each of the procedures To_COBOL and To_Ada copies
converted elements from Item to Target, using the appropriate mapping
(Ada_To_COBOL or COBOL_To_Ada, respectively). The index in Target of
the last element assigned is returned in Last (0 if Item is a null array).
<A NAME="I6581"></A>If Item'Length exceeds Target'Length, Constraint_Error
is propagated.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>59</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;Type Numeric corresponds to COBOL's numeric data
category with display usage.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>60</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.9em">&nbsp;&nbsp;&nbsp;&nbsp;The types Display_Format,
Binary_Format, and Packed_Format are used in conversions between Ada
decimal type values and COBOL internal or external data representations.
The value of the constant Native_Binary is either High_Order_First or
Low_Order_First, depending on the implementation. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>61</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B>&nbsp;Valid&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Numeric;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Display_Format)&nbsp;<B>return</B>&nbsp;Boolean;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>62</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.4em">The function
Valid checks that the Item parameter has a value consistent with the
value of Format. If the value of Format is other than Unsigned, Leading_Separate,
and Trailing_Separate, the effect is implementation defined. If Format
does have one of these values, the following rules apply: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>63/1</FONT></DIV>
<UL Class="CodeIndentedBulleted"><LI TYPE=DISC>{<I><A HREF="defect1.html#8652/0066">8652/0066</A></I>}
Format=Unsigned: if Item comprises <S>zero or more leading space characters
followed by </S>one or more decimal digit characters then Valid returns
True, else it returns False.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>64/1</FONT></DIV>
<UL Class="CodeIndentedBulleted"><LI TYPE=DISC>{<I><A HREF="defect1.html#8652/0066">8652/0066</A></I>}
Format=Leading_Separate: if Item comprises <S>zero or more leading space
characters, followed by </S>a single occurrence of the plus or minus
sign character, and then one or more decimal digit characters, then Valid
returns True, else it returns False.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>65/1</FONT></DIV>
<UL Class="CodeIndentedBulleted"><LI TYPE=DISC>{<I><A HREF="defect1.html#8652/0066">8652/0066</A></I>}
Format=Trailing_Separate: if Item comprises <S>zero or more leading space
characters, followed by </S>one or more decimal digit characters and
finally a plus or minus sign character, then Valid returns True, else
it returns False. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>66</FONT></DIV>
<DIV Class="Examples" Style="margin-bottom: 0.9em"><TT><B>function</B>&nbsp;Length&nbsp;(Format&nbsp;:&nbsp;<B>in</B>&nbsp;Display_Format)&nbsp;<B>return</B>&nbsp;Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>67</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">The Length function
returns the minimal length of a Numeric value sufficient to hold any
value of type Num when represented as Format.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>68</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B>&nbsp;To_Decimal&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Numeric;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Display_Format)&nbsp;<B>return</B>&nbsp;Num;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>69</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Produces a value
of type Num corresponding to Item as represented by Format. The number
of digits after the assumed radix point in Item is Num'Scale. Conversion_Error
is propagated if the value represented by Item is outside the range of
Num. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>69.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>There is no
issue of truncation versus rounding, since the number of decimal places
is established by Num'Scale.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>70</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B>&nbsp;To_Display&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Num;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Display_Format)&nbsp;<B>return</B>&nbsp;Numeric;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>71/1</FONT></DIV>
<DIV Class="CodeIndented">{<I><A HREF="defect1.html#8652/0067">8652/0067</A></I>}
This function returns the Numeric value for Item, represented in accordance
with Format. <U>The length of the returned value is Length(Format), and
the lower bound is 1. </U>Conversion_Error is propagated if Num is negative
and Format is Unsigned.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>72</FONT></DIV>
<DIV Class="Examples" Style="margin-bottom: 0.9em"><TT><B>function</B>&nbsp;Valid&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Packed_Decimal;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Packed_Format)&nbsp;<B>return</B>&nbsp;Boolean;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>73</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">This function
returns True if Item has a value consistent with Format, and False otherwise.
The rules for the formation of Packed_Decimal values are implementation
defined.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>74</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B>&nbsp;Length&nbsp;(Format&nbsp;:&nbsp;<B>in</B>&nbsp;Packed_Format)&nbsp;<B>return</B>&nbsp;Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>75</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">This function
returns the minimal length of a Packed_Decimal value sufficient to hold
any value of type Num when represented as Format.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>76</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B>&nbsp;To_Decimal&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Packed_Decimal;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Packed_Format)&nbsp;<B>return</B>&nbsp;Num;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>77</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Produces a value
of type Num corresponding to Item as represented by Format. Num'Scale
is the number of digits after the assumed radix point in Item. Conversion_Error
is propagated if the value represented by Item is outside the range of
Num.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>78</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B>&nbsp;To_Packed&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Num;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Packed_Format)&nbsp;<B>return</B>&nbsp;Packed_Decimal;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>79/1</FONT></DIV>
<DIV Class="CodeIndented">{<I><A HREF="defect1.html#8652/0067">8652/0067</A></I>}
This function returns the Packed_Decimal value for Item, represented
in accordance with Format. <U>The length of the returned value is Length(Format),
and the lower bound is 1. </U>Conversion_Error is propagated if Num is
negative and Format is Packed_Unsigned.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>80</FONT></DIV>
<DIV Class="Examples" Style="margin-bottom: 0.9em"><TT><B>function</B>&nbsp;Valid&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Byte_Array;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Binary_Format)&nbsp;<B>return</B>&nbsp;Boolean;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>81</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">This function
returns True if Item has a value consistent with Format, and False otherwise.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>81.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>This function
returns False only when the represented value is outside the range of
Num.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>82</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B>&nbsp;Length&nbsp;(Format&nbsp;:&nbsp;<B>in</B>&nbsp;Binary_Format)&nbsp;<B>return</B>&nbsp;Natural;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>83</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">This function
returns the minimal length of a Byte_Array value sufficient to hold any
value of type Num when represented as Format.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>84</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B>&nbsp;To_Decimal&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Byte_Array;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Binary_Format)&nbsp;<B>return</B>&nbsp;Num;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>85</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">Produces a value
of type Num corresponding to Item as represented by Format. Num'Scale
is the number of digits after the assumed radix point in Item. Conversion_Error
is propagated if the value represented by Item is outside the range of
Num.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>86</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B>&nbsp;To_Binary&nbsp;(Item&nbsp;&nbsp;&nbsp;:&nbsp;<B>in</B>&nbsp;Num;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Format&nbsp;:&nbsp;<B>in</B>&nbsp;Binary_Format)&nbsp;<B>return</B>&nbsp;Byte_Array;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>87/1</FONT></DIV>
<DIV Class="CodeIndented">{<I><A HREF="defect1.html#8652/0067">8652/0067</A></I>}
This function returns the Byte_Array value for Item, represented in accordance
with Format. <U>The length of the returned value is Length(Format), and
the lower bound is 1.</U></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>88</FONT></DIV>
<DIV Class="Examples" Style="margin-bottom: 0.9em"><TT><B>function</B>&nbsp;To_Decimal&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;Binary)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>return</B>&nbsp;Num;<BR>
<BR>
<B>function</B>&nbsp;To_Decimal&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;Long_Binary)&nbsp;<B>return</B>&nbsp;Num;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>89</FONT></DIV>
<DIV Class="CodeIndented" Style="margin-bottom: 0.9em">These functions
convert from COBOL binary format to a corresponding value of the decimal
type Num. Conversion_Error is propagated if Item is too large for Num.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>89.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>There is
no rescaling performed on the conversion. That is, the returned value
in each case is a ``bit copy'' if Num has a binary radix. The programmer
is responsible for maintaining the correct scale. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>90</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B>&nbsp;To_Binary&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;Num)&nbsp;&nbsp;<B>return</B>&nbsp;Binary;<BR>
<BR>
<B>function</B>&nbsp;To_Long_Binary&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;Num)&nbsp;&nbsp;<B>return</B>&nbsp;Long_Binary;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>91</FONT></DIV>
<DIV Class="CodeIndented">These functions convert from Ada decimal to
COBOL binary format. Conversion_Error is propagated if the value of Item
is too large to be represented in the result type. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>91.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>One style of
interface supported for COBOL, similar to what is provided for C, is
the ability to call and pass parameters to an existing COBOL program.
Thus the interface package supplies types that can be used in an Ada
program as parameters to subprograms whose bodies will be in COBOL. These
types map to COBOL's alphanumeric and numeric data categories.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>91.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Several types are provided for
support of alphanumeric data. Since COBOL's run-time character set is
not necessarily the same as Ada's, Interfaces.COBOL declares an implementation-defined
character type COBOL_Character, and mappings between Character and COBOL_Character.
These mappings are visible variables (rather than, say, functions or
constant arrays), since in the situation where COBOL_Character is EBCDIC,
the flexibility of dynamically modifying the mappings is needed. Corresponding
to COBOL's alphanumeric data is the string type Alphanumeric.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>91.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Numeric data may have either a
``display'' or ``computational'' representation in COBOL. On the Ada
side, the data is of a decimal fixed point type. Passing an Ada decimal
data item to a COBOL program requires conversion from the Ada decimal
type to some type that reflects the representation expected on the COBOL
side. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>91.d</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Computational Representation</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>91.e</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1>Floating point representation
is modeled by Ada floating point types, Floating and Long_Floating. Conversion
between these types and Ada decimal types is obtained directly, since
the type name serves as a conversion function.</FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>91.f</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1>Binary representation is modeled
by an Ada integer type, Binary, and possibly other types such as Long_Binary.
Conversion between, say, Binary and a decimal type is through functions
from an instantiation of the generic package Decimal_Conversions.</FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>91.g</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1>Packed decimal representation
is modeled by the Ada array type Packed_Decimal. Conversion between packed
decimal and a decimal type is through functions from an instantiation
of the generic package Decimal_Conversions.</FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>91.h</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Display Representation</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>91.i</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1>Display representation for numeric
data is modeled by the array type Numeric. Conversion between display
representation and a decimal type is through functions from an instantiation
of the generic package Decimal_Conversions. A parameter to the conversion
function indicates the desired interpretation of the data (e.g., signed
leading separate, etc.) </FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>91.j</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Pragma Convention(COBOL, T) may
be applied to a record type T to direct the compiler to choose a COBOL-compatible
representation for objects of the type.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>91.k</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The package Interfaces.COBOL allows
the Ada programmer to deal with data from files (or databases) created
by a COBOL program. For data that is alphanumeric, or in display or packed
decimal format, the approach is the same as for passing parameters (instantiate
Decimal_Conversions to obtain the needed conversion functions). For binary
data, the external representation is treated as a Byte array, and an
instantiation of Decimal_IO produces a package that declares the needed
conversion functions. A parameter to the conversion function indicates
the desired interpretation of the data (e.g., high- versus low-order
byte first). </FONT></DIV>

<H4 ALIGN=CENTER>Implementation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>92</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;An implementation shall support pragma Convention
with a COBOL <I>convention</I>_<FONT FACE="Arial, Helvetica">identifier</FONT>
for a COBOL-eligible type (see <A HREF="AA-B-1.html">B.1</A>). </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>92.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>An implementation
supporting this package shall ensure that if the bounds of a Packed_Decimal,
Alphanumeric, or Numeric variable are static, then the representation
of the object comprises solely the array components (that is, there is
no implicit run-time ``descriptor'' that is part of the object). </FONT></DIV>

<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>93</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;An implementation may provide additional constants
of the private types Display_Format, Binary_Format, or Packed_Format.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>93.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>This is to allow
exploitation of other external formats that may be available in the COBOL
implementation.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>94</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;An implementation may provide further floating
point and integer types in Interfaces.COBOL to match additional native
COBOL types, and may also supply corresponding conversion functions in
the generic package Decimal_Conversions. </DIV>

<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>95</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;An Ada implementation should support the following
interface correspondences between Ada and COBOL. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>96</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An Ada <B>access</B> T parameter is passed as a ``BY REFERENCE''
data item of the COBOL type corresponding to T.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>97</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An Ada <B>in</B> scalar parameter is passed as a ``BY CONTENT''
data item of the corresponding COBOL type.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>98</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Any other Ada parameter is passed as a ``BY REFERENCE''
data item of the COBOL type corresponding to the Ada parameter type;
for scalars, a local copy is used if necessary to ensure by-copy semantics.
</LI></UL>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>99</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>15&nbsp;&nbsp;An implementation is not
required to support pragma Convention for access types, nor is it required
to support pragma Import, Export or Convention for functions. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>99.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>COBOL does not
have a pointer facility, and a COBOL program does not return a value.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>100</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>16&nbsp;&nbsp;If an Ada subprogram is
exported to COBOL, then a call from COBOL call may specify either ``BY
CONTENT'' or ``BY REFERENCE''. </FONT></DIV>

<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>101</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>Examples of
Interfaces.COBOL:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>102</FONT></DIV>
<DIV Class="Examples"><TT><B>with</B>&nbsp;Interfaces.COBOL;<BR>
<B>procedure</B>&nbsp;Test_Call&nbsp;<B>is</B></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>103</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<I>--&nbsp;Calling&nbsp;a&nbsp;foreign&nbsp;COBOL&nbsp;program</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;Assume&nbsp;that&nbsp;a&nbsp;COBOL&nbsp;program&nbsp;PROG&nbsp;has&nbsp;the&nbsp;following&nbsp;declaration</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;in&nbsp;its&nbsp;LINKAGE&nbsp;section:</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;01&nbsp;Parameter-Area</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;05&nbsp;NAME&nbsp;&nbsp;&nbsp;PIC&nbsp;X(20).</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;05&nbsp;SSN&nbsp;&nbsp;&nbsp;&nbsp;PIC&nbsp;X(9).</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;05&nbsp;SALARY&nbsp;PIC&nbsp;99999V99&nbsp;USAGE&nbsp;COMP.</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;The&nbsp;effect&nbsp;of&nbsp;PROG&nbsp;is&nbsp;to&nbsp;update&nbsp;SALARY&nbsp;based&nbsp;on&nbsp;some&nbsp;algorithm</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>104</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>package</B>&nbsp;COBOL&nbsp;<B>renames</B>&nbsp;Interfaces.COBOL;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>105</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;Salary_Type&nbsp;<B>is</B>&nbsp;<B>delta</B>&nbsp;0.01&nbsp;<B>digits</B>&nbsp;7;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>106</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;COBOL_Record&nbsp;<B>is</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>record</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;&nbsp;&nbsp;:&nbsp;COBOL.Numeric(1..20);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SSN&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;COBOL.Numeric(1..9);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Salary&nbsp;:&nbsp;COBOL.Binary;&nbsp;&nbsp;<I>--&nbsp;Assume&nbsp;Binary&nbsp;=&nbsp;32&nbsp;bits</I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>end</B>&nbsp;<B>record</B>;<BR>
&nbsp;&nbsp;&nbsp;<B>pragma</B>&nbsp;Convention&nbsp;(COBOL,&nbsp;COBOL_Record);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>107</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>procedure</B>&nbsp;Prog&nbsp;(Item&nbsp;:&nbsp;<B>in</B>&nbsp;<B>out</B>&nbsp;COBOL_Record);<BR>
&nbsp;&nbsp;&nbsp;<B>pragma</B>&nbsp;Import&nbsp;(COBOL,&nbsp;Prog,&nbsp;&quot;PROG&quot;);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>108</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>package</B>&nbsp;Salary_Conversions&nbsp;<B>is</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>new</B>&nbsp;COBOL.Decimal_Conversions(Salary_Type);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>109</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;Some_Salary&nbsp;:&nbsp;Salary_Type&nbsp;:=&nbsp;12_345.67;<BR>
&nbsp;&nbsp;&nbsp;Some_Record&nbsp;:&nbsp;COBOL_Record&nbsp;:=<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Name&nbsp;&nbsp;&nbsp;=&gt;&nbsp;&quot;Johnson,&nbsp;John&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SSN&nbsp;&nbsp;&nbsp;&nbsp;=&gt;&nbsp;&quot;111223333&quot;,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Salary&nbsp;=&gt;&nbsp;Salary_Conversions.To_Binary(Some_Salary));</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>110</FONT></DIV>
<DIV Class="Examples"><TT><B>begin</B><BR>
&nbsp;&nbsp;&nbsp;Prog&nbsp;(Some_Record);<BR>
&nbsp;&nbsp;&nbsp;...<BR>
<B>end</B>&nbsp;Test_Call;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>111</FONT></DIV>
<DIV Class="Examples"><TT><B>with</B>&nbsp;Interfaces.COBOL;<BR>
<B>with</B>&nbsp;COBOL_Sequential_IO;&nbsp;<I>--&nbsp;Assumed&nbsp;to&nbsp;be&nbsp;supplied&nbsp;by&nbsp;implementation</I><BR>
<B>procedure</B>&nbsp;Test_External_Formats&nbsp;<B>is</B></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>112</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<I>--&nbsp;Using&nbsp;data&nbsp;created&nbsp;by&nbsp;a&nbsp;COBOL&nbsp;program</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;Assume&nbsp;that&nbsp;a&nbsp;COBOL&nbsp;program&nbsp;has&nbsp;created&nbsp;a&nbsp;sequential&nbsp;file&nbsp;with</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;the&nbsp;following&nbsp;record&nbsp;structure,&nbsp;and&nbsp;that&nbsp;we&nbsp;need&nbsp;to</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;process&nbsp;the&nbsp;records&nbsp;in&nbsp;an&nbsp;Ada&nbsp;program</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;01&nbsp;EMPLOYEE-RECORD</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;05&nbsp;NAME&nbsp;&nbsp;&nbsp;&nbsp;PIC&nbsp;X(20).</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;05&nbsp;SSN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PIC&nbsp;X(9).</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;05&nbsp;SALARY&nbsp;&nbsp;PIC&nbsp;99999V99&nbsp;USAGE&nbsp;COMP.</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;05&nbsp;ADJUST&nbsp;&nbsp;PIC&nbsp;S999V999&nbsp;SIGN&nbsp;LEADING&nbsp;SEPARATE.</I><BR>
&nbsp;&nbsp;&nbsp;<I>--&nbsp;The&nbsp;COMP&nbsp;data&nbsp;is&nbsp;binary&nbsp;(32&nbsp;bits),&nbsp;high-order&nbsp;byte&nbsp;first</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>113</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>package</B>&nbsp;COBOL&nbsp;<B>renames</B>&nbsp;Interfaces.COBOL;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>114</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;Salary_Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>is</B>&nbsp;<B>delta</B>&nbsp;0.01&nbsp;&nbsp;<B>digits</B>&nbsp;7;<BR>
&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;Adjustments_Type&nbsp;<B>is</B>&nbsp;<B>delta</B>&nbsp;0.001&nbsp;<B>digits</B>&nbsp;6;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>115</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;COBOL_Employee_Record_Type&nbsp;<B>is</B>&nbsp;&nbsp;<I>--&nbsp;External&nbsp;representation</I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>record</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;COBOL.Alphanumeric(1..20);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SSN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;COBOL.Alphanumeric(1..9);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Salary&nbsp;&nbsp;:&nbsp;COBOL.Byte_Array(1..4);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adjust&nbsp;&nbsp;:&nbsp;COBOL.Numeric(1..7);&nbsp;&nbsp;<I>--&nbsp;Sign&nbsp;and&nbsp;6&nbsp;digits</I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>end</B>&nbsp;<B>record</B>;<BR>
&nbsp;&nbsp;&nbsp;<B>pragma</B>&nbsp;Convention&nbsp;(COBOL,&nbsp;COBOL_Employee_Record_Type);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>116</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>package</B>&nbsp;COBOL_Employee_IO&nbsp;<B>is</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>new</B>&nbsp;COBOL_Sequential_IO(COBOL_Employee_Record_Type);<BR>
&nbsp;&nbsp;&nbsp;<B>use</B>&nbsp;COBOL_Employee_IO;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>117</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;COBOL_File&nbsp;:&nbsp;File_Type;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>118</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;Ada_Employee_Record_Type&nbsp;<B>is</B>&nbsp;&nbsp;<I>--&nbsp;Internal&nbsp;representation</I><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>record</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;String(1..20);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SSN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;String(1..9);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Salary&nbsp;&nbsp;:&nbsp;Salary_Type;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adjust&nbsp;&nbsp;:&nbsp;Adjustments_Type;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>end</B>&nbsp;<B>record</B>;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>119</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;COBOL_Record&nbsp;:&nbsp;COBOL_Employee_Record_Type;<BR>
&nbsp;&nbsp;&nbsp;Ada_Record&nbsp;&nbsp;&nbsp;:&nbsp;Ada_Employee_Record_Type;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>120</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>package</B>&nbsp;Salary_Conversions&nbsp;<B>is</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>new</B>&nbsp;COBOL.Decimal_Conversions(Salary_Type);<BR>
&nbsp;&nbsp;&nbsp;<B>use</B>&nbsp;Salary_Conversions;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>121</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>package</B>&nbsp;Adjustments_Conversions&nbsp;<B>is</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>new</B>&nbsp;COBOL.Decimal_Conversions(Adjustments_Type);<BR>
&nbsp;&nbsp;&nbsp;<B>use</B>&nbsp;Adjustments_Conversions;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>122</FONT></DIV>
<DIV Class="Examples"><TT><B>begin</B><BR>
&nbsp;&nbsp;&nbsp;Open&nbsp;(COBOL_File,&nbsp;Name&nbsp;=&gt;&nbsp;&quot;Some_File&quot;);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>123</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>loop</B><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Read&nbsp;(COBOL_File,&nbsp;COBOL_Record);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>124</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ada_Record.Name&nbsp;:=&nbsp;To_Ada(COBOL_Record.Name);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ada_Record.SSN&nbsp;&nbsp;:=&nbsp;To_Ada(COBOL_Record.SSN);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ada_Record.Salary&nbsp;:=<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;To_Decimal(COBOL_Record.Salary,&nbsp;COBOL.High_Order_First);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ada_Record.Adjust&nbsp;:=<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;To_Decimal(COBOL_Record.Adjust,&nbsp;COBOL.Leading_Separate);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;<I>--&nbsp;Process&nbsp;Ada_Record</I><BR>
&nbsp;&nbsp;&nbsp;<B>end</B>&nbsp;<B>loop</B>;<BR>
<B>exception</B><BR>
&nbsp;&nbsp;&nbsp;<B>when</B>&nbsp;End_Error&nbsp;=&gt;&nbsp;...<BR>
<B>end</B>&nbsp;Test_External_Formats;</TT></DIV>

<HR>
<P><A HREF="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-B-3-2.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-B-5.html">Next</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>