|
Date fields are all stored internally as a 4-byte integer. The value stored is the number of days since January 1, 0001 or October 14, 1582, I'm not sure which it is. When a database record is touched (retrieved for any reason) the internal code converts the date from the internal form to what's called the External Form. The external form is the only format you or I can see and the only form RPG IV, C and other languages can see. Originally, if you read a DB record 1000 times, the date fields in that record were converted from the internal form to the external form 1000 times. This was one of three reasons why, years ago, I opted to avoid date data type fields in database. The other two where because IBM did not support date fields in DDS display files or print files (which, since V4R2 has been corrected) and RPGIII continues to not support them. We've pounded on the IBMers who owned the code for date data-types. I don't know if they've fixed that performance issue or not, but for large databases (those that exceed a few million records) I still avoid date data-types. But for smaller databases, I'll always opt to use them. -Bob Cozzi -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx Sent: Tuesday, January 11, 2005 9:16 AM To: RPG programming on the AS400 / iSeries Subject: Re: Date field's and their file space usage. Looks like 10 bytes to me. But I am sure there is an explanation. Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com RPower@xxxxxxxxxx Sent by: rpg400-l-bounces@xxxxxxxxxxxx 01/11/2005 06:43 AM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc Subject Re: Date field's and their file space usage. I thought actual date fields included the date separators? Wouldn't that match what you have there? Thus 5 bytes? Ron Power Programmer Information Services City Of St. John's, NL P.O. Box 908 St. John's, NL A1C 5M2 Tel: 709-576-8132 Email: rpower@xxxxxxxxxx Website: http://www.stjohns.ca/ ___________________________________________________________________________ Success is going from failure to failure without a loss of enthusiasm. - Sir Winston Churchill rob@xxxxxxxxx Sent by: rpg400-l-bounces@xxxxxxxxxxxx 11/01/2005 11:27 AM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc Subject Date field's and their file space usage. Barb, We've been conditioned to believe that date fields only take up, what, 4 bytes? However when I do a DSPPFM on a date field I see: *...+....1 2005-01-01 FFFF6FF6FF 2005001001 Has DSPPFM been customized just to make date fields look like they take up bytes? Do they really take up this much space? Or to see the real space only the use of DMPOBJ will work? Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com Tony Carolla <carolla@xxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 01/10/2005 05:41 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc Subject Re: Varying Length fields, and LikeRec Thanks! That clears it up. I guess I assumed that DSPPFM would show the actual offsets within the record, based on the length of the varying fields. I am getting x'0034', or 52, which is the correct length. I am glad the VARLEN and VARYING keywords work like that. On Mon, 10 Jan 2005 17:27:54 -0500, Barbara Morris <bmorris@xxxxxxxxxx> wrote: > Tony Carolla wrote: > > > > I am writing to a file, and one of the fields is a 150 Alpha VARLEN > > field. This file will contain a large number of history records, and > > I am doing this to conserve space: > > ... > > In debug, I see that the DS has the correct length set (52) using %Len > > to test the length. But when I write, the field in the DB file > > contains all 150 characters, with trailing spaces added. Is there a > > trick to making the WRITE op recognize the DS variable length, that > > the compiler created for me, based on the file structure, or do I have > > to eval %Trim from the DS to the actual file buffer fields? > > > > How are you determining the actual data in the file? If you're using > DSPPFM, the position of the other fields in the record will be fixed, so > DSPPFM has to show something in those unused bytes. Try doing F10 F11 > to see the hex value of the record, so you can see the 2-byte length > part of the varying field. > > For this file: > A R REC > A FLD1 10A > A FLD2 10A VARLEN > A FLD3 10A > > My record has values FLd1='aaaaaaaaaa', FLD2='bbb', and > FLd3='cccccccccc'. > > DSPPFM and it shows this: > aaaaaaaaaabbb cccccccccc > > With F10 then F11, it shows this. The xx marks the 2 length bytes for > FLD2 (value x'0003' = 3). > xx > aaaaaaaaaabbb cccccccccc > 88888888880088844444448888888888 > 11111111110322200000003333333333 > > -- > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > or email: RPG400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > > -- "Enter any 11-digit prime number to continue..." -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.