Community in read only mode June 18 & 19
This community will be set in READ ONLY mode for a while on Tuesday June 18 into Wednesday June 19 while we import content and users from our Micro Focus Forums community site. MORE INFORMATION
harald_schmidt Absent Member.
Absent Member.
1410 views

numeric fields

Jump to solution

moving space to a numeric field will initialize it with zeroes (compiler message: COBCH1026E Source literal is non-numeric - substituting zero). A numeric test is succesfull (which causes consequential error). Is there a directive to avoid this - I didn't find any.

thanks in advance

Harald

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

RE: numeric fields

Jump to solution

This only occurs during compilation if the compiler recognizes a statement that is trying to move an illegal value into a numeric field as this is not allowed.

So if you have something like:

01 my-group.

    05 num-field  pic 9(5).

01 aspace pic x value space.

   and you try:

   move space to num-field   *> you will get zero substitution because compiler knows illegal value

   but if you use instead the data-item aspace

   move aspace to num-field *> no compiler error but you may get rts163 error at run-time. if test for 0 fails

   if you move spaces to the group item you will not get compiler error but may get rts163 error at run-time but if test for 0 fails

          move space to my-group

          if num-field = 0

             display "yes"

          else

             display "no"

          end-if

0 Likes
3 Replies
Micro Focus Expert
Micro Focus Expert

RE: numeric fields

Jump to solution

This only occurs during compilation if the compiler recognizes a statement that is trying to move an illegal value into a numeric field as this is not allowed.

So if you have something like:

01 my-group.

    05 num-field  pic 9(5).

01 aspace pic x value space.

   and you try:

   move space to num-field   *> you will get zero substitution because compiler knows illegal value

   but if you use instead the data-item aspace

   move aspace to num-field *> no compiler error but you may get rts163 error at run-time. if test for 0 fails

   if you move spaces to the group item you will not get compiler error but may get rts163 error at run-time but if test for 0 fails

          move space to my-group

          if num-field = 0

             display "yes"

          else

             display "no"

          end-if

0 Likes
harald_schmidt Absent Member.
Absent Member.

RE: numeric fields

Jump to solution

Thank you for your quickly reply, Chris

0 Likes
Highlighted
andres_heredia Absent Member.
Absent Member.

RE: numeric fields

Jump to solution
[mention:d603b3bbafb34624b638067562f96d5f:e9ed411860ed4f2ba0265705b8793d05] is there any compiler directive to generate an error when I try to move an alphanumeric field to a numeric field?

We want to prevent all those RTS163 pass to runtime.

Thanks.
Andrés Mauricio Heredia G.
Software Engineer
EMA HOLDINGS S.A.S
Cali - Colombia

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.