View previous topic :: View next topic
|
Author |
Message |
ravindra reddy
New User
Joined: 21 Jan 2008 Posts: 7 Location: banglore
|
|
|
|
Hi Can anyone help me regarding this Where do you use Low-Value and High-Value in COBOL also explain which kind of values they present? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
ripped&stripped from enterprise cobol manual:
Quote: |
Figurative constants are reserved words that name and refer to specific constant values. The reserved words for figurative constants and their meanings are:
HIGH-VALUE/HIGH-VALUES
Represents one or more occurrences of the character that has the highest ordinal position in the collating sequence used. For the EBCDIC collating sequence, the character is X'FF'; for other collating sequences, the actual character used depends on the collating sequence used. HIGH-VALUE is treated as an alphanumeric literal.
HIGH-VALUE/HIGH-VALUES cannot be used in a context requiring a national character value.
LOW-VALUE/LOW-VALUES
Represents one or more occurrences of the character that has the lowest ordinal position in the collating sequence used. For the EBCDIC collating sequence, the character is X'00'; for other collating sequences, the actual character used depends on the collating sequence used. LOW-VALUE is treated as an alphanumeric literal.
LOW-VALUE/LOW-VALUES cannot be used in a context requiring a national character value.
|
The above is what they represent. Where do you use them? When you need an alphanumeric literal representing x'00' or x'FF' on an IBM mainframe (or the lowest and highest of any other collating sequence). |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
HIGH-VALUE, HIGH-VALUES
Represents one or more occurrences of the character that has the highest ordinal position in the collating sequence used.
HIGH-VALUE is treated as an alphanumeric literal in a context that requires an alphanumeric character. For alphanumeric data with the EBCDIC collating sequence, the value is X'FF'. For other alphanumeric data, the value depends on the collating sequence in effect.
HIGH-VALUE is treated as a national literal when used in a context that requires a national literal. The value is national character NX'FFFF'.
When the context cannot be determined, an alphanumeric context is assumed and the value X'FF' is used.
Usage note:You should not use HIGH-VALUE (or a value assigned from HIGH-VALUE) in a way that results in conversion between one data representation and another. X'FF' does not represent a valid EBCDIC character, and NX'FFFF' does not represent a valid national character. Conversion of either the alphanumeric or the national HIGH-VALUE representation to another representation results in a substitution character. For example, conversion of X'FF' to UTF-16 would give a substitution character, not NX'FFFF'.
LOW-VALUE, LOW-VALUES
Represents one or more occurrences of the character that has the lowest ordinal position in the collating sequence used.
LOW-VALUE is treated as an alphanumeric literal in a context that requires an alphanumeric character. For alphanumeric data with the EBCDIC collating sequence, the value is X'00'. For other alphanumeric data, the value depends on the collating sequence in effect.
LOW-VALUE is treated as a national literal when used in a context that requires a national literal. The value is national character NX'0000'.
When the context cannot be determined, an alphanumeric context is assumed and the value X'00' is used.
These links are also...
ibmmainframes.com/about12669.html
ibmmainframes.com/about12621.html |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
ravindra,
Adding to what gnanas and dick said,
Consider this scenario, you are interfacing with a JAVA based appln and getting inputs from them. Say for ex, you are
checking if a field is populated in the input. Most of the coders would check for "field1 not= spaces".
But manytimes i have seen this check failing just because the input had "low-values" when the interfacing appln did not
actually send any data.
In that place it is always better to check for "SPACES OR LOW-VALUES" instead of just checking for spaces. |
|
Back to top |
|
|
ravindra reddy
New User
Joined: 21 Jan 2008 Posts: 7 Location: banglore
|
|
|
|
Thank alot dbzTHEdinosauer, gnanas, Aaru |
|
Back to top |
|
|
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
|
|
ravindra reddy wrote: |
Thank alot dbzTHEdinosauer, gnanas, Aaru |
can anyone provide some code/Scenarion where they are exactly used for .. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
A little cheesy, but an example:
Java sends a null delimited string to cobol. Cobol must determine the length of the string and insert to a varchar column.
Code: |
initialize var-char-area replacing alphanumeric by high-values
unstring input
delimited by low-value
into var-char-area
end-unstring
inspect var-char-area tallying counter for high-values
COMPUTE varchar-length = (length of var-char-area) - counter
end-compute
INSERT
|
|
|
Back to top |
|
|
|