Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 6968
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: 1232
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: 1232
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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts CICS Transaction attach count of supp... lind sh CICS 1 Wed Jun 21, 2017 1:33 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us