 |
» |
|
|
|
The following listing is a COBOL program that inserts the value 95 into message number 201 in message set 1 in the message catalog CATALOG.PUB.SYS. The message is output to $STDLIST. The accessed portion of the message catalog is:
$SET 1
.
.
.
210 SYSTEM LOG FILE NUMBER ! is ON
|
001000 IDENTIFICATION DIVISION.
001100 PROGRAM-ID. CM-MSGCAT.
001300*
001400 ENVIRONMENT DIVISION.
001500 DATA DIVISION.
001600 WORKING-STORAGE SECTION.
001700 77 FILE-NUM PIC S9(9) COMP.
001800 77 DESIGNATOR PIC S9(9) COMP VALUE 2.
001900 77 DOMAIN PIC S9(9) COMP VALUE 3.
002000 77 MULTIREC PIC S9(9) COMP VALUE 15.
002100 77 BUFFERED PIC S9(9) COMP VALUE 46.
002200 77 ASCII-BINARY PIC S9(9) COMP VALUE 53.
002300 77 HPFOPEN-STATUS PIC S9(9) COMP.
002400 77 HPFOPEN-FILE PIC X(20).
002500 77 PERM-DOMAIN PIC S9(9) COMP.
002600 77 MULTIREC-ON PIC S9(9) COMP.
002700 77 INHIBITED PIC S9(9) COMP.
002800 77 ASCII-FILE PIC S9(9) COMP.
002900 77 MSGLENGTH PIC S9(4) COMP.
003000 77 SETNUM PIC S9(4) COMP.
003100 77 MSGNUM PIC S9(4) COMP.
003200 77 PARM-MASK PIC S9(4) COMP.
003300 77 PARM-1 PIC S9(9) COMP.
003400 77 MSGDESTINATION PIC S9(4) COMP.
003500 77 ERRORNUM PIC S9(4) COMP.
003600 77 DISPOSITION PIC S9(4) COMP.
003700 77 CLOSE-SECURITY PIC S9(4) COMP.
003800*
003900 PROCEDURE DIVISION.
004000*
004100 START-OF-PROGRAM.
004200 PERFORM OPEN-CATALOG.
004300 PERFORM READ-CATALOG.
004400 PERFORM CLOSE-CATALOG.
004500 STOP RUN.
004600*
|
004700 OPEN-CATALOG.
004900 MOVE "%CATALOG.PUB.SYS%" TO HPFOPEN-FILE.
005000 MOVE 1 TO PERM-DOMAIN.
005100 MOVE 1 TO MULTIREC-ON.
005200 MOVE 1 TO INHIBITED.
005300 MOVE 1 TO ASCII-FILE.
005400 CALL INTRINSIC "HPFOPEN" USING FILE-NUM,
005500 HPFOPEN-STATUS,
005600 DESIGNATOR,
005700 HPFOPEN-FILE,
005800 DOMAIN,
005900 PERM-DOMAIN,
006000 MULTIREC,
006100 MULTIREC-ON,
006200 BUFFERED,
006300 INHIBITED,
006400 ASCII-BINARY,
006500 ASCII-FILE.
006600*
006610* CHECK HPFOPEN-STATUS FOR SUCCESS
006620*
006700 READ-CATALOG.
006900 MOVE 1 TO SETNUM.
007000 MOVE 201 TO MSGNUM.
007100 MOVE 0 TO MSGDESTINATION.
007200 MOVE 95 TO PARM-1.
007300 MOVE %13333 TO PARM-MASK.
007400 CALL INTRINSIC "GENMESSAGE" USING \FILE-NUM\,
007500 \SETNUM\,
007600 \MSGNUM\,
007700 \\, \\,
007800 \PARM-MASK\,
007900 \PARM-1\,
008000 \\, \\, \\, \\,
008100 \MSGDESTINATION\,
008200 ERRORNUM.
008400*
008410* CHECK ERRORNUM FOR SUCCESS
008420*
008500 CLOSE-CATALOG.
008700 MOVE 0 TO DISPOSITION.
008800 MOVE 0 TO CLOSE-SECURITY.
008900 CALL INTRINSIC "FCLOSE" USING FILE-NUM,
009000 DISPOSITION,
009100 CLOSE-SECURITY.
009200*
009300* CHECK CONDITION CODE FOR SUCCESS
009400*
|
When this program is executed, the output is:
SYSTEM LOG FILE NUMBER 92 IS ON
|
|