Usage of "HIGH VALUES" in COBOL.
Usage of "HIGH VALUES" in COBOL.
Hi,
What is the use of "HIGH VALUES" in COBOL? For this I replied, "Moving High-values will move all 1's in the variable." But I think I did not reply it well. What should I have answered.
What is the use of "HIGH VALUES" in COBOL? For this I replied, "Moving High-values will move all 1's in the variable." But I think I did not reply it well. What should I have answered.
Re: Usage of "HIGH VALUES" in COBOL.
I also said that when we are doing the file comparison, moving high values help.
- mickeydusaor
- Forum Moderator
- Posts: 27
- Joined: Fri Aug 28, 2015 10:11 pm
- Location: Salem, Oregon
Re: Usage of "HIGH VALUES" in COBOL.
high values hex 'FFFFFFFF' or Moving a -1 will give you high values.
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: Usage of "HIGH VALUES" in COBOL.
High-values is the highest value in the "collating sequence" in your COBOL program. No value is higher.
The default value for HIGH-VALUES is X'FF'. HIGH-VALUES is a figurative-constant, When you MOVE HIGH-VALUES TO somwhere, all receiving positions of somewhere will be filled with X'FF'. Note, there is no difference between HIGH-VALUE and HIGH-VALUES.
For any type of matched-key processing, high-values can be useful, since nothing can be higher. It can also be useful for "trailer" records, as binary-ones are the highest in the collating sequence.
If you want a non-default value for high-values, take some time with the manuals and see if you can work it out.
The default value for HIGH-VALUES is X'FF'. HIGH-VALUES is a figurative-constant, When you MOVE HIGH-VALUES TO somwhere, all receiving positions of somewhere will be filled with X'FF'. Note, there is no difference between HIGH-VALUE and HIGH-VALUES.
For any type of matched-key processing, high-values can be useful, since nothing can be higher. It can also be useful for "trailer" records, as binary-ones are the highest in the collating sequence.
If you want a non-default value for high-values, take some time with the manuals and see if you can work it out.
Re: Usage of "HIGH VALUES" in COBOL.
Thanks William for the great explnation.
What is "collating sequence"?
What is "collating sequence"?
-
- Global Moderator
- Posts: 832
- Joined: Wed Sep 11, 2013 3:57 pm
Re: Usage of "HIGH VALUES" in COBOL.
a sequence according to some rulesWhat is "collating sequence"?
for Mainframes ( EBCDIC) the numbers come after the letters
for norma PC ( ASCII ) the letters come after the numbers
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: Usage of "HIGH VALUES" in COBOL.
Collating sequence starts from the lowest value, and continues, in sequence, by each subsequent higher value.
ABCDEFG
A is lowest, B is greater than A, C is greater than B (so also greater than A), D is greater than C (so also greater than B and A) etc.
Without a collating sequence, you can do no "greater than" or "less than" comparisons.
The collating sequence also determines in what order data will be sorted.
At the basic level data "collates" from X'00' thru X'FF, in sequence.
In EBCDIC, all "displayable" characters have a hexadecimal value. This is also true in ASCII, but, the hexadecimal values of, for instance, the alphabet and the numbers is different between the two character sets, so the collating sequence is different (in EBCDIC, letters collate lower than numbers, in ASCII the reverse).
At the basic level, in COBOL LOW-VALUES is the lowest hexadecimal value in the collating sequence, and HIGH-VALUES is the highest, and that is X'00' and X'FF' respectively.
However, in a COBOL program (and elsewhere outside COBOL) you can use a different collating sequence for a specific purpose. In a COBOL program running on a Mainframe you could process ASCII data using an ASCII collating sequence, or some custom collating sequence where LOW-VALUES and HIGH-VALUES still contain the lowest and highest in the sequence, but do not contain X'00' and X'FF'.
It is very rare that you would need to do this "for real", but you could do some little tests anyway. Have a look at the ALPHABET clause of the SPECIAL-NAMES paragraph (part of the CONFIGURATION SECTION in the EVIRONMENT DIVISION) and how it would be used in tests, and how you could use it to specify a COLLATING SEQUENCE for a SORT or MERGE statement in COBOL.
ABCDEFG
A is lowest, B is greater than A, C is greater than B (so also greater than A), D is greater than C (so also greater than B and A) etc.
Without a collating sequence, you can do no "greater than" or "less than" comparisons.
The collating sequence also determines in what order data will be sorted.
At the basic level data "collates" from X'00' thru X'FF, in sequence.
In EBCDIC, all "displayable" characters have a hexadecimal value. This is also true in ASCII, but, the hexadecimal values of, for instance, the alphabet and the numbers is different between the two character sets, so the collating sequence is different (in EBCDIC, letters collate lower than numbers, in ASCII the reverse).
At the basic level, in COBOL LOW-VALUES is the lowest hexadecimal value in the collating sequence, and HIGH-VALUES is the highest, and that is X'00' and X'FF' respectively.
However, in a COBOL program (and elsewhere outside COBOL) you can use a different collating sequence for a specific purpose. In a COBOL program running on a Mainframe you could process ASCII data using an ASCII collating sequence, or some custom collating sequence where LOW-VALUES and HIGH-VALUES still contain the lowest and highest in the sequence, but do not contain X'00' and X'FF'.
It is very rare that you would need to do this "for real", but you could do some little tests anyway. Have a look at the ALPHABET clause of the SPECIAL-NAMES paragraph (part of the CONFIGURATION SECTION in the EVIRONMENT DIVISION) and how it would be used in tests, and how you could use it to specify a COLLATING SEQUENCE for a SORT or MERGE statement in COBOL.
- Robert Sample
- Global Moderator
- Posts: 1898
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Usage of "HIGH VALUES" in COBOL.
This is not really an answer -- if the variable is defined as PIC X or PIC 9 USAGE DISPLAY, moving all 1's results in each byte having X'F1' whereas moving HIGH-VALUES results in each byte having X'FF' in it.Moving High-values will move all 1's in the variable
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