4. Fortran utilities#

Name

Function

U2 MESS

Print a simple message

U2 MESK

Print both a message and character values

U2 MESI

Print both a message and integer values

U2 MESR

Print both a message and real type values

U2 MESG

Print a message, character, integer, and real values at the same time

4.1. Printing simple messages#

SUBROUTINE U2 MESS (TYPE, IDMESS)

TYPE

IN

Message type (E, F, A, I)

IDMESS

IN

message identifier

Example:

CALL U2 MESS ('A', 'CHATON_1')

Print the following message:

<A><CHATON_1>

The little cat is green Phew!

4.2. Printing messages and character values#

SUBROUTINE U2 MESK (TYPE, IDMESS, NK, VALK)

TYPE

IN

Message type (E, F, A, I)

IDMESS

IN

Message ID

NK

IN

Number of character parameters

VALK

IN

Character parameter values

Example:

VALK = 'ROSE'

CALL U2 MESK ('A', CHATON_2 ', 1, VALK)"

Print the following message:

<A><CHATON_2>

The little cat is pink in color.

4.3. Printing messages and integer values#

SUBROUTINE U2 MESI (TYPE, IDMESS, NI, VALI)

TYPE

IN

Message type (E, F, A, I)

IDMESS

IN

Message ID

NI

IN

Number of integer parameters

VALI

IN

Integer parameter values

Example:

VALI (1) = 4

VALI (2) = 2

CALL U2 MESI ('A', 'CHATON_3', 2, VALI)"

Print the following message:

<A><CHATON_3>

The little cat has 4 legs and 2 eyes.

4.4. Printing messages and values of real type#

SUBROUTINE U2 MESR (TYPE, IDMESS, NR, VALR)

TYPE

IN

Message type (E, F, A, I)

IDMES

IN

Message ID

NR

IN

Number of real type parameters

VALR

IN

Real type parameter values

Example:

VALR (1) = 130.

CALL U2 MESR ('A', 'CHATON_4', 1, VALR)"

Print the following message:

<A><CHATON_4>

The little cat weighs 130.0 kilograms.

4.5. Printing messages of character, integer and real values#

SUBROUTINE U2 MESG (TYPE, IDMESS, NK, NK, VALK,, NI, VALI, NR, VALR)

TYPE

IN

Message type (E, F, A, I)

IDMESS

IN

Message ID

NK

IN

Number of character parameters

VALK

IN

Character parameter values

NI

IN

Number of integer parameters

VALI

IN

Integer parameter values

NR

IN

Number of real type parameters

VALR

IN

Real type parameter values

Example:

VALK (2) = “pink” VALI = 5 VALR = 130. U2 MESG (“A”, “CHATON_5”, 2, VALK, 1, VALI, 1, VALR) »

Print the following message:

<E><CHATON_5>

ATTENTION: Your cat is weird, he:

- has more than 4 legs, it has 5,

- is blue and pink in color,

- is too big, it weighs 130.0 kilograms.


We stop the fees, it's not a cat!!

4.6. Printing a message in several « pieces »#

It is sometimes practical to send a message « piecemeal », that is to say to call the U2 MESG routine several times. This is in principle impossible for fatal error messages (F/E) because the code stops at the first message!

In addition, we want the complete message to appear to the user as a single message. In particular, we want it to appear in the same frame.

To do this, we have the mechanism “A+”, “F+”,… The principle is to add a “+” to the message type as long as the message is not finished. The last message in the group (without the “+”) ends the message.

For example, you can write a message in 2 pieces by writing:

CALL U2 MESK (“F+”, “FONCT0_11 “,1, NOMF)

CALL U2 MESR (“F”, “FONCT0_26 “.3, VALR)

This, combined with the following catalog:

11: _ (u » « « 

The interpolation of the function “% (k1) was not allowed.

The interpolation type of the function is” NON “

-> Risk & Advice:

See the INTERPOL keyword for commands that create functions.

« «  »),

26: _ (u » « « 

Requested abscissa:% (r1) f

interval found: [%(r2)f, %(r3)f]

« «  »),

will lead to a message that looks like:


! ——————————————————!

! <F><FONCT0_11>!

! !

! Interpolation of the func3 function is not allowed.!

! The interpolation type of the function is” NON “!

! !

! -> Risk & Advice:!

! See the INTERPOL keyword for commands that create functions.!

! !

! Requested abscissa: 105.!

! interval found: [0., 100.]!

! ——————————————————!

Notes:

  • In a message group that produces a message « piecemeal », the type of the different messages should be the same (F/A/I).

  • The printed message ID is that of the first message in the group.