IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

LOW VALUES and HIGH VALUES

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> Mainframe COBOL
View previous topic :: View next topic  
Author Message
Abhushan_s



Joined: 28 Jul 2008
Posts: 21
Location: Ahmedabad

Posted: Tue Aug 19, 2008 10:17 am    Post subject: LOW VALUES and HIGH VALUES  

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? :roll:
Back to top  
Anuj D.



Joined: 22 Apr 2006
Posts: 2134
Location: Phoenix, AZ

Posted: Tue Aug 19, 2008 10:45 am    Post subject: Re: LOW VALUES and HIGH VALUES  

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  
dick scherrer



Joined: 23 Nov 2006
Posts: 8601
Location: 221 B Baker St

Posted: Tue Aug 19, 2008 11:07 am    Post subject:  

Hello,

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

For the word from IBM, look here:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3lr10/1.2.7?
Back to top  
Abhushan_s



Joined: 28 Jul 2008
Posts: 21
Location: Ahmedabad

Posted: Tue Aug 19, 2008 11:07 am    Post subject: ERROR encountered  

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  
Robert Sample



Joined: 06 Jun 2008
Posts: 880
Location: Atlanta, GA

Posted: Tue Aug 19, 2008 4:54 pm    Post subject:  

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  
dbzTHEdinosauer



Joined: 20 Oct 2006
Posts: 1618
Location: germany

Posted: Tue Aug 19, 2008 5:07 pm    Post subject:  

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  
Abhushan_s



Joined: 28 Jul 2008
Posts: 21
Location: Ahmedabad

Posted: Tue Aug 19, 2008 5:09 pm    Post subject:  

Hey Robert thanks for the help. :D [/quote]
Back to top  
Anuj D.



Joined: 22 Apr 2006
Posts: 2134
Location: Phoenix, AZ

Posted: Tue Aug 19, 2008 5:13 pm    Post subject:  

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  
Abhushan_s



Joined: 28 Jul 2008
Posts: 21
Location: Ahmedabad

Posted: Tue Aug 19, 2008 5:17 pm    Post subject:  

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 :? but then no harm in checking again! :lol: .
Back to top  
Anuj D.



Joined: 22 Apr 2006
Posts: 2134
Location: Phoenix, AZ

Posted: Wed Aug 20, 2008 11:34 am    Post subject:  

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 .. :)


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  
Abhushan_s



Joined: 28 Jul 2008
Posts: 21
Location: Ahmedabad

Posted: Wed Aug 20, 2008 2:42 pm    Post subject: Reply to: LOW VALUES and HIGH VALUES  

Hey Anuj, Thanks for the Reply. I would keep that in mind. :)
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> Mainframe COBOL
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM