View previous topic :: View next topic
|
Author |
Message |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Thanks.
And the last post in the thread. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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"? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
[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 |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
Thank u all for your help. Now I know what I should do next. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
30 post on somebody just complicating his life |
|
Back to top |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
time to lock the topic, it is shifting towards utter silliness
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 |
|
Back to top |
|
|
|