View previous topic :: View next topic
|
Author |
Message |
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 |
|
|
|