Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL Inserts Junk value

0 views
Skip to first unread message

nsks...@gmail.com

unread,
May 23, 2009, 2:59:41 PM5/23/09
to
Hi Everybody,

I have a cobol program which inserts records into a table which has 10
fields as no default not null with different datatypes, Now I
initialize the table and move values into 8 host variables and does
not move any value into 2 fields and call write paragraph which
inserts value into the table, The problem is I get -8033 error which
says I am trying to insert a value in a field which is more than its
length, when i debug the program its trying to insert some junk values
into the left 2 fields.

I would like to know why its trying to insert values in remaining 2
fields else it should throw some other error coz my all fields are
defines as no default not null and why it writes junk values to
fields.

If instead of the table i use structured Key Sequenced file and does
the same above in file what error will i get or it will also insert
some junk values in the fields.

Will appreciate your quick help

Thanks

Doug Miller

unread,
May 23, 2009, 5:13:40 PM5/23/09
to
In article <e513cbf4-f508-41bb...@v23g2000pro.googlegroups.com>, nsks...@gmail.com wrote:
>Hi Everybody,
>
>I have a cobol program which inserts records into a table which has 10
>fields as no default not null with different datatypes, Now I
>initialize the table and move values into 8 host variables and does
>not move any value into 2 fields and call write paragraph which
>inserts value into the table, The problem is I get -8033 error which
>says I am trying to insert a value in a field which is more than its
>length, when i debug the program its trying to insert some junk values
>into the left 2 fields.
>
>I would like to know why its trying to insert values in remaining 2
>fields else it should throw some other error coz my all fields are
>defines as no default not null and why it writes junk values to
>fields.

It would be easier for us to figure out what's going wrong if you would post
the INSERT command. It's kind of hard for me to see it from here... :-)


>
>If instead of the table i use structured Key Sequenced file and does
>the same above in file what error will i get or it will also insert
>some junk values in the fields.

It will insert whatever you tell it to insert -- and if that means junk values
in data fields that you have not initialized, that's what you'll get.

Joe Bishop

unread,
May 23, 2009, 5:17:38 PM5/23/09
to

The NO DEFAULT specification means that you must populate a column with
a value. It won't default to a SYSTEM or specified value.

Essentially, you may be using whatever values are in those two host
variables when you perform the INSERT even though you don't explicitly
populate them. Are they listed in the INSERT statement?

Getting a useful error from the subsystem is an expectation that can
prove disappointing. The error handler will trap out on the first
condition it finds in the order it's set up to process it.

The "junk" in the host variable fields can be from something that
happened during exception handling. Are you certain it wasn't there
prior to the INSERT?

The file type has nothing to do with it. Either specify default values
for the columns or populate all of them for the INSERT.

Joe

Keith Dick

unread,
May 24, 2009, 5:27:21 AM5/24/09
to
nsks...@gmail.com wrote:
>
> If instead of the table i use structured Key Sequenced file and does
> the same above in file what error will i get or it will also insert
> some junk values in the fields.
>

I agree with what the others have said about your problem -- it sounds as if your program is coded incorrectly, but without seeing exactly what you are doing, it is hard to be sure.

On the question of what happens if you don't use a SQL table, but use an Enscribe file (of any type): The question almost doesn't make sense. When you write to an Enscribe file, you don't specify individual column values as you do with SQL. You pass to the WRITE procedure the address and length of an area in your program's memory, and Enscribe copies those bytes directly into the file, without doing any kind of data checking. The only kind of data-related error you can get is a duplicate key error if you try to write to a key-sequenced file with the record containing the same value in the primary key field as an existing record has (same for alternate keys on any Enscribe file type if the alternate key definition does not allow duplicates). Of course, when an application program tries to use the data in the file, it might get some kind of error, depending on the programming language and operations you try to perform on the data, but Enscribe won't report any kind of data
error, since it doesn't know anything about data types.

nsks...@gmail.com

unread,
May 26, 2009, 1:00:56 PM5/26/09
to
On May 24, 5:27 pm, Keith Dick <kdic...@comcast.net> wrote:

Thanks all for your knowledgable replies, I found the problem in the
coding, Apologize for posting

Appreciate your intention to help others

0 new messages