Novell is now a part of Micro Focus

NetBasic: IntranetWare's Scripting Language

Articles and Tips: article

Senior Research Engineer
Developer Information

01 Nov 1996

Provides an overview of NetBasic, including information on server-based application development and how to expose network services with NMX.


The release of IntranetWare further develops the Net2000 architecture, which enables you to use four different approaches to developing networked applications:

Figure 1: The Net2000 application development architecture.

Software libraries and components provided under the Net2000 initiative will enable you to access Novell's networking services using the Java language, rapid application development (RAD) environments (like Delphi , Visual Basic , and PowerBuilder ), NetBasic scripts, and C/C++. (See the August '96 issue of Novell Developer Notes for articles on NetWare application development using Java, Delphi, and Visual Basic.)

Server-based Application Developmentm

Previously, the primary method for developing server-based applications for NetWare has been to write a NetWare Loadable Module (NLM) in C. NLM development in C can be a rather complex process, requiring special attention to memory management, pointer addressing, function timing, and control of the CPU. For this reason, most NLMs have been developed as shrinkwrapped products by organizations that have the resources to do the necessary development and testing. For the most part, corporate developers have been hesitant to make the commitment and take the risk to develop and deploy their own NLMs on their company's production servers.

Articles in past issues of DevNotes have told you about alternate server-based development environments from SimWare ("Developing NetWare Server Utilities with SimWare's REXXWARE," Nov/Dec '94) and HiTecSoft ("Developing NLMs and NetWare Utilities with HiTecSoft's ManageWare," Sept/Oct '94). We have also introduced you to object-oriented NLM development in C++ (Mar/Apr '95, Nov '95, and Jan '96).

NetBasic promises to change the face of NetWare server-based application development. NetBasic was developed by HiTecSoft, based on its ManageWare Network Management Language development environment. NetBasic allows you to develop server-based applications in a Visual Basic-compatible scripting language. The NetBasic Interpreter, included with IntranetWare, takes care of most of the memory management and timing considerations that have complicated server-based application development in the past, enabling you to rapidly develop and confidently deploy applications that you develop.

The most obvious application of NetBasic is to write scripts to automate server-management tasks. The example program at the end of this DevNote shows how to use NetBasic to make a backup copy of a directory at a specified time every day. The NetBasic scripting engine also interfaces with the NetWare Web Server CGI interface to allow basic scripts and NLMs to be accessible and publishable through the intranet and Internet. NetBasic for Internet has created basic scripting abstractions to the HTML DOC commands to enable basic scripts to

  • Dynamically build HTML pages.

  • Publish your existing databases via the Web (with secure access control through NDS).

  • Create, view, and modify files on your NetWare file server via the Web.

  • Create secure Internet commerce applications to accept orders and credit card information.

HiTecSoft also has a Basic script compiler that will compile your script to a stand-alone NLM.

Exposing Network Services with NMX

The part of the Net2000 architecture that makes it possible to access network services from a Basic script is known as the Net2000 Network Management Extensions (NMX). The Net2000 NMX is a set of Application Programming Interfaces (APIs) and development guidelines for creating an open architecture for NetWare Loadable Modules and Basic script libraries. Components (NLMs or basic scripts) built using the NMX APIs are referred to as "NMX Compliant" libraries that can be created using Novell's NLM SDK, C/C++ compilers, NetBasic IDE, or Visual Basic.

NMX compliant NLMs and Basic libraries can be loaded and unloaded on demand, maximizing the availability of cache memory on the IntranetWare server. Administrators can write scripts that can load a specific component (NLM or another script), such as backup, at a specific time, rather than have the backup component loaded all the time. This can free up more memory for normal processing until the backup component is needed during off hours.

The primary advantage, however, is that NMX compliant components can make their functions available to a common scripting language. For example, you could write a Basic script that uses the NDS component to authenticate a user accessing the server over the Web, check for their rights to a server directory, then use the Oracle component to query a database and display the results of the query. Some of the NMX compliant components currently available are:

American Power UPS Component and Exide Electronics This component enables basic scripts, Java, C/C++ programs, and Internet Web Browser access to simple calls to get power supply information and provide UPS monitoring services.

Oracle Database The NetBasic Oracle Database component allows developers to access SQL queries. Abstractions to the Oracle SQL server enable developers to easily login and logout, execute SQL commands, enumerate records, and have full access to the Oracle SQL database.

Btrieve Database Module The Database Module for Btrieve supports over 80 functions to access the full features of the Btrieve database. Open, close, get, getnext, getequal, and other database functions are easily accessible. The Btrieve component automatically loads the Btrieve NLM when calls are made.

Cheyenne FAXSERVE Net2000 NMX Component. Cheyenne FAXSERVE Component provides a easy one-call method to access and use Cheyenne's fax services in sending reports, notifications, and call backs. The simple FAX call supports parameters for a cover page file, text body file and phone number.

SNMP Net2000 NMX Component. The SNMP Component provides developers with an easy and standard alert mechanism to send out alerts to any SNMP agent across the network.

FTP Net2000 NMX Component. The FTP Net2000 Component provides Basic scripts , C/C++, Java the ability of sending and receiving files over Internet, which can be used to implement electronic file distribution and Internet-based backup.Some of the other components currently under development are: Cheyenne ArcServe, dBase, and Arcada Backup Exec.

See these Web sites for more information:

Example Program: NETBACK.BAS

This program illustrates how to use NetBasic to automate network management tasks. It backs up a predefined directory once a day to a predefined backup directory. Between backups it wakes up once a minute to check the time.

Sub Main





#define DIR           "SYS:TEMP"

#define TIME          "02:00:00"

(2,3); ("NETBACK.NLM is active")

Szbuf = "At time " + TIME + " (HH:MM:SS) " + "each day"

WIN:At(4,5); WIN:Say(Szbuf)

Szbuf = "the contents of " + DIR + " will be backed up to " +


WIN:At(5,5); WIN:Say(Szbuf)

WIN:At(7,5); WIN:Say(" Press any key to deactivate NETBACK.NLM")

NewDay = True; DispRow = 9; FileCnt = 0; OldDObj = SYS:Date:Get

Do While ()

      ' Get default file server date and time information.

      NewDObj = 

      ' Should we check for a new day?

      If (NewDay = False)

          ' Is it a new day?

          If ((NewDObj.Date,NewDObj.Time) > 


                NewDay = True

                OldDObj = NewDObj



      ' If it is a new day, is it past time to backup, and have we backed up already?

      If ((DATE:Utf(NewDObj.Date,NewDObj.Time) > DATE:Utf(NewDObj.Date,TIME))

& (NewDay = True))

          ' Does the backup directory exist?  If not create it.

          DirObj1 = (DIR)

          DirObj2 = 

          DirObj2.Volume.Name = DirObj1.Volume.Name

          DirObj2.Path = DirObj1.Path + DirObj1.File.Name


          DirObj1 = DIR:Object(BACKUP_DIR)

          DirObj2 = DIR:File:Get("")

          DirObj2.Name = DirObj1.File.Name


          FileObj = (DIR + "\*.*")

          ' Copy all files from the target directory to the backup directory.

          Do While (FileObj.Error = 0)

                If (FileObj.Type = "FILE")

                    FileName = FileObj.Name

                    If (STR:Length(FileObj.Extension) > 0)

                        FileName = FileName + "." + FileObj.Extension


                    If ((DIR + "\" + FileName,BACKUP_DIR + "\" +

FileName) = True)

                        FileCnt = FileCnt + 1

                        If (DispRow = 20)

                                DispRow = 9


                        Szbuf = (" ",70)

                        WIN:At(DispRow,7); WIN:Say(Szbuf)

                        Szbuf = "File: " + FileName + " copied to " +


                        WIN:At(DispRow,7); WIN:Say(Szbuf)

                        DispRow = DispRow + 1



                FileObj = (FileObj)


          ' Report the results of the backup.

          Szbuf = STR:Repeat(" ",70)

          WIN:At(22,5); WIN:Say(Szbuf)

          Szbuf = "Backup completed for " + NewDObj.Date + " " +


          WIN:At(22,5); WIN:Say(Szbuf)

          Szbuf = STR:Repeat(" ",70)

          WIN:At(23,5); WIN:Say(Szbuf)

          WIN:At(23,5); WIN:Say((FileCnt) + " Files Copied")

          NewDay = False; FileCnt = 0


      If ()



      ' Go to sleep for 1 minute




* Originally published in Novell AppNotes


The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates