EXHIBIT 10.1

                                 DEBT AGREEMENT

           This Agreement is made and entered into this 1st day of November
2003, by and between G.S. Beckwith Gilbert, of 35 Vista Drive, Greenwich,
Connecticut 06830 ("Lender"), and MEGADATA CORPORATION, a New York corporation,
with its principal place of business at 35 Orville Drive, Bohemia, New York
11716 ("Borrower" or "Megadata"):

                                   WITNESSETH

WHEREAS, Megadata has issued numerous promissory notes to Lender for value
received;

WHEREAS, the principal amount of such notes is due at December 31, 2003, with
interest due and owing at the end of each calendar quarter at an annual rate of
9% calculated on the basis of a 360 day year;

WHEREAS, the total amount due and owing under the promissory notes as of
November 1, 2003 is $ 8,466,465; and

WHEREAS, Lender and Megadata desire to modify certain terms and conditions of
the outstanding promissory notes as of the date of this Agreement and issue a
Replacement promissory note for value received upon the terms and conditions set
forth herein.

NOW, THEREFORE, in consideration of the foregoing and the agreements contained
herein, the parties hereby agree as follows:

1. DEFINED TERMS:

   "FAIR MARKET VALUE PRICE" shall mean the price per share of Megadata's common
   stock as reported on the OTC Bulletin Board, NASDAQ or other national
   securities exchange, as applicable.

2. MODIFICATION OF PREVIOUS NOTES: All outstanding promissory notes
   previously issued to Lender totaling $ 8,466,465 in aggregate principal
   amount shall be modified as set forth herein.

3. ISSUANCE AND TERMS OF REPLACEMENT NOTE: For value received, Megadata shall
   issue a Replacement Note (the "Replacement Note") to Lender in the aggregate
   principal amount of $ 8,466,465. The Replacement Note will be in the form
   attached as Exhibit A hereto.

     a. TERM. The principal amount of the Replacement Note, together with any
        and all accrued and unpaid interest thereon, shall be paid in full on
        November 1, 2004.


                                       1
<PAGE>


     b. INTEREST. The Replacement Note shall bear interest on the unpaid
        principal amount, from the date of issuance until paid in full. The
        amount of interest due and payable under the Replacement Note for the
        period of November 1, 2003 through November 1, 2004 shall equal the
        amount obtained by multiplying 600,000 shares of Megadata common stock
        by the Fair Market Value Price of the Company's common stock on January
        15, 2004. Interest for the period of November 1, 2003 through November
        1, 2004 will be paid in advance on January 15, 2004 in the form of
        600,000 shares of Megadata common stock.

     c. METHOD OF PAYMENT. The Replacement Note payments of interest will be in
        the form of fully paid and non-assessable shares of Megadata common
        stock. The Company will transfer 600,000 shares of common stock to
        Lender as payment of annual interest on the unpaid amount of the
        Replacement Note for each quarter commencing November 1, 2003. The
        Company will transfer the total annual interest payment in the form of
        common stock on a one-time annual basis.

     d. LIMITATIONS. In addition to any other applicable resale restrictions,
        Lender agrees that he shall not be permitted in any one fiscal quarter,
        to sell or transfer more than 150,000 shares of the total 600,000 shares
        of common stock issued by the Company pursuant to this agreement.

4. MISCELLANEOUS.

     a. AMENDMENT AND MODIFICATION. This Agreement may be amended, modified and
        supplemented only by a written instrument signed by all of the parties
        hereto expressly stating that such instrument is intended to amend,
        modify or supplement this Agreement.

     b. ENTIRE AGREEMENT. This Agreement contains the entire agreement between
        the parties hereto with respect to the subject matter hereof and
        supersedes all prior agreements and understandings, oral or written,
        with respect to such matters.

     c. SEVERABILITY. If any provision of this Agreement shall be determined to
        be invalid or unenforceable under law, such determination shall not
        affect the validity or enforceability of the remaining provisions of
        this Agreement.

     d. GOVERNING LAW; JURISDICTION. This Agreement shall be governed by and
        construed in accordance with the laws of the State of New York, without
        regard to the conflicts of law rules of such state.


                                       2
<PAGE>

     e. COUNTERPARTS. This Agreement may be executed in one or more
        counterparts, each of which shall be deemed an original, and all of
        which shall constitute one and the same agreement and shall become
        effective when one or more counterparts have been signed by each of the
        parties and delivered to the other party, it being understood that both
        parties need not sign the same counterpart.

           IN WITNESS WHEREOF, the parties hereto have executed this Agreement
as of the day and year written above.


MEGADATA CORPORATION
35 Orville Drive
Bohemia, New York 11716

By: /s/ JAMES T. BARRY
--------------------------------------------
Name: James T. Barry
Title: President and Chief Executive Officer

By: /s/ LOUIS J. PETRUCELLY
--------------------------------------------
Name: Louis J. Petrucelly
Title: Chief Financial Officer


LENDER
G.S. Beckwith Gilbert
35 Vista Drive
Greenwich, Connecticut 06830

By: /s/ G.S. BECKWITH GILBERT
--------------------------------------------
Name: G.S. Beckwith Gilbert



                                       3
<PAGE>


                                                                       EXHIBIT A

                             SECURED PROMISORY NOTE

$  8,466,465                                              New York, New York

                                                          AS OF NOVEMBER 1, 2003

           For value received, the Company and G.S. Beckwith Gilbert retire all
notes issued prior to such date, the undersigned, MEGADATA CORPORATION, a New
York corporation (hereinafter referred to as "Borrower"), hereby unconditionally
PROMISES TO PAY to the order of G.S. Beckwith Gilbert ("Lender"), or his
permitted assigns, to an account designated by Lender, in lawful money of the
United States of America and in immediately available funds, the principal sum
of eight million four hundred sixty six thousand and four hundred six five
dollars ($8,466,465) together with interest on the unpaid principal amount of
this note outstanding in the form of 600,000 shares of Megadata Common Stock.

           Interest due and owing hereunder shall be payable in the form of
600,000 shares of Megadata Common Stock. Interest for the period of November 1,
2003 through November 1, 2004 will be paid in advance on January 15, 2004 in the
form of 600,000 non-assessable shares of Megadata Common Stock. The principal
amount evidenced hereby will be repaid in full on November 1, 2004. All accrued
and unpaid interest or any unpaid principal balance remaining unpaid hereunder
as of November 1, 2004, shall be payable on such date.

           Notwithstanding the foregoing, the principal amount of the
indebtedness evidenced hereby together with all accrued interest shall be
immediately due and payable upon written notice to Borrower from Lender upon the
happening of any of the following Events of Default:

(a) Any representation or warranty in the Securities Purchase Agreement, dated
September 18, 1996, between Borrower and Lender shall be untrue or incorrect in
any material respect;

(b) Any of the assets of Borrower shall be attached, seized, levied upon or
subjected to a writ or distress warrant, or come within the possession of any
receiver, trustee, custodian or assignee for the benefit of creditors of
Borrower and shall remain unstayed or undismissed for thirty (30) consecutive
days; or any person other than Borrower shall apply for the appointment of a
receiver, trustee or custodian for any of the assets of Borrower and shall
remain unstayed or undismissed for thirty (30) consecutive days; or Borrower
shall have concealed, removed or permitted to be concealed or removed, any part
of its property, with the intent to hinder, delay or defraud its creditors or
any of them or made or suffered a transfer of any of its property or the
incurring of an obligation which may be fraudulent under any bankruptcy,
fraudulent conveyance or other similar law;

(c) A case or proceeding shall have been commenced against Borrower in a court
having competent jurisdiction seeking a decree or order in respect of Borrower
(i) under title 11 of the United States Code, as now constituted or hereafter
amended, or any other applicable federal, state or foreign bankruptcy or other
similar law, (ii) appointing a custodian, receiver, liquidator, assignee,
trustee or sequestrator (or similar official) of Borrower or of any substantial
part of its properties, or (iii) ordering the winding-up or liquidation of the
affairs of Borrower and such case or proceeding shall remain undismissed or
unstayed for thirty (30) consecutive days or such court shall enter a decree or
order granting the relief sought in such case or proceeding;


                                       4
<PAGE>


(d) Borrower shall (i) file a petition seeking relief under title 11 of the
United States Code, as now constituted or hereafter amended, or any other
applicable federal, state or foreign bankruptcy or other similar law, (ii)
consent to the institution of proceedings thereunder or to the filing of any
such petition or to the appointment of or taking possession by a custodian,
receiver, liquidator, assignee, trustee or sequestrator (or similar official) of
Borrower or of any substantial part of its properties, (iii) fail generally to
pay its debts as such debts become due, or (iv) take any corporate action in
furtherance of any such action;

(e) Final judgment or judgments (after the expiration of all times to appeal
therefrom) for the payment of money in excess of $100,000 in the aggregate shall
be rendered against Borrower and the same shall not be vacated, stayed, bonded,
paid or discharged for a period of thirty (30) days; or

(f) Any other event shall have occurred which would have a material adverse
effect on Borrower or its assets or financial condition in Lender's reasonable
judgment and Lender shall have been given Borrower at least twenty (20) days
notice thereof.

           As security for any and all liabilities of the Borrower to Lender,
now existing or hereafter arising hereunder, or otherwise, Lender is hereby
given a lien upon and a security interest in any and all moneys or other
property (i.e., goods and merchandise, as well as any and all documents relative
thereto; also, funds, securities, chooses in action and any and all other forms
of property whether real, personal or mixed, and any right, title or interest of
the Borrower therein or thereto), and/or the proceeds thereof, including
(without limitation of the foregoing) that in safekeeping or in which Borrower
may have any interest. In the event of the happening of any one or more Events
of Default, Lender shall have all of the rights and remedies provided to a
secured party by the Uniform Commercial Code in effect in New York State at that
time and, in addition thereto, the Borrower further agrees that (1) in the event
that notice is necessary, written notice delivered to the Borrower at its
principal executive offices ten business days prior to the date of public sale
of the property subject to the lien and security interest created herein or
prior to the date after which private sale or any other disposition of said
property will be made shall constitute reasonable notice, but notice given in
any other reasonable manner or at any other reasonable time shall be sufficient,
(2) in the event of sale or other disposition of such property, Lender may apply
the proceeds of any such sale or disposition to the satisfaction of Lenders
reasonable attorneys' fees, legal expenses and other costs and expenses incurred
in connection with the retaking, holding, preparing for sale, and selling of the
property, and (3) without precluding any other methods of sale, the sale of
property shall have been made in a commercially reasonable manner if conducted
in conformity with reasonable commercial practices of banks disposing of similar
property.

           Demand, presentment, protest and notice of nonpayment and protest are
hereby waived by Borrower.





                                       5
<PAGE>


           This Note has been executed, delivered and accepted in the State of
New York and shall be interpreted, governed by, and construed in accordance
with, the laws of the State of New York.

                                                MEGADATA CORPORATION


                                                By:/s/ LOUIS J. PETRUCELLY
                                                ------------------------------
                                                Louis J. Petrucelly

                                                Title: Chief Financial Officer














                                       6
<PAGE>