HP3000-L Archives

August 2003, Week 1

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:
Bruce Collins <[log in to unmask]>
Reply To:
Bruce Collins <[log in to unmask]>
Date:
Mon, 4 Aug 2003 12:07:44 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (77 lines)
In COBOL the values of the condition codes CCL, CCE, CCG correspond to less,
equal to, or greater than zero. These aren't actually returned by the
intrinsic, but are set based on the results of the last intrinsic call.

In C they have provided a ccode() function to return the condition code. In
mpe.h.sys they have defined CCE as 2. You code will look less confusing to
an old timer MPE programmer if you code it to use these defines and don't
worry about what value they actually contain:

if ( ccode() == CCE )

Another thing that you should be wary of is that ccode() always returns the
code for the last intrinsic called, so you should avoid code like:

if (ccode() == CCE )
{ /* do something */ }
else if ( ccode() == CCG )
{ /*do something else */)

It is safer to assign the value of ccode() into a variable and check the
variable. That is:

c_code = ccode();
if (c_code == CCE )
{ /* do something */ }
else if ( c_code == CCG )
{ /*do something else */)



----- Original Message -----
From: "Peter Smithson" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Monday, August 04, 2003 11:32 AM
Subject: Re: [HP3000-L] PRINT intrinsic condition code value


> In article <[log in to unmask]>,
> [log in to unmask] says...
>
> > http://docs.hp.com/cgi-bin/doc3k/B3265090821.13550/9
>
> Now I'm confused!  That page gives one table for "Condition code
> descriptions" and another for "Status info parameter identifiers".
>
> The manual page I have describes the PRINT intrinsics condition codes.
>
> The COBOL test prog -
>
>        SPECIAL-NAMES.
>            CONDITION-CODE IS CC.
> ....
>             CALL intrinsic "PRINT" USING PTEXT PLENGTH CNTRL-CODE.
>            IF CC NOT = 0
>              DISPLAY "INTRINSIC 'PRINT' HAS FAILED".
>
> returns values consistent with the "status info" value.
>
> So in other words it seems that COBOL is giving me the "status info"
> values and the C test program (using ccode()) is giving me the
> "Condition code" values.
>
> Help!
>
> I supose I could just not care why it does this.  In which case you
> might be able to help me.  Presumably this is consistent with other
> intrinsics and PRINT isn't a special case?  As long as I know the rules
> then I can live with it.
>
> Peter
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2