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
 

 

Corresponding record format of COUNT(*) in db2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
joney_biswas

New User


Joined: 14 Dec 2005
Posts: 3

PostPosted: Wed Dec 14, 2005 1:00 pm    Post subject: Corresponding record format of COUNT(*) in db2
Reply with quote

Hi Friends,

I have written a COBOL program containing embedded DB2 SQL. The SQL is given below,

EXEC SQL
SELECT COUNT(*) INTO :WS-COUNT FROM VM_DATA
END-EXEC.

Now while i am trying to execute the program it is showing error because of the record format of the variable of WS-COUNT. I have tried with the following options,

01 WS-COUNT pic x(18)
- If I use this one then it will show error during the run time saying that record format is not same.

01 WS-COUNT pic 9(18) COMP
- If I use this one then it will show error during the compile time saying that undefinied type for WS-COUNT

01 WS-COUNT pic 9(18) COMP-3
-If I use this one then it will show error during the compile time saying that undefinied type for WS-COUNT

So I need your help to solve this problem. Can anybody please tell me what should be the format for the variable WS-COUNT?

I am waiting for your replies.

Thanks,
Joney Biswas
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Dec 15, 2005 12:14 am    Post subject: Re: Corresponding record format of COUNT(*) in db2
Reply with quote

Define WS_COUNT as PIC S9(11) comp-3.
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Thu Dec 15, 2005 2:38 am    Post subject: Re: Corresponding record format of COUNT(*) in db2
Reply with quote

hi

use the following code

EXEC SQL
SELECT DIGITS(COUNT(*)) INTO :WS-COUNT FROM VM_DATA
END-EXEC.

and you can define ws-count as numeric...
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Thu Dec 15, 2005 2:47 am    Post subject: Re: Corresponding record format of COUNT(*) in db2
Reply with quote

hi joney

ignore my previous mail. for the sql to rin you cab define the host variable as PIC S9(09) COMP. Think this should also work. If not then you can use my previous reply
Back to top
View user's profile Send private message
joney_biswas

New User


Joined: 14 Dec 2005
Posts: 3

PostPosted: Fri Dec 16, 2005 10:08 am    Post subject: Re: Corresponding record format of COUNT(*) in db2
Reply with quote

i defined the ws-count as like this

01 ws-count pic s9(11) comp-3.

and it worked fine. thanks for all of your supports.

Thanks,
Joney Biswas
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Record Not found in AlX but record re... mukun264 COBOL Programming 5 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm


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