2023-05-25 14:18:12 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
|
|
|
When storing numeric fields, using an odd number of digits allows the sign to be included in the storage area without wasting any space.
|
|
|
|
|
|
|
|
For example the number -1234567, when packed as 7 digits is stored as follows.
|
|
|
|
|
|
|
|
----
|
|
|
|
1357
|
|
|
|
246-
|
|
|
|
----
|
|
|
|
thus taking up only 4 data slots. but when packed as 8 characters it uses 5 data slots
|
|
|
|
|
|
|
|
----
|
|
|
|
02467
|
|
|
|
0135-
|
|
|
|
----
|
|
|
|
or when 7 digits, non-packed, it will be stored as 8 data slots, including the sign.
|
|
|
|
|
|
|
|
----
|
|
|
|
FFFFFFF6
|
|
|
|
12345670
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
|
|
|
|
[source,rpg]
|
|
|
|
----
|
|
|
|
D NUMFLD S 8P 0
|
|
|
|
D NUMFLD S 7S 0
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
|
|
|
|
[source,rpg]
|
|
|
|
----
|
|
|
|
D NUMFLD S 7P 0
|
|
|
|
----
|
|
|
|
|
2021-09-20 15:38:42 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|