One thing that surprised me, and made me waste a day, was that there is no check for overflow in numeric operations by default.

If I try to divide by zero, my program crashes and I even get a very precise explanation of why, but overflowing provides neither.

So, a field defined as Packed(2,0) with

Define Field(*HMJPCK2) Type(*PACKED) Length(2) Decimals(0) Default(0)

it can only hold values between -99 and 99, inclusive. That is not the surprise, the surprise comes from the missing error when going beyond these values. 99 + 10 will give me 9 and no error.

I am very tempted to write a function to handle simple arithmetics to give me the proper error messages but I am too new at this language to start doing that.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s