• Keine Ergebnisse gefunden

Creating and Using Messages

Im Dokument IBM System/32 (Seite 142-148)

MESSAGES

Message text can be retrieved from a message load member in the library and dis-played on the display screen or printed. There are two levels of messages: level 1 and level 2. Level 1 messages are a maximum of 40 characters long and level 2 messages are a maximum of 200 characters long. A level 2 message is an extension of a level 1 message that further describes the error. A level 2 message can be displayed only after the level 1 message of the same MIC (message identification code) is issued.

User messages are created and used by doing the following:

1. Creating a message source member.

2. Creating a message load member.

3. Specifying the messa~e load member.

4. Retrieving the messages.

Creating a Message Source Member

The first entry in the source member must be the message control statement, which specifies the name of the message load member to be created and whether it is a first or second level message load member. The message text statement consists of the MIC and the text (actual message). For a detailed description ol the message control statement and the message text statement, see index entry: message source member.

Once the message source member statements have been defined, the message source member is put into the library by either using the $MAINT utility program or the Source Entry Utility Program Product.

The following is an example of a message source member called USERM1:

USERMSG,1

12. 34 THIS PROCED. URE RUNS THE PAYROLL PROGRAM.}

1235 THE INPUT IS IN A DISKETTE FILE. - - - . 1236 INSERT DISKETTE NUMBER 123456.

Message Control Statement MIC and Message

Text Statements

Creating and Using Messages 119

Page of GC21-7593-3 Issued 22 November 1978 By TNL: GN21-7993

UsingSEU

To put a message source member called USERM1 into the library using SEU, key SEU USERM1,S and the message source member statements you have defined. The entries for the message source member USERM1 would be:

SEU USER.M 1,S Source Member Name

USERMSG,l 1234 THIS PROt.EDURE RUNS THE PAYROll PROGRAM.

I

1235 THE INPUT IS IN A DISKETTE FI LEo Message Source Member 1236 INSERT DISKETTE NUMBER 123456.

For further information on using SEU, see IBM System/32 Utilities Program Product Reference Manual Source Entry Utility, SC21-7605.

Using the $MAINT Utility

The following OCl is needed to put the message source member, USERM1, into the library using $MAI NT:

II lOAD$MAINT Source Member Name

II RUN

J

II COpy FROM-READER,LlBRARY-S,NAME-USERM1 ,TO-F1,RETAIN-P,RECl-45

USERMSG,l 1234 THIS PROCEDURE RU. NS THE PAYROll PROGRAM. .

I

Message Source Member 1235 THE INPUT IS IN A DISKETTE FilE.

1236 INSERT DISKETTE NUMBER 123456.

II CEND II END

CREATING A MESSAGE LOAD MEMBER

To create a message load member named USERMSG from the above source member (USERM1), use the CREATE procedure by entering:

CREATE USERM1

Once this is done, your messages 1234, 1235, and 1236 are ready to be used by the message OCl statement or your program. For more information on the CREATE procedure, see index entry: CREA TE procedure.

Creating and Using Messages

MESSAGES

Message text can be retrieved from a message load member in the library and dis-played on the display screen or printed. There are two levels of messages: level 1 and level 2. Levell messages are a maximum of 40 characters long and level 2 messages are a maximum of 200 characters long. A level 2 message is an extension of a level 1 message that further describes the error. A level 2 message can be displayed only after the level 1 message of the same MIC (message identification code) is issued.

User messages are created and used by doing the following:

1. Creating a message source member.

2. Creating a message load member.

3. Specifying the message load member.

4. Retrieving the messages.

Creating a Message Source Member

The first entry in the source member must be the message control statement, which specifies the name of the message load member to be created and whether it is a first or second level message load member. The message text statement consists of the MIC and the text (actual message). For a detailed description of the message control statement and the message text statement, see index entry: message source member.

Once the message source member statements have been defined, the message source member is put into the library by either using the $MAINT utility program or the Source Entry Utility Program Product.

The following is an example of a message source member called USERM1:

USERMSG,l

1234 THIS p . ROCEDURE RUNS THE PAYROLL PROGRAM.}

1235 THE INPUT IS IN A DISKETTE FILE.

1236 INSERT DISKETTE NUMBER 123456.

Message Control Statement MIC and Message

Text Statements

Creating and Using Messages 121

UsingSEU

To put a message source member called USERM1 into the library using SEU, key SEU USERM1,S and the message source member statements you have defined. The entries for the message source member USERM1 would be:

SEU USER.M1,S Source Member Name

1234 THIS'PROCEDURE RUNS THE PA. YROLL PROGRAM.

USERMSG 1

I

r,"

1235 THE INPUT IS IN A DISKETTE FILE. Message Source Member 1236 INSERT DISKETTE NUMBER 123456.

For further information on using SEU, see IBM System/32 Utilities Program Product Reference Manual Source Entry Utility, SC21-7605.

Using the $MAINT Utility

The following DCL is needed to put the message source member, USERM1, into the library using $MAI NT:

II LOAD $MAI NT Source Member Name

II RUN

l

II COpy FROM-READER,LlBRARY-S,NAME-USERM1 ,TO-F1 ,RETAIN-P,RECL-45 USERMSG,1 1234 THIS PROCEDURE RUNS THE PAYROLL PROGRAM.

I

1235 THE INPUT IS IN A DISKETTE FILE. Message Source Member 1236 INSERT DISKETTE NUMBER 123456.

II CEND II END

CREATING A MESSAGE LOAD MEMBER

To create a message load member named USERMSG from the above source member (USERM1), use the CREATE procedure by entering:

CREATE USERM1

Once this is done, your messages 1234, 1235, and 1236 are ready to be used by the message OCl statement or your program. For more information on the CREATE procedure, see index entry: CREATE procedure.

SPECIFYING THE MESSAGE LOAD MEMBER

Message load members PROGRAM1 and PROGRAM2 are used by IBM program products to assign names to associated message load members. In order to retrieve the messages you have created, you must specify which message load member they are in with the MEMBER OCL statement. In our example, the message load member was a first level message load member named USERMSG. To specify this message load member, the MEMBER statement would be:

II MEMBER USER1-USERMSG

For more information on the MEMBER statement, see index entry: II MEMBER statement.

RETRIEVING THE MESSAGES

After the messages are placed in a message load member and the load member is specified by the MEMBER OCl statement, messages can be retrieved by using either the message OCl statement (f /*) or your program.

Retrieving Messages by Using the Message OCL Statement

To retrieve the first message from the message load member USERMSG as shown in the previous example, the following message OCl statement would be used:

II * 1234

This would cause the first message (THIS PROCEDURE RUNS THE PAYROll PROGRAM.) to appear on the display screen.

The following is an example of a procedure (named PAYROll) that would use the messages in the previous message source member example (USERMSG):

II MEMBER USER1-USERMSG II * 1234

II * 1235 II * 1236 II PAUSE

II lOAD PAYROll1 II RUN

When this procedure is run, the following messages would appear on the display screen:

THIS PROCEDURE RUNS THE PAYROll PROGRAM.

THE INPUT IS IN A DISKETTE FI LEo INSERT DISKETTE NUMBER 123456.

ACTION SCP 1162 CRPS OPTIONS (0 )?

PAUSE-WHEN READY, ENTER 0 TO CONTINUE

Creating and Using Messages 123

A PAUSE statement normally follows the message statement if an operator response is required. The PAUSE statement causes the SCP to suspend processing, allowing the operator time to perform the action required in the message. For more information on the PAUSE statement, see the index entry: II PAUSE statement.

Retrieving Messages by Using VourProgram

You can retrieve some messages through your program. For information on how to do this and what messages cannot be retri.eved, see the IBM Systeml32 RPG /I Reference Manual, SC21· 7595.

RESTRICTIONS ON RETRIEVIN·GMESSACU:S

A level 2 message can only be displayed immediately after the level 1 message if the same MIC has been issued. Since processing is not stopped when you retrieve a message using OCL,level 2 messages cannot be used. This is true even when a PAUSI: statement is used. This restriction is not always true when messages are retrieved by your program. For more information, see the IBM Systeml32 RPG /I Reference Manual; SC21-7695.

Im Dokument IBM System/32 (Seite 142-148)