Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[B&S] : Sun's official reply for null-terminated strings

 
Vincent Hernandez
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should make this very clear and specify that I only asked regarding my particular assignment, B&S 2.2.3.

I emailed Sun ( who2contact@sun.com ) with the following:

I have received my assignment and ask:

May I receive a clarification regarding null-terminated values?

I'm doing Bodgitt and Scarper assignment version 2.2.3, and have two lines that confuse the heck out of me.

First line is from Data File Format, Data section of the assignment:

"Data section.
Repeat to end of file:
1 byte flag. 00 implies valid record, 0xFF implies deleted record Record containing fields in order specified in schema section, no separators between fields, each field fixed length at maximum specified in schema information."

Which strongly implies "fixed field format", which would be padded by spaces.

Second quote, last paragraph in Data File Format section:

"All text values, and all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field."

Which comes to say that strings within fields should be null-terminated if shorter than field width.

Using a hex-editor, I have seen that the data file as provided by Sun contains no such null-values, regardless of the record fields being less than the maximum length for the field.

I would request a clarification on this matter since code consistency and clarity is of the up-most importance when grading submitted assignments.


Thank you


I received the following response from Monica Green at Sun yesterday (Saturday, January 8, 2005):

> Sorry about the confusion. There's a typo in your assignment. Please
> ignore all references to null-terminated or null-padded values. Treat
> the fields as space padded.
 
Frans Janssen
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow! That is a very clear reply that takes away all room for doubt. Thanks for posting that here!

I think Sun's excuse is a bit lame BTW. My assignment contains the same "typo" and it does not really look like a slip of the keyboard...

Frans.
 
Vincent Hernandez
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm glad to have helped Frans. It's kinda "lame" that Sun did this to us, but at least the reply was not vague. I was sort of scared at first I'd get a reply on the order of "it's a design decision you must make" or something to that order.

Though I should probably stress again I asked only for my assignment, which is B&S 2.2.3. However, as Frans just mentioned, if the wording is the same in other assignments as how I specified in my email (see original post), I'd assume the same typo carried over.
[ January 09, 2005: Message edited by: Vincent Hernandez ]
 
Clivant Yeo
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the null-ternminated thing also, if it was really a typo, why the phrase appears in so many/all project specifications. But using space padded will not make the specification professional.
 
Vincent Hernandez
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I got the null-ternminated thing also, if it was really a typo, why the phrase appears in so many/all project specifications. But using space padded will not make the specification professional.


Probably (at least metaphorically) there were a lot of copy/paste operations.

As for being professional, most databases support the importation of fixed-field files. I know MS Access has a Import Wizard that supports it, as does Oracle with sqlldr (provided you define the field start position and field length ).
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12008
216
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might also like to consider an earlier response to the same question.

Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic