General HydroStatics
Ship Stability Software
Command of the Week
(New or interesting aspects of GHS that you may not know about)

Table of Contents


One of the nice things about GHS is that you can make unique combinations of commands to create clever solutions much like building from LEGO blocks. Each time you learn a new GHS command, your block collection becomes a little larger and the universe of tasks you can accomplish expands.

Ponder for a moment what kind of building blocks you would need to enhance a very long report with an automatically generated Table of Contents? Here is a quick recipe:
- The key ingredient is a well-prepared string VARIABLE containing a description and page number.
- Have the evaluation macro add these strings to a MESSAGE (REPORT) file.
- Import the MESSAGE file into an open report with VIEW.
- Finally, append the original GHS report file with COPY.
If you want to see the details, the run file that creates the table shown below can be found here.


Note: The GHS report previewer lets you skip right to the page you want.

It only takes 20 lines of code to make the table shown above. Most of those are spent adding dots between the description and page numbers. The procedure and most of the code would be exactly the same if added to a different run file. If you wanted to make the table even more useful, it would be easy to add a Pass/Fail report or LIMIT margin to the description.

A couple of elements in the run file are worth mentioning. First, an IF command uses the system VARIABLE REPFILE to start the report after the first SUBTITLE. This ensures that the SUBTITLE appears at the start of the first damage case.

Second, the tanks in each damage case are stored in a series of indexed user VARIABLES. This simplifies the run file structure and reduces repetition. Numbering the variables makes it easy to loop through the damage cases and with the case number as the only parameter, the evaluation macro is easy to understand and modify.

Questions, comments, or requests?
Contact Creative Systems, Inc.

support@ghsport.com

USA phone: 360-385-6212 Fax: 360-385-6213
Office hours: 7:00 am - 4:00 pm Pacific Time, Monday - Friday

Mailing address:
PO Box 1910
Port Townsend, WA 98368 USA

www.ghsport.com

Click here for an index to this and previous COWs