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


The GHS Command Language is in many ways a general-purpose language. This means it may be used, among other things, for file manipulation, file editing, and text file parsing. So in the unlikely event you've never had a need for all of the ship stability, strength, and seakeeping features, GHS can still be used for many other general purpose tasks. Why should anyone (besides our programmers) care?

Most of the file-handling commands are the result of GHS's roots as a DOS program many years ago. At that time, these functions were very convenient. Today, the modern OS paradigm has stolen the limelight from many of these utility commands, but they still make for a very efficient solution to certain file-handling tasks, and a well-versed user can often accomplish tasks faster than their point-and-click coworkers.

Take for example the COPY command. The utility of this relatively simple command is evident when one is managing report or text files within a macro or runfile. To illustrate, let's assume you have the following macro which is creating a data file on each call. Since this macro is called in a loop, the file created from the previous call will be over-written during the current call. COPY makes it easy to avoid this problem by copying the file to a unique filename as the loop progresses:

 vari (real) h=0

 macro headingloop   sea /head:{h} /data:FO   copy "FORCING.DAT" "FORCING_h{h}.DAT"   erase "FORCING.DAT"   set h={h} plus 45  /

In this example, the parameter /DATA: FO is creating the data file called "FORCING.DAT". Since the data in this file is expected to vary with each loop, we use COPY to create a new file with a unique name on each loop and then ERASE the old file. Alternatively, one could use /APPEND to append the contents of each new data file to a single large data file. This might be reasonable for smaller data files, but in this case it seems more convenient to use separate files.

Now that we've told you how to accomplish this using COPY, it would be prudent to mention that the aptly named RENAME command provides a very similar function, without the need for ERASE. But where is the fun in having only one way to do something?

COPY is also useful for converting (and cropping) report file pages to image files, such as .JPG or .BMP. This functionality was previously mentioned in COW012. You may find this a convenience when a plot image is needed for another document, and you aren't using the Print File Export Wizard.

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

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

Click here for an index to this and previous COWs