MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to do an ISPF F P'.' in a DB2 query?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Crox
Beginner


Joined: 29 May 2004
Posts: 52
Topics: 9

PostPosted: Fri Oct 12, 2007 5:10 am    Post subject: how to do an ISPF F P'.' in a DB2 query? Reply with quote

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
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Fri Oct 12, 2007 6:03 am    Post subject: Reply with quote

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
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Oct 12, 2007 1:57 pm    Post subject: Reply with quote

POSTED IN ANOTHER PLACE (FORUM) - naughty:evil:
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Oct 12, 2007 1:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Crox
Beginner


Joined: 29 May 2004
Posts: 52
Topics: 9

PostPosted: Tue Oct 16, 2007 2:02 am    Post subject: Reply with quote

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.... Smile

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
View user's profile Send private message
Crox
Beginner


Joined: 29 May 2004
Posts: 52
Topics: 9

PostPosted: Tue Oct 16, 2007 2:07 am    Post subject: Reply with quote

Thank you Vivek!
Back to top
View user's profile Send private message
CZerfas
Intermediate


Joined: 31 Jan 2003
Posts: 211
Topics: 8

PostPosted: Tue Oct 16, 2007 3:43 am    Post subject: Reply with quote

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
View user's profile Send private message
Crox
Beginner


Joined: 29 May 2004
Posts: 52
Topics: 9

PostPosted: Tue Oct 16, 2007 2:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Wed Oct 17, 2007 8:23 am    Post subject: Reply with quote

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
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Wed Oct 17, 2007 8:25 am    Post subject: Reply with quote

16 spaces in the 'to-list'

Code:

 where COL1 <>
translate(COL1,'                ',x'000102030405060708090A0B0C0D0E0F')
Back to top
View user's profile Send private message
Crox
Beginner


Joined: 29 May 2004
Posts: 52
Topics: 9

PostPosted: Tue Oct 30, 2007 12:52 pm    Post subject: Reply with quote

Thank you jsharon, this I will try
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group