IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to insert Dec fixed(9,0) value in the select query.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajesh_manas

New User


Joined: 30 Mar 2006
Posts: 11

PostPosted: Thu Jan 18, 2007 7:29 pm
Reply with quote

Dear All,

The query is as below,

SELECT CUSTOMER_NR,
(0),
NAME

From CUST table;

I want to write the above query result to a following structure

DCL 1 CUST,
5 Customer_nr char(10),
5 Reserve1 Dec fixed(9,0), (Always it should be filled with zero)
5 Name Char(25);

I need alwasy Zero in the place of Reserve1 out of query.

Please let me know how we can Hard code value '0' in the query.

Regards,
Rajesh
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 Jan 18, 2007 7:48 pm
Reply with quote

Rajesh,

What you have is 99% correct. Just remove the ?(?,?)?

SELECT
CUSTOMER_NR,
0,
NAME
From CUST table
Back to top
View user's profile Send private message
rajesh_manas

New User


Joined: 30 Mar 2006
Posts: 11

PostPosted: Thu Jan 18, 2007 8:21 pm
Reply with quote

But the problem is this zero value has to be stored in Decimal(9,0),

I mean it has to be stored in 5 Bytes variable while moving the data from file to program Interal structure....

Please let me know , How to hard code zero value which has to take 5 bytes.

Regards,
rajesh
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jan 18, 2007 8:31 pm
Reply with quote

Don't you select into host variables? That would be where you set the size....
Back to top
View user's profile Send private message
rajesh_manas

New User


Joined: 30 Mar 2006
Posts: 11

PostPosted: Thu Jan 18, 2007 8:34 pm
Reply with quote

Sorry, I dont have an idea on declaring the Host variables in the select query.....Can you please let me know the syntax.

Regards,
Rajesh
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jan 18, 2007 8:40 pm
Reply with quote

What is this?
Quote:
DCL 1 CUST,
5 Customer_nr char(10),
Back to top
View user's profile Send private message
rajesh_manas

New User


Joined: 30 Mar 2006
Posts: 11

PostPosted: Thu Jan 18, 2007 8:44 pm
Reply with quote

That is the internal structure in my program, Where the Query output file will be moved.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jan 18, 2007 8:51 pm
Reply with quote

Those are your host variables....Don't you "select column-name into data-name"?
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Thu Jan 18, 2007 9:53 pm
Reply with quote

Hi !

DCL ... are you programming in PL/I ???

Regards, UmeySan
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Pulling a fixed number of records fro... DB2 2
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
Search our Forums:

Back to Top