Subject: | |
From: | |
Reply To: | |
Date: | Mon, 15 Feb 1999 07:21:08 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Giridhar queried...
> Is there any significance to "$" in 7th column in HP-COBOL? Specific
> information regarding $IF and $SET is requested...
You can actually see for yourself at...
http://halley.grc.hp.com:3000/cgi-bin/LDIBook/B3150090013.11820/200
But, let me summarize. The "$SET" command allows you to set up to ten
compile time switches ("X0" thru "X9") to be used for conditional
compilation. The "$IF" command then allows you to interrogate those
switches.
Let me give you an example. Suppose that you have two versions of a
database and you want to preserve the old code while using the same code
to test the new. You could do this a myriad of different ways, most of
which are better than the following example. However, you can also do
it with the "$SET" / "$IF" combination.
Early on in the source (I usually do it right after the $CONTROL line),
you need to set your switch...
$CONTROL ...
* If X1 is on, use the new COPYLIB members...
$SET X1=ON
Later on in WORKING-STORAGE, you might do the following...
$IF X1 = ON
01 PART-MASTER-BUFF COPY PARTBUFN.
$IF X1 = OFF
01 PART-MASTER-BUFF COPY PARTBUFF.
$IF
The biggest caution that I can offer is that you need to remember to
specify the terminating "$IF"! An "$IF" command stays in effect until
cancelled by another $IF. Failure to include a terminating "$IF"
statement could cause some unusual compiles for those times when the
switches are not set...
BTW: There are also other uses for the "$" in column 7. Descriptions
may be found at the same web-site (see above). In general they are...
$DEFINE $COPYRIGHT
$INCLUDE $PAGE
$EDIT $TITLE
$VERSION $CONTROL
All of these have some very worthwhile benefits and are definitely worth
understanding if you plan to do any major (or long-term) COBOL
development on the HP 3000 platform.
Glenn
--
______________
| Navigators | Under contract to Hewlett-Packard ISG (Greeley, CO)
| |) |
| | ) | Glenn J. Koster, Sr. [log in to unmask]
| | ) | Managed Business Solutions http://www.mbsnav.com
| | ) | 214 S. College, Suite 201 970 350-5337
| |---- | Fort Collins, CO 80524 970 224-1016
| ============ |
| \__________/ |
| of Change | aka: [log in to unmask]
|______________| home: http://members.aol.com/MichiTex
|
|
|