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

How to set 'LOW-VALUE' , 'HIGH-VALUE' to a numeric type


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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Aug 21, 2012 11:43 pm
Reply with quote

Bill Woodger wrote:
dbzTHEdinosauer wrote:
[...]

high-values and low-values are a system (hexadecimal) limitation.

[...]


Not actually. Check the manual, you can set your own value for those figurative constants. Can't say I've done it, but it is possible :-)

Also, although not yet available in Enterprise Cobol, this can be done with an intrinsic function.

I sure hope it is not testing for numeric. It won't work, even on the occasions abends are avoided :-)

What are you hoping to achieve with this dejunzhu?


I claim "tops" for confusion.

Also, although not yet available in Enterprise Cobol, the maximum/minimum logical value can be done with an intrinsic function.

The functions we can't use yet are LOWEST-ALGEBRAIC and HIGHEST-ALGEBRAIC. I'm assured they work :-)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Aug 22, 2012 12:12 am
Reply with quote

Bill Woodger wrote:
Bill Woodger wrote:
dbzTHEdinosauer wrote:
[...]

high-values and low-values are a system (hexadecimal) limitation.

[...]


Not actually. Check the manual, you can set your own value for those figurative constants. Can't say I've done it, but it is possible :-)

Also, although not yet available in Enterprise Cobol, this can be done with an intrinsic function.

I sure hope it is not testing for numeric. It won't work, even on the occasions abends are avoided :-)

What are you hoping to achieve with this dejunzhu?


I claim "tops" for confusion.

Also, although not yet available in Enterprise Cobol, the maximum/minimum logical value can be done with an intrinsic function.

The functions we can't use yet are LOWEST-ALGEBRAIC and HIGHEST-ALGEBRAIC. I'm assured they work :-)


ok, you win, you are the most confused.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 22, 2012 12:18 am
Reply with quote

Thanks.

And the last post in the thread.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Aug 22, 2012 12:39 am
Reply with quote

Bill Woodger wrote:
Also, although not yet available in Enterprise Cobol, the maximum/minimum logical value can be done with an intrinsic function.

The functions we can't use yet are LOWEST-ALGEBRAIC and HIGHEST-ALGEBRAIC. I'm assured they work :-)

Isn't that a bit like saying, "The unicorn that I describe in my short story is ridable"? icon_confused.gif
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: Wed Aug 22, 2012 1:38 am
Reply with quote

Hello,

I'm probably having a brain fade, but i do recall with COBOL some time ago (don't remember which year or which platform) that the compiler was able to appropriately generate the values used depending on the "picture" of the receiving field.

Does anyone else have a similar memory?

I do know we incorporated this into the COBOL-like compiler my team wrote in the mid-70's. We also gave the coders a compare-and-swap-high (CSWAPHI) and a compare-and-swap-low (CSWAPLO), and of course a non-conditional SWAP to get fields "reversed" with only one instruction. . .
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 22, 2012 3:06 am
Reply with quote

[to sounds of thwacking]

"Cobol" has had the intrinsic-function since 1989. Just hasn't appeared in the IBM world.

Maybe it is more like an "extra" on a car than a ride on a unicorn. That particular extra is not available on the IBM model being driven.

To work with "native binary" it would have to go beyond just the PICture, but I guess the compiler has the information (compile option or USAGE COMP-5). COMP-1 and -2 don't have a PIC, but again the compiler knows.

I'm not sure anyone has "missed" it noy being available here.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Wed Aug 22, 2012 6:28 am
Reply with quote

Thank u all for your help. Now I know what I should do next.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 22, 2012 8:45 am
Reply with quote

dejunzhu wrote:
Thank u all for your help. Now I know what I should do next.


Which is tell us what you are trying to do....
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Aug 22, 2012 9:15 am
Reply with quote

thx Bill,
i wanted to ask the same, but was not sure my 'bluntness'
would have elicited a response,
as I am sure/hope your comment will.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Wed Aug 22, 2012 1:23 pm
Reply with quote

since there is no generic way of assign the maximum and the minimum value to a numeric variable, I have to decide the maximum and the minimum value based on bussiness requirement.

for instance, given an a variable 'D' declared with 9(8) COMP, which is to contain date, I will execute below two statements .

Code:
MOVE ZERO TO D-LOW
MOVE 99999999 TO D-HIGH
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 22, 2012 1:26 pm
Reply with quote

Thanks, but why do you need to do that? How do you use those maxima and minima for something? What do you use them for?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Aug 22, 2012 1:45 pm
Reply with quote

30 post on somebody just complicating his life icon_cool.gif
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Wed Aug 22, 2012 3:40 pm
Reply with quote

take the below requirement as instance:

there is field on the screen. Let's say, A, which is to receive customer number value.

on the host, A is received into COBOL program for inquiry process.
A is declared with 'PIC X(14)' in cobol program.

1. if A is blank, all records are to be retrieved.
2. if A is non-blank, only the record that meet the value of A is to be retrieved.

generally, two SQL statements are required for above request:
1.
Code:
INSPECT WK-A               
        REPLACING ALL SPACE  BY '%'

SELECT * FROM TABLE TBA WHERE CSTM_NO LIKE :WK-A


2.
Code:
SELECT * FROM TABLE TBA WHERE CSTM_NO = :WK-A


it is also necessary to judge which condition it belongs according to input value of A, which is too complicated when input fileds like A increases.

so, I have a generic way of doing this.
Code:
MOVE LOW-VALUE TO WK-A-LOW
MOVE HIGH-VALUE TO WK-A-HIGH

SELECT * FROM TABLE TBA
WHERE CSTM_NO >=:WK-A-LOW
AND CSTM_NO <=:WK-A-HIGH


that's why I had to assign LOW-VALUE and HIGH-VALUE to a variable.

hope I have made myself clearly enough.

Thanks.
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: Wed Aug 22, 2012 7:06 pm
Reply with quote

Hello,

Doing this "generic thing" may cost horribly in performance . . .

Quote:
it is also necessary to judge which condition it belongs according to input value of A, which is too complicated when input fileds like A increases.
You are supposed to be a developer/programmer/whatever which means you should deal with complicated issues - not try to get by them.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Aug 22, 2012 7:09 pm
Reply with quote

time to lock the topic, it is shifting towards utter silliness icon_cool.gif


Code:
MOVE LOW-VALUE TO WK-A-LOW
MOVE HIGH-VALUE TO WK-A-HIGH

SELECT * FROM TABLE TBA
WHERE CSTM_NO >=:WK-A-LOW
AND CSTM_NO <=:WK-A-HIGH

to retrieve all the rows of a table icon_eek.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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts SMF record type 30 JCL & VSAM 8
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
No new posts Convert HEX to Numeric DB2 3
No new posts Find a record count/numeric is multip... COBOL Programming 1
Search our Forums:

Back to Top