 |
» |
|
|
|
The following listing is a COBOL program that inserts the value 42 into message number 8 in message set 201 in the message catalog SYSCAT.PUB.SYS. The message is output to $STDLIST. The accessed portion of the message catalog is:
$SET 201
.
.
.
008 The value passed for parameter #! is invalid.
|
The value passed for parameter #42 is invalid.
001000 IDENTIFICATION DIVISION.
001010 PROGRAM-ID. NM-MSGCAT.
001030*
001040 ENVIRONMENT DIVISION.
001050 DATA DIVISION.
001060 WORKING-STORAGE SECTION.
001070 77 CAT-INDEX PIC S9(9) COMP.
001080 01 CAT-STATUS.
001090 03 CAT-STATUS-1 PIC S9(4) COMP.
001100 03 CAT-STATUS-2 PIC S9(4) COMP.
001110 77 CAT-FILE PIC X(20).
001120 77 MSGLENGTH PIC S9(4) COMP.
001130 77 SETNUM PIC S9(4) COMP.
001140 77 MSGNUM PIC S9(4) COMP.
001150 77 PARM-1 PIC X(3).
001160 77 ASCII-NULL PIC X VALUE %0.
001170 77 MSGDESTINATION PIC S9(4) COMP.
001180*
001190 PROCEDURE DIVISION.
001200*
001210 START-OF-PROGRAM.
001220 PERFORM OPEN-SYSCAT.
001230 PERFORM READ-SYSCAT.
001240 PERFORM CLOSE-SYSCAT.
001250 STOP RUN.
001260*
001270 OPEN-SYSCAT.
001280 MOVE "SYSCAT.PUB.SYS%" TO CAT-FILE.
001290 CALL INTRINSIC "CATOPEN" USING CAT-FILE,
001300 CAT-STATUS
001310 GIVING CAT-INDEX.
001320*
001330* CHECK CAT-STATUS FOR SUCCESS
001340*
|
001350 READ-SYSCAT.
001360 MOVE 221 TO SETNUM.
001370 MOVE 8 TO MSGNUM.
001380 MOVE 0 TO MSGDESTINATION.
001390 MOVE "42" TO PARM-1.
001400 CALL INTRINSIC "CATREAD" USING CAT-INDEX,
001410 SETNUM,
001420 MSGNUM,
001430 CAT-STATUS,
001440 \\, \\,
001450 PARM-1,
001460 \\, \\, \\, \\,
001470 MSGDESTINATION.
001480*
001490* CHECK ERRORNUM FOR SUCCESS
001500*
001510 CLOSE-SYSCAT.
001520 CALL INTRINSIC "CATCLOSE" USING CAT-INDEX,
001530 CAT-STATUS.
001540*
001550* CHECK CONDITION CODE FOR SUCCESS
|
When this program is executed, the output is:
The value passed for parameter #42 is invalid.
|
|