× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: default value with SQL table
  • From: bmorris@xxxxxxxxxx
  • Date: Mon, 18 Dec 2000 13:33:59 -0500
  • Importance: Normal


>Date: Mon, 18 Dec 2000 09:47:57 -0600
>From: BEllis@oriental.com
>
>Actually, we are running into this with SQL tables that have fields
defined
>straight numeric or character.
>It's like RPG ignores the default value setting on the fields within the
>file.
> ...
>>     Phil Groschwitz wrote
>>I created a table via sql/400 and defined a date field
>>with a default value of 1970-12-15.  When I insert a
>>record in the file, without referencing the date
>>field, using UPDDTA and SQL, the default value is
>>inserted into the date field.
>> ...
>>Does this work in RPGIV?

RPG does indeed ignore the default value setting on the fields.  RPG has
always worked this way.  See "Using Output Specifications" in the
"Defining Files" section of the Programmer's Guide where it talks about
creating a new record: "Fields not specified in the output field specs
or not meeting the conditions specified by the output indicators are
written
as default values, ... (for example: a blank for character fields ...)".

ILE RPG allows you to initialize an externally-described data structure
with the default values using INZ(*EXTDFT).  You could use the subfields of
such a data structure to set the fields that you don't want to output, and
then output them.

(This scheme would not work for dates that default in the database to the
current system date since the data structure is initialized when the
program
starts and the date might change; you would have to use the TIME opcode to
get the current date for each record.)

Barbara Morris


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.