View previous topic :: View next topic |
Author |
Message |
Crox Beginner
Joined: 29 May 2004 Posts: 52 Topics: 9
|
Posted: Fri Oct 12, 2007 5:10 am Post subject: how to do an ISPF F P'.' in a DB2 query? |
|
|
Hi,
I want to do a query in DB2 to find special tokens like the ISPF EDIT p'.'.
It is about finding them in a separate character field and count how many rows are found with a certain column that contains p'.' tokens.
Is this possible and if so, how?
Regards,
Crox |
|
Back to top |
|
 |
vivek1983 Intermediate

Joined: 20 Apr 2006 Posts: 222 Topics: 24
|
Posted: Fri Oct 12, 2007 6:03 am Post subject: |
|
|
Crox,
Try this: I am not sure of the HEX value for " P'.' ".
Code: |
SELECT COUNT(*) AS CNT
FROM T1
WHERE POSSTR(C1,CHAR(X'OD')) > 0
|
Hope this helps. _________________ Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay) |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri Oct 12, 2007 1:57 pm Post subject: |
|
|
POSTED IN ANOTHER PLACE (FORUM) - naughty:evil: _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Oct 12, 2007 1:58 pm Post subject: |
|
|
Crox,
you did not like the answer given in the other forum?
Vivek,
Crox is looking for a short cut like ISPF FIND P'.' which looks for all unprintable characters. In ISPF for Change, Find, and exclude: P'=' is for any char. P'<' is lower case, > is upper case, etc....
When you are in an edit session (or view), PF1, then look at the write-up for FIND Special Characters, selection 1.
Unfortunately, db2 does not have Regular Expressions, which in could work for those languages that support Regular Expressions. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
Crox Beginner
Joined: 29 May 2004 Posts: 52 Topics: 9
|
Posted: Tue Oct 16, 2007 2:02 am Post subject: |
|
|
It would be nice to get more than one answer. There are a lot of smart collegues here and I like to get all the answers....
The trouble is that the query is not on a very small database. I am afraid that it will run for hours, perhaps even for days. So.... I even think about using some software (edit macro or sort) on the output of a query that only selects the right fields. |
|
Back to top |
|
 |
Crox Beginner
Joined: 29 May 2004 Posts: 52 Topics: 9
|
Posted: Tue Oct 16, 2007 2:07 am Post subject: |
|
|
Thank you Vivek! |
|
Back to top |
|
 |
CZerfas Intermediate
Joined: 31 Jan 2003 Posts: 211 Topics: 8
|
Posted: Tue Oct 16, 2007 3:43 am Post subject: |
|
|
Hello Crox,
unfortunately, the answer of Vivek is useless in the context of your question, and the post written by Dick contains the correct facts.
I wonder, how collecting lots of answers can improve the true one?
regards
Christian |
|
Back to top |
|
 |
Crox Beginner
Joined: 29 May 2004 Posts: 52 Topics: 9
|
Posted: Tue Oct 16, 2007 2:42 pm Post subject: |
|
|
well.... I hoped for one good answer that is usable. It is a one-time query and it has to be done without programming, using only stand software.... so... a simple query combined with an ispf edit macro or a SORT application can be used. It is a huge amount of data to process so that can also be a problem. Of course it is possible to check a single character within a string that it is between certain values, but that will be too much time consuming. I know some sql functions, but not all of them so I hoped to meet the real wizard here.... But thanks again for your ideas. |
|
Back to top |
|
 |
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Wed Oct 17, 2007 8:23 am Post subject: |
|
|
As long as you're only interested in identifying rows that have a specific column with an unprintable character (not the actual position of the p'.' character within the column), you can use the TRANSLATE function. Set up a predicate where you use TRANSLATE to convert unprintable characters to spaces and compare that to the original column value, then select the rows where they're different. I set this up for hex values 00 through 0F. You'd need to expand the list and add a space to the 'to-string' for each hex value added.
Code: |
where COL1 <> translate(COL1,' ',x'000102030405060708090A0B0C0D0E0F')
|
|
|
Back to top |
|
 |
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Wed Oct 17, 2007 8:25 am Post subject: |
|
|
16 spaces in the 'to-list'
Code: |
where COL1 <>
translate(COL1,' ',x'000102030405060708090A0B0C0D0E0F')
|
|
|
Back to top |
|
 |
Crox Beginner
Joined: 29 May 2004 Posts: 52 Topics: 9
|
Posted: Tue Oct 30, 2007 12:52 pm Post subject: |
|
|
Thank you jsharon, this I will try |
|
Back to top |
|
 |
|
|