Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Where do you use Low-Value and High-Value in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
ravindra reddy

New User


Joined: 21 Jan 2008
Posts: 7
Location: banglore

PostPosted: Tue Apr 15, 2008 4:22 pm    Post subject: Where do you use Low-Value and High-Value in COBOL
Reply with quote

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
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Tue Apr 15, 2008 4:37 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Tue Apr 15, 2008 4:40 pm    Post subject:
Reply with quote

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...
http://ibmmainframes.com/about12669.html
http://ibmmainframes.com/about12621.html
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Apr 15, 2008 5:04 pm    Post subject: Reply to: Where do you use Low-Value and High-Value in COBOL
Reply with quote

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
View user's profile Send private message
ravindra reddy

New User


Joined: 21 Jan 2008
Posts: 7
Location: banglore

PostPosted: Wed Apr 16, 2008 10:27 am    Post subject:
Reply with quote

Thank alot dbzTHEdinosauer, gnanas, Aaru icon_smile.gif
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 216
Location: India

PostPosted: Wed Apr 16, 2008 12:19 pm    Post subject:
Reply with quote

ravindra reddy wrote:
Thank alot dbzTHEdinosauer, gnanas, Aaru icon_smile.gif


can anyone provide some code/Scenarion where they are exactly used for ..
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Wed Apr 16, 2008 1:06 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts COBOL Programming Sandpit? jodrisco COBOL Programming 6 Wed Apr 12, 2017 3:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us