Question: I am currently parsing a large number of zone files at my work so that we can store this data in a database and easily regenerate zone files.

I am trying to make my parser quite strict, so that we can pick up any badly formed zone files and I'm coming across some records with nothing in the 'name' field.

Example:

```
$TTL 120
$ORIGIN example.com

@    NS      example.com
@    A       192.0.2.178
www  CNAME   example.com
     A       192.0.2.144
file CNAME   example.com

```

How would that second A record be handled? And is it a valid syntax?

Answer: 
A blank "name" field means just use the same name as the previous record, so in your example that `A` record is for `www.example.com`. See §5.1 of [RFC 1035](https://www.rfc-editor.org/rfc/rfc1035).

> 
> If an entry for an RR begins with a
> blank, then the RR is assumed to be owned by the last stated owner.
> 
> 
> 

However that also makes this particular file illegal - you can't have a `CNAME` and an `A` record present at the same label. See §3.6.2 of [RFC 1034](https://www.rfc-editor.org/rfc/rfc1034).
I know this is an old question - just stumbled accross it whilst look for something else, anyway the last comment - *"A blank "name" field means just use the same name as the previous record"* is NOT correct.

Any time a label is absent from a zone file (the label is the field on the left - i.e., the hostname or fully qualified domain name), it is qualified by the value of the `$ORIGIN` variable (`$ORIGIN` = *example.com* in this case - which can also be referenced by `@`).

So in the above zone file, the record...

`A 192.0.2.144` *is the same as*  

`example.com A 192.0.2.144` *as is..*  

`@ A 192.0.2.144`

Having said all that, this zone file contains quite poor syntax as none of it seems to be FULLY qualified - i.e. no trailing dot at the end for the root - as in

`$ORIGIN example.com.`  

and   

`somehost.example.com. IN A 192.0.2.144`  

I'm guessing the nameserver either didn't work well or was buggy.

Basically/generally in BIND zone file at least, if not fully qualified by trailing dot the the value of the $ORIGIN var is appended to the label.