MOVE and LOW-VALUES.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Bhaskar Virgo
Registered Member
Posts: 20
Joined: Sun Aug 04, 2013 12:29 am

MOVE and LOW-VALUES.

Post by Bhaskar Virgo »

Hello,

In the program, I've a field declared in working storage variable as:

Code: Select all

05 WS-FEE PIC S9 (8) USAGE COMP. 
and in procedure division I have:

Code: Select all

MOVE LOW-VALUES TO WS-FEE. 
With this, I got an error which states:

Code: Select all

"LOW-VALUES" and "WS-FEE (BINARY INTEGER)" did not follow the "MOVE" statement compatibility rules. 

The statement is discarded. 
Why is this error coming, please help.
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: MOVE and LOW-VALUES.

Post by William Collins »

You can't MOVE LOW-VALUES TO a-binary-field. If you change it to MOVE ZERO it will compile and your field will get zero in it.

Reason is, LOW-VALUES is a COBOL Figurative Constant relating to the collating sequence used in your program. What relevance would collating-sequence have to a binary field?

Define binary, packed-decimal, plane zoned-decimal (PIC 9(n)), alpha-numeric (PIC X(n), alphabetic (PIC A(n)), numeric-edited and alphanumeric-edited fields. Try to MOVE LOW-VALUES to each of them, and see which work, and which don't, and try to understand why. It will be the same with HIGH-VALUES. What about SPACE? What about ZERO? Try them.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: MOVE and LOW-VALUES.

Post by nicc »

What has the declaration of WS-FEE to do with the rest of the topic as it is never mentioned after being shown?
Regards
Nic
Bhaskar Virgo
Registered Member
Posts: 20
Joined: Sun Aug 04, 2013 12:29 am

Re: MOVE and LOW-VALUES.

Post by Bhaskar Virgo »

Thanks William.

nicc, I've aksed Anuj to change that some time back...I'm not sure why he has not chnged it. I had the sme problem with two vriables and mixed the error messge and the declaration while posting here.
User avatar
Anuj Dhawan
Founder
Posts: 2816
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: MOVE and LOW-VALUES.

Post by Anuj Dhawan »

Bhaskar Virgo wrote:nicc, I've aksed Anuj to change that some time back...I'm not sure why he has not chnged it. I had the sme problem with two vriables and mixed the error messge and the declaration while posting here.
Sorry for the delay - I was driving back to home that time and did it bit later. On the other hand, you don't need to wait for a single person for such things, you can use report this post feature to report a post and can put in the details there. The report will go to the Moderators and the first available Moderator can do that for you.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”