Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

low and high values

Status
Not open for further replies.

venkat2003

Programmer
Feb 11, 2003
8
IN
Hi,
Please clarify this doubt.
I define two variables like in Working storage section.

01 WS-X PIC 9999.
01 WS-Y PIC 9999.

MOVE LOW-VALUES TO WS-X
MOVE HIGH-VALUES TO WS-Y

I am trying to move low and high values in the ws-x,WS-Y fields I am getting problem i.e. violating move during the compile time. Please let me kow the reason. If I define ws-x and WS-Y as X(4) and move low and high values. it is taking. My question why it is not possible in case of numeric move and why it is possible in alphanumeric case.

How internally this values are stored in the WS-X AND WS-Y as defined as Alpha numeric.

Please let me know the solution.

Thanks
Venkat


 
Because the pic 9999 fields are unpacked numeric. The upper four bits of each byte are constant. Low values (all hex zeros) or high values (all hex ff) would violate this rule.
You could however, accomplish what you want to do by coding:
01 ws-x.
02 ws-xnum pic 9(4).
01 ws-y.
02 ws-ynum pic 9(4).
move low-values to ws-x.
move high-values to ws-y.
This may or may not be legitimate depending on what you are attempting to do with these fields.
 
Hi Venkat,

As MR said moving hi or low values to a group item will solve your problem. As I recall, those moves are reserved for A/N items, so you're limited to 3 approaches:

The first was already discussed.

You can also redefine the fields to pic x or you can use a ref/mod move, e.g.:

move low-values to ws-x(1:)

There may be more imaginative approaches, but these should suffice.

Regards, Jack.
 
Perhaps you are confused as to what the meaning of HIGH-VALUES and LOW-VALUES is. These are expressly alphanumeric items consisting of strings of X'FF' or X'00' respectively. They do no conform to the picture of the target field as does ZEROES.
 
Remember that Low-Values (hex'00') is the LOWEST character value there is if you are comparing values. That is, NOTHING is-less-than LOW-VALUES.

Remember that High-Values (hex'FF') is HIGHEST character value there is if you are comparing values. That is, NOTHING is-greater-than HIGH-VALUES.
 
In early implementations of Microfocus COBOL, HIGH-VALUES was X'7F', the highest value in ascii, which was a 7-bit coding system at the time. Of course this caused problems on 8-bit machines, of which allmost all were and still are.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top