Batch mode instructions (NCL)

As described in the How to run NCL section of the NCL user environment module, one of the ways of running NCL is in batch mode. This involves creating and running NCL scripts.

Creating NCL scripts

An NCL script is an ASCII file that contains valid NCL statements and comment lines. You can create NCL scripts using whatever text editor you normally use. All of the sources for the NCL examples in the Quick Start Guide are NCL scripts.

Running NCL scripts

Once you have created an NCL script, say in file my_ncl, you run it by passing it to NCL's input stream by issuing the command:

     ncl < my_ncl

The NCL interpreter will proceed to interpret, in sequence, each NCL statement in the input script. If you want NCL to check the entire script for syntax errors before proceeding, make the entire script an NCL block by surrounding it with a begin at the start and an end at the end. Most of the example NCL scripts illustrate this usage of NCL blocks.

Loading NCL scripts with the NCL load statement

NCL scripts can be inserted into other NCL scripts by using the NCL load statement. The NCL load statement is similar to the #include statement of the C programming language. The form of the load statement is:

     load "file_name"

where file_name contains an NCL script. This can be any valid NCL script, but frequently the load statement is used to include independently-defined NCL functions and procedures. The file name argument to the load statement must be a string literal.

Suppose file1 contains the single NCL statement:

     a = 5

and file2 contains the statements:

     load "file1"
     print(a)

then executing

     ncl < file2

produces the result:

Variable: a
Type: integer
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:   [1]
Coordinates: 
(0)     5


User Guide Control Panel

NG4.1 Home, Index, Examples, Glossary, Feedback, UG Contents, UG WhereAmI?


$Revision: 1.6 $ $Date: 1998/06/15 22:08:28 $