HP3000-L Archives

October 1997, Week 5

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Thu, 30 Oct 1997 14:00:51 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (37 lines)
Greg Stigers writes:

><<The terms BY REFERENCE and BY CONTENT are new in COBOL 85. BY
>REFERENCE means that the address of the parameter is passed to the
>called program, and that program acts on the data in the calling
>program. Any change made in the called program changes the data in the
>calling program. That is the default, and it is the way parameter
>passing has worked in COBOL until COBOL 85.[>>]
>...
>Now, HP COBOL * seems * to be doing this differently, as the HP COBOL
>II/XL Reference Manual has:
><<The  BY CONTENT phrase is a feature of the 1985 ANSI COBOL standard.
>
>NOTE  Do not use the BY CONTENT phrase when calling non-COBOL
>subprograms that contain value parameters. BY CONTENT is not the same as
>BY VALUE.>>

HP COBOL isn't actually doing things differently from the standard. When
the BY CONTENT clause is used, the compiler copies the data for the
parameter to the temporary area, then passes the address of the temporary
area to the called program. The called subprogram still sees reference
parameters, but the reference is to the temporary area rather than to the
calling program's data area.

-- Bruce


--------------------------------------------------------------------------
Bruce Toback    Tel: (602) 996-8601| My candle burns at both ends;
OPT, Inc.            (800) 858-4507| It will not last the night;
11801 N. Tatum Blvd. Ste. 142      | But ah, my foes, and oh, my friends -
Phoenix AZ 85028                   | It gives a lovely light.
btoback AT optc.com                |     -- Edna St. Vincent Millay
Unsolicited mail to [log in to unmask] will be inspected for a
fee of US$250. Mailing to said address constitutes agreement to
pay, including collection costs.

ATOM RSS1 RSS2