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 Profile Log in to check your private messages Log in
 
How to insert Dec fixed(9,0) value in the select query.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to insert Dec fixed(9,0) value in the select query.
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    Post subject: Re: How to insert Dec fixed(9,0) value in the select query.
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    Post subject: Re: How to insert Dec fixed(9,0) value in the select query.
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: 3158
Location: Tucson AZ

PostPosted: Thu Jan 18, 2007 8:31 pm    Post subject:
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    Post subject: Re: How to insert Dec fixed(9,0) value in the select query.
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: 3158
Location: Tucson AZ

PostPosted: Thu Jan 18, 2007 8:40 pm    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Thu Jan 18, 2007 8:51 pm    Post subject:
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: 757
Location: Germany

PostPosted: Thu Jan 18, 2007 9:53 pm    Post subject:
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    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 Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am

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