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
 

 

Loading SMALL INT Datatype into DB2

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

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Mon Apr 02, 2007 12:32 pm    Post subject: Loading SMALL INT Datatype into DB2
Reply with quote

Hi,

My requiremnt is that I have to produce a file with a COBOL program which can
be loaded into a DB2 table through the IBM load utility.

Say I have Table A with COL1 of datatype SMALLINT.

I am done with the processing logic and I write the output into a file
containing just one datatype S((04) COMP, so that i can load this file in to the
table.

But the problem is something like this:
I have moved a value 27797 to the S9(04) COMP.
But only 7797 is getting populated in the variable
resulting in data loss.

But when I run an insert query I able to insert 27797 into COL1 of TableA.

I dont understand where I am going wrong.

1) Cant S9(04) COMP hold a value as big as 27797 ?
2) Is there any other dataype or declaration that I have to use?


Can somebody help me out...
Back to top
View user's profile Send private message

vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Mon Apr 02, 2007 2:19 pm    Post subject:
Reply with quote

What is the equivalent datatype given by DCLGEN..?
Are you not making use of DCLGEN..?
It is meant to get rid of this kind of situations.
Back to top
View user's profile Send private message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Mon Apr 02, 2007 2:25 pm    Post subject: Re: Loading SMALL INT Datatype into DB2
Reply with quote

This is S9(04) COMP is the declarationg given by the DCLGEN
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Mon Apr 02, 2007 5:50 pm    Post subject:
Reply with quote

A halfword binary can hold your value, but COBOL strictly honors the field definition, which says 4 digits, so the compiled COBOL code truncates the leftmost digit.

E.g., for PIC 9(1) COMP, although a halfword is used, only unsigned single-digit values are stored.

Since PIC 9(5) COMP thru 9(9) COMP allocate a fullword, I'm not sure how you can do this directly in COBOL.

I think it is unwise to store a 5-digit number in a halfword or SMALLINT, as it will not hold any 5-digit number. That's why PIC 9(1) COMP thru 9(4) COMP use a halfword - all 4-digit values can be accomodated.
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 loading a Modified Mapset Susanta CICS 2 Tue Mar 14, 2017 5:43 pm
No new posts Loading assembler table in COBOL Batc... guy jax COBOL Programming 7 Mon Mar 16, 2015 4:58 am
No new posts PL/I small integer? John Poulakos PL/I & Assembler 3 Wed Dec 24, 2014 2:22 am
No new posts loading a partitioned table sushanth bobby DB2 5 Sat Oct 18, 2014 6:20 am
No new posts COBOL Table loading Musab Ahmed DB2 2 Tue Nov 26, 2013 3:17 pm


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