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

Convet SmallInt value to Numeric by using DB2 function


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
SHAILESH OZA

New User


Joined: 10 Jun 2005
Posts: 21
Location: Mumbai

PostPosted: Thu Dec 22, 2011 4:21 pm
Reply with quote

Hi

I am trying to Unload the data from DB2 table to Flat File using Unload Utility. While doing the Unload, I need to convert a field from SMALLINT data type from DB2 to Numeric value of 4 digit PIC 9(4) of corresponding cobol Clause.

I tried to use the Cast Function like CAST(Field name) As Interger and CAST(Field name) As decimal (4,0) But I am getting the value as ...

Is there any way to get the result as a numeric.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Dec 22, 2011 4:37 pm
Reply with quote

SHAILESH OZA wrote:
Hi

I am trying to Unload the data from DB2 table to Flat File using Unload Utility. While doing the Unload, I need to convert a field from SMALLINT data type from DB2 to Numeric value of 4 digit PIC 9(4) of corresponding cobol Clause.

I tried to use the Cast Function like CAST(Field name) As Interger and CAST(Field name) As decimal (4,0) But I am getting the value as ...

Is there any way to get the result as a numeric.


Isn't this a DB2 question, not a Cobol question?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Dec 22, 2011 4:40 pm
Reply with quote

everyday i see proof,
that if you only used the correct terminology,
you could find the answer, yourself.

DB2 numeric data type SMALLINT is Binary
Decimal is PACKED-DECIMAL.

both are numeric.

COBOL PIC 9(4) DISPLAY is for all intents and purposes, an alphanumeric field.
The corresponding DB2 data type is CHAR.

and when you say:
value as ...

only shows how very very little you know. you should have posted in the beginners' forum
and not have wasted our time here.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Calling an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
No new posts Help on PL/I jsonPutValue function PL/I & Assembler 8
No new posts how to use Tso outtrap external function All Other Mainframe Topics 8
No new posts INSYNC option with same function as I... JCL & VSAM 0
Search our Forums:

Back to Top