IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

LOW VALUES and HIGH VALUES


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Abhushan_s

New User


Joined: 28 Jul 2008
Posts: 34
Location: Ahmedabad

PostPosted: Tue Aug 19, 2008 10:17 am
Reply with quote

Hi Could anyone tell me where can we possibly use LOW VALUES and HIGH VALUES..
Actually i have to check for NOT NUMERIC data as well as LOW VALUES, so are these low values some kind of values that come neither in NUMERIC nor in ALPHANUMERIC data? coz when i consulted about it, i got the response as LOW VALUES are those values that are some kinds of Special charecters...
Could anyone help me out regarding LOW VALUES and HIGH VALUES? icon_rolleyes.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Aug 19, 2008 10:45 am
Reply with quote

Hi,
Abhushan_s wrote:
Could anyone help me out regarding LOW VALUES and HIGH VALUES?

There are occasions when you may wish to set a variable to an infinitely high or infinitely low number. For example, suppose you were merging two files on surnames as the primary key:

*in data division FILE SECTION
Code:
 FD FILE-1.
 01 RECORD-1.
     03 IN-NAME-1 PIC X(20).
     03 FILLER    PIC X(50).

 FD MERGE-FILE.
 01 RECORD-OUT    PIC X(70).

   :
   :

   PERFORM WITH TEST AFTER EOF-FLAG-1 AND EOF-FLAG-2
*loop until each file has been read to completion
*read each file
Code:
      READ FILE-1
          AT END SET EOF-FLAG-1 TO TRUE
          MOVE HIGH-VALUES TO IN-NAME-1
      END-READ
      READ FILE-2
          AT END SET EOF-FLAG-2 TO TRUE
          MOVE HIGH-VALUES TO IN-NAME-2
      END-READ

*sort the records (assuming no 2 names are the same)
*on ascending surname
Code:
      IF IN-NAME-1 IS < IN-NAME-2 THEN
          WRITE RECORD-OUT FROM RECORD-1
      ELSE
          WRITE RECORD-OUT FROM RECORD-2
      END-IF

   END-PERFORM

In this example, when IN-NAME-1 is less than IN-NAME-2 (based on their ASCII values e.g. A < B etc..) then the FILE-1 record (RECORD-1) is written to the merge file (RECORD-OUT). One of FILE-1 and FILE-2 will come to an end before the other so the completed file has its IN-NAME- value set to constant that will ALWAYS be greater than the IN-NAME- value still being read, ensuring all remain files are written to the merge file. This is done with the lines: MOVE HIGH-VALUES TO IN-NAME-1 and MOVE HIGH-VALUES TO IN-NAME-2.

Quote:
Actually i have to check for NOT NUMERIC data as well as LOW VALUES, so are these low values some kind of values that come neither in NUMERIC nor in ALPHANUMERIC data? coz when i consulted about it, i got the response as LOW VALUES are those values that are some kinds of Special charecters...

It is important to note that HIGH-VALUES and LOW-VALUES are ALPHANUMERIC in type, so you can't set numerically defined variables to this type (you would have to implicitly redefine the variable first). This is an annoying quirk of COBOL.

Hope this helps..
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 19, 2008 11:07 am
Reply with quote

Hello,

LOW-VALUES and HIGH-VALUES are "figurative constants".

For the word from IBM, look here:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3lr10/1.2.7?
Back to top
View user's profile Send private message
Abhushan_s

New User


Joined: 28 Jul 2008
Posts: 34
Location: Ahmedabad

PostPosted: Tue Aug 19, 2008 11:07 am
Reply with quote

Hey Anuj thanks for the reply, It helped.

I would like to just re-phrase what you mentioned.

Is it that, as the values in either FILE-1 or FILE-2 will come to an end, we need to keep one of the values or both of them to a high value that will cause all the eligible records in both the files to be written to the output file?

Actually i have another issue, iam checking for the value in a field 'WS-A' and i dont want it to either be NOT NUMERIC or LOW VALUES. but when i give the condition as
IF WS-A IS NOT NUMERIC OR LOW-VALUES

It shows an error which is
"An invalid abbreviated relation condition was found. The statement was
discarded." on the above conditional statement.

Is the error due to wrong syntax?


please let me know the correct syntax of it.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Tue Aug 19, 2008 4:54 pm
Reply with quote

Quote:
IF WS-A IS NOT NUMERIC OR LOW-VALUES
This is syntactically invalid; if you carry the condition through you get IF WS-A NOT NUMERIC OR NOT LOW-VALUES, and NOT LOW-VALUES is invalid. You need to have
Code:
IF WS-A NOT NUMERIC AND WS-A NOT = LOW-VALUES
. You don't want an OR condition, anyway -- why have an IF test in that case?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Aug 19, 2008 5:07 pm
Reply with quote

as Robert indicated, your syntax is bad. but that was based on your verbiage, which was also incorrect:
Quote:

i dont want it to either be NOT NUMERIC or LOW VALUES

should have been:

i dont want it to be NOT NUMERIC and I don't want it to be equal to LOW VALUES
Back to top
View user's profile Send private message
Abhushan_s

New User


Joined: 28 Jul 2008
Posts: 34
Location: Ahmedabad

PostPosted: Tue Aug 19, 2008 5:09 pm
Reply with quote

Hey Robert thanks for the help. icon_biggrin.gif [/quote]
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Aug 19, 2008 5:13 pm
Reply with quote

Hi,

Good, the syntax worked for you, however, you didn't answer this
Quote:
why have an IF test in that case?
yet, asked by Robert..
Back to top
View user's profile Send private message
Abhushan_s

New User


Joined: 28 Jul 2008
Posts: 34
Location: Ahmedabad

PostPosted: Tue Aug 19, 2008 5:17 pm
Reply with quote

Actually Anuj, i have a case to test whether the field is having a non numeric data and also check whether it has LOW-VALUES.
i was told to do that, nut i also asked y do we need the IF condition , but then there is some standard i had to follow so even i was confused in the beginning icon_confused.gif but then no harm in checking again! icon_lol.gif .
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Aug 20, 2008 11:34 am
Reply with quote

Hi,
Abhushan_s wrote:
i have a case to test whether the field is having a non numeric data and also check whether it has LOW-VALUES.
Probably, one would expect to have two different behaviour of program on these two checks, well, anyway..
Quote:
i was told to do that
well, if one has a better suggestion, one must know the tactics to let other know aboout that...even to seniors .. icon_smile.gif


Probably I skipped to answer it in previous hit to this thread..
Quote:
Is it that, as the values in either FILE-1 or FILE-2 will come to an end, we need to keep one of the values or both of them to a high value that will cause all the eligible records in both the files to be written to the output file?
answer is..Yes.
Back to top
View user's profile Send private message
Abhushan_s

New User


Joined: 28 Jul 2008
Posts: 34
Location: Ahmedabad

PostPosted: Wed Aug 20, 2008 2:42 pm
Reply with quote

Hey Anuj, Thanks for the Reply. I would keep that in mind. icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
Search our Forums:

Back to Top