BMP-initiated Command and Message Capability


You have two extra methods of issuing commands that contain PSB or DBD names.

From any terminal you may enter a command of the form

/LOG /STOP DB <db-name> LSYS <Lsys-name>

Using this approach, the unconverted database or program names may be used. The DFSAOE00 exit will intercept the commands, translate the appropriate names using the logical system information and ship the translated command to the COPEAOI started task for execution. You may also execute the COPEBCMD program as a BMP and specify a set of commands as SYSIN to the utility. In this case the logical system is specified in the job card, the IMSID field or on a COPEBSYS DD card as with any BMP job running under COPE.

An example of the JCL required to execute the COPEBCMD program (BMP) job follows:

//COPEBCMD EXECIMSBATCH,MBR=COPEBCMD,PSB=COPEXPP1,IMSID=CO51
//SYSUDUMP DD SYSOUT=*










COPE or IMS commands can also be executed from a batch (BMP) job by using the COPEIMS3 program (which uses COPEIMS1 PSB), for example:

//COMMAND1 EXEC PGM=DFSRRC00,
// PARM='BMP,COPEIMS3,COPEIMS1,,,,,,,,,,,&XIMSID'
//STEPLIB DD DSN=TFTPROD.COPE.LOAD,DISP=SHR
// DD DSN=IMSVS.TEST2.RESLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
COPE TESTSYS FROM DFTI9L02
COPE MSG &ZUSER SEND MYSELF A MESSAGE
COPE STO DB DEMOSYS
//*

In the above, the first command logs user DFTI9L02 onto Lsys TESTSYS; the second sends a message to &ZUSER (which will be substituted with the id of the person who SUBmits this JCL); the third stops all databases in Lsys system DEMOSYS.

This is useful for logging COPE users onto Lsys's en-mass, when initializing the USTDLMGR database. Stopping many Lsys's is useful after an IMS cold start, or IMSGEN, when all Lsys's will come up started, though normally only a few would be required active at a time.

A COPEIMS3 step is also used to issue a REFRESH command, in the supplied MFS import job, and in the ACBGEN job.

COPEIMS3 inserts the transactions on the SYSIN control cards to the IMS message queue. Non-COPE transactions can be inserted using this program (place the transaction code on the front, delimited by a blank). For example:

//ISRTIT1 EXEC PGM=DFSRRC00,
// PARM='BMP,COPEIMS3,COPEIMS1,,,,,,,,,,,&XIMSID'
//STEPLIB DD DSN=TFTPROD.COPE.LOAD,DISP=SHR
// DD DSN=IMSVS.TEST2.RESLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
MYTRANS MYDATA
//*

The listing on SYSPRINT from COPEIMS3 shows what was inserted, it does not show the results of running the transactions. The transactions will run in the IMS system asynchronously with the COPEIMS3 BMP.

A transaction can be continued over more than one line by putting a "-" or "+" continuation character at the end. "-" includes leading blanks on the next card, "+" removes them (similar to CLIST language). The maximum length of a transaction created in this way is 255 bytes. Multi-segment input transactions cannot be created from COPEIMS3.

When the transaction being inserted is a COPE transaction, the SYSPRINT listing will show that " BJ Jobname", is added to the end. Eg.

COPE MSG #TS1002 MY MESSAGE TO MYSELF BJ #TS1002G

In the above, "#TS1002G" on the end is the Jobname. COPE uses this to identify the "batch user" under which it will run the transactions. For MSG commands, this leads to the Jobname being identified as the source of the message on the online screen. E.g.

=MSG=> MY MESSAGE TO MYSELF #TS1002G

The "BJ" (for Batch Job) and the Jobname is stripped of the transaction before processing. The results of running COPE transactions from batch jobs are displayed on the message region job log. This can help to determine what commands are actually executed.

The BMP batch user (identified by Jobname) can be logged onto an Lsys, have TRACE on or off, etc., just like an online user.

For all transactions inserted by COPEIMS3, whether COPE or non-COPE, the &variables listed in the following table, if present, will be substituted.

COPEIMS3 Predefined Substitutable &variables

Variable

Example Value

Description

&DATE

THU 6 SEP, 1990

Day of week, day, month and year

&TIME

14:42

Current time

&JOBNAME

#TS1002R

Job name

&STEP

MSG1

Step, or Step.Procstep

&PGMR

RESTORE

Programmer name field on job card

&JNUM

J1323

Job number

&DAYMTH

THU 06 SEP

Same as DATE, without year

&SYSID

F090

CPU id

&CC

OK

Description of job's cond codes

&IFCC

4 STEPS, 4 CC=0 OK

4 CC=0 RESTORE THU 06 SEP 199

&MSG

J1323 OK 4 STEPS

All-purpose combination of above

Considerations for &variables substituted by COPEIMS3 are:

  • &MSG is intended to be used for sending back a standard job summary message, as the last step of the job, e.g.:

    //MSG2 EXEC PGM=DFSRRC00,COND=EVEN,






  • Put COND=EVEN on the job summary step, so you will get a message back if the job abends.
  • You can use an @ instead of an & for these variables (may help show the distinction from SUB command &variables), e.g.:

    MSG &ZUSER @JNUM @PGMR STARTED @TIME MSG
    &ZUSER @MSG

    Note

    In the above, &ZUSER is substituted by SUB, not by COPEIMS3, and therefore cannot be written @ZUSER.

  • &CC is a general-purpose conditional summary phrase (which forms part of what you get with &MSG). The following parts form the &CC phrase; each part is present only when appropriate:

    Variable Substitution for &CC

Example

Description

ABEND SB37!

Abend Codes

7 STEPS 1 NOEX

No. of preceding steps in Job0

3 CC=0

No. of Non-executed steps

2 CC=8

No. of zero COND-code steps

2 CC<=8

No. of 2nd, 3rd etc. highest non-zero steps

MFS S1 CC=16

Name and COND code of highest CC step

2 CC=16

No. of highest if more than one

The effect of this is a concise message that gives you a useful overview of the condition codes in the job.

&IFCC allows you to present one of three different pieces of text, dependent on whether cond codes are good, bad or abend, for example:

&IFCC OK BAD ABEND
&IFCC/OK/ITS BAD/IT ABENDED/
&IFCC/OK/ / /

The 3 pieces of text follow the &IFCC, and are delimited by the character immediately following &IFCC (this delimiter can be blank as in the first example above).

When you use &MSG, it incorporates an &IFCC of the third form above (that is, it gives "OK" if OK, and nothing otherwise).

&IFCC makes a judgment on good versus bad COND codes based on a limited knowledge of code 4's out of programs.

Job Step COND Code Defaults for &IFCC

Job Step

Good Code

Bad Code

Asm

0

>0

Cobol

0-4

>4

Link

0-4

>4

Link2

0

>0

MFSS1

0-4

>4

"Link2" is a second link; this is detected based on whether the job step name or procstep name is one of: LINK2 LKED2 LNK2 LINKED2. Non-Asm/Cobol/Link/MFSS1 steps are judged bad if CC>0.

You will not normally have such steps in your jobs, but the documentation is included here for completeness.

&MSG is a general-purpose combination that incorporates &IFCC and &CC, along with the job number, the job card programmer-id field, and the time and date, for example:

&JNUM &IFCC/OK/ / / &CC &PGMR Monday, October 21, 2002, 7:58 am &DAYMTH

In other words, you would get the same as &MSG, by coding the above. &MSG is intended to be the standard message to send in the last, COND=EVEN, step of a batch job.

Although the above description seems quite involved, in practice, the message is readily understandable. If the message doesn't say "OK" after the job number, the job is not OK.

Examples of output messages using &MSG are:

J1278 OK 2 STEPS, 2 CC=0 RESTORE 13:56 FRI SEP 28
J2382 2 STEPS, STEP2 CC=16 RESTORE 14:03 FRI SEP 28
J2431 2 STEPS, 1 NOEX, STEP1 CC=16 RESTORE 14:03 FRI SEP 28
J3007 ABEND S214! 2 STEPS, STEP2 CC=16 RESTORE 14:03 FRI SEP 28

The first example is all COND-code zeros, so shows "OK". The second had a bad COND code in the step called "STEP2". The third had a bad COND code in STEP1, which caused step 2 not to execute (the "1 NOEX" tells you that one step did not execute). The 4th is an example of an abend.

A message similar to the following should be used in a COPEIMS3 step at the start of a job, to inform the IMS user that the job started (do not use &MSG for the start of the job), for example:

MSG &ZUSER @JNUM @PGMR STARTED @TIME

The user will see this (with Jobname on the end):

=MSG=> J1354 RESTORE STARTED 13:43 #TS1002G



 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*