18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Discrete Simulation Concepts<br />

statements (unseen in the normal listing) which are then interpreted by the compiler. A special<br />

compilation option may be specified that allows these statements, and any compiler-generated<br />

routines, to be included in the program listing. It is also possible to obtain a listing of the object<br />

code generated by the compiler. Although these listings are not normally of use, they can serve to<br />

determine the precise actions specified and thus prove helpful in pinpointing the source of some<br />

complex errors.<br />

Eventually all routines in a program will have been compiled without error. These routines can be<br />

submitted, with any required data, for execution. The <strong>SIMSCRIPT</strong> <strong>II.5</strong> user's manual for a specific<br />

implementation should be consulted for details on the management of the object code modules produced<br />

by the compiler and their linking and execution. Errors in program logic may then become<br />

apparent, either by the abnormal termination of the program or by the production of results that are<br />

deemed incorrect.<br />

The possible reasons for abnormal termination are many and varied. They may arise either from<br />

error conditions detected by the operating system of the machine on which the system is implemented<br />

or those detected by the <strong>SIMSCRIPT</strong> <strong>II.5</strong> system. In the first case, the action to be taken must<br />

be determined by the operating system response to the error condition, which may be independent<br />

of the <strong>SIMSCRIPT</strong> <strong>II.5</strong> system.<br />

When the <strong>SIMSCRIPT</strong> <strong>II.5</strong> system detects an error condition, it endeavors to supply meaningful<br />

information that will help you to identify and correct the source of error. An error message is produced<br />

that describes the reason for termination. A traceback is also produced, which names the currently<br />

executing subprogram, usually identifying the line of program source text corresponding to<br />

the error location, and lists any arguments and local variable values. This information is then listed<br />

for each subprogram in the hierarchy of such subprograms, leading back to the program initiation<br />

in the main routine.<br />

The precise format of this traceback, and the options that may be selected to vary its format, are<br />

implementation dependent. Consult the user's manual. In general, variables are listed by name and<br />

mode, and their values interpreted in a meaningful way. A report on the status of any input/output<br />

devices, the current contents of the future events set, and memory usage statistics are usually included.<br />

On completing the error traceback report, the <strong>SIMSCRIPT</strong> <strong>II.5</strong> system attempts to call a routine<br />

with the predefined name snap.r. If you have included a routine of this name, it will be executed<br />

at this point. This routine may include any valid <strong>SIMSCRIPT</strong> <strong>II.5</strong> statements and provides a mechanism<br />

by which a specially written routine may be added to augment the normal traceback output.<br />

Snap.r may also be written to produce additional information on the status of a program, by listing<br />

the contents of selected global variables. Examine the program status at the time of error, in conjunction<br />

with an up-to-date program listing. This will often identify an error in program logic.<br />

Many of the <strong>SIMSCRIPT</strong> <strong>II.5</strong> implementations provide for comprehensive checking and potential<br />

error detection: array subscript bound checking, invalid entity referencing, set membership and<br />

233

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!