Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Using Count(*) query in Cobol program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
praveena avaluru

New User


Joined: 29 Sep 2010
Posts: 9
Location: bangalore

PostPosted: Tue Jun 14, 2011 2:07 pm    Post subject: Using Count(*) query in Cobol program
Reply with quote

Hi
I have 2 variables
WS-count is declared as a S9(04) Comp-3 and
the value in WS-DUPLICATE is 07%

The table has the following rows
COLUMN1
07
078
0781
I have a query in the cobol program as

EXEC SQL
SELECT COUNT(*)
INTO :WS-COUNT
FROM TABLE
WHERE
COLUMN1 LIKE :WS-DUPLICATE
END-EXEC

The result ( ws-count) is 2 and not 3.

When i run this query in spufi the result is 3

Do i have to take any care while running a Count(*) in cobol ??

Regards
Praveena Avaluru
Back to top
View user's profile Send private message

nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Tue Jun 14, 2011 2:31 pm    Post subject: Re: Using Count(*) query in Cobol program
Reply with quote

Did you check the value of WS-DUPLICATE just before the query is executed?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Jun 14, 2011 4:38 pm    Post subject:
Reply with quote

what is the datatype of COLUMN1?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1250
Location: Israel

PostPosted: Wed Jun 15, 2011 12:03 am    Post subject:
Reply with quote

That's because in spufi you do:
Code:
WHERE COLUMN1 LIKE '07%'
and in cobol you do
Code:
WHERE COLUMN1 LIKE '07%      '

Note the spaces after the % in cobol (number of spaces according to PIC of WS-DUPLICATE)
0781 does not fit in your WHERE request.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1250
Location: Israel

PostPosted: Wed Jun 15, 2011 7:08 pm    Post subject: Reply to: Using Count(*) query in Cobol program
Reply with quote

Did you solve your problem, and how?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
No new posts ISMF Difference between volume count ... upendrasri IBM Tools 2 Tue Dec 05, 2017 12:40 pm
No new posts How to query MAXGENS of an existing P... Chuchulo Hatyzak JCL & VSAM 4 Wed Nov 22, 2017 10:23 pm
No new posts Native SQL Query kishpra DB2 1 Wed Nov 22, 2017 8:38 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us