Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

CMD - Call command

&pagelevel(3)&pagelevel

General

Application areas:

Macro Command Language Processor macros; see "Standard header"
Communication; see "Communication (programs, users, system)"

Macro type:

Type S, MF format 1: standard/L/D/C/E form; see "S-type macros"

Macro description

The CMD macro enables a command or a list of commands to be called without exiting program mode. The CMD macro activates the macro command language processor
(MLCP) and passes to it the command name and the specified command operands or a list of command names and the associated command operands. After the (last) command has been executed, the program continues.
Users can have a log of the command processing (e.g. system messages) transfered to SYSOUT and/or to an area of their program or to an S variable. The command return code can also be transfered to an area of the program.

The table 11 sets out the commands which cannot be called using the CMD macro.

Macro format and description of operands

CMD

'command-name' [{ ,'oplist1'[, addr / (r)] / , , addr / (r)]

[,OPART2='oplist2'] [,OPART3='oplist3'] [,OPART4='oplist4']

[,OPART5='oplist5'] [,OPART6='oplist6'] [,OPART7='oplist7']

,LIST=NO / YES

[,CMDRC=addr]

,DIALOG=NO / YES

,SYSOUT=YES / NO

,SUBST=NO / JV / ALL

,ORIGIN=CMD / CURRENT

[,DTAVAR@=addr]

[,DTAVARL=length]

,DTAEXT=NO / YES

[,MSGVAR@=addr]

[,MSGVARL=length]

,MSGEXT=NO / YES

,VER=1 / 2 / 3 / 4

,BUFMOD=SHORT / LONG

[,PARMOD=24 / 31]

[,MF=L / (E,..) / D / C]

,PREFIX=M / p

The keyword operands are listed in alphabetical order after the descriptions of the positional operands.

'command-name'
Name of the command which is to be called by CMD.
If the LIST=YES operand is specified, the 'command-name' string can contain a list of commands separated by semicolons. Each command is separated from its list of command operands by a blank.
If an error occurs while the commands in this list are being processed, the CMD macro is aborted at this point.
If the 'command-name' operand contains a list of commands, the 'oplist1' and OPARTx operands are omitted.

'oplist1'
oplist1 = op1,op2,op3,..... = list of the command operands.
The length of the list must be <= 248 characters. The list can be continued at any desired point using the operands OPART2, ...., OPART7. Each successive list is regarded as the continuation of the one immediately preceding it (without regard for the numbering 2-7). The operand may not be specified in conjunction with LIST=YES.

addr
addr = address of the receiving field for the SYSOUT listing. If “addr” is not specified, output will be to SYSOUT only. This is also the case if the length of the receiving field is zero. The receiving field must be aligned on a word boundary. Structure and maximum length of the receiving field depend on the value of the BUFMOD operand.
The first four bytes of every record in the SYSOUT listing that is copied into the receiving area represent a record length field (bytes 0-1 contain the record length, bytes 2-3 are reserved). The output text itself starts at byte 4 of each record. The output records are written to the receiving area one after another until the area limit has been reached. When no more space is left in this area, any further output records are written to SYSOUT only (if SYSOUT=YES is specified).
A record may be truncated if it oversteps the area limit (return code X'OC').

Note

The SYSOUT output format for a command in interactive mode may differ from that in batch mode. This must be taken into account when defining the receiving area.

(r)
Register containing the address of the receiving field.

BUFMOD=
Defines the structure and maximum size of the receiving field for the SYSOUT listing.

SHORT
The receiving field may be up to 32 Kbytes long and has the following structure:


Byte 0-1:

length l (hex.) of the receiving field in bytes (1 <= 215-1); l is to be specified by the
user.

Byte 2-3:

reserved, no entry

Byte 4-n:

SYSOUT listing


LONG

May only be specified if the 31 bit interface of the macro is generated (PARMOD=31). This value may only be specified in conjunction with VER=2/3/4. The receiving field may be up to 2 Gb long and has the following structure:


Byte 0-3:

length l (hex.) of the receiving field in bytes (l <= 231-1); l is to be specified by
the user. The following values are to be observed for l:
l=0:       The receiving field is ignored
1 <= l <= 16:Macro execution is aborted with the return code X'08'.

Byte 4-7:

length l (hex.) of the user data in the receivingfield in bytes (including the 16-byte
prefix) is entered by the system when a macro is executed. Default: length=16.

Byte 8-11:

reserved; however, must be deleted when the CMD macro is called (binary zero
or -1), otherwise execution is aborted with the error code X'08'.

Byte 12-15:

reserved; used by the system

Byte 16-n:

SYSOUT listing


Note

If the receiving field is not fully assigned, macro execution is aborted with the return code X'08'.
If the specified length l is exceeded, output is truncated as per BUFMOD=SHORT. CMD returns the return code X'0C'.

CMDRC=
Specifies the symbolic address of a 9-byte field in the following format to which the command return code of the command processed by the CMD macro is written.

Byte 0:

Subcode2 in assembler format X'nn'

Byte 1:

Subcode1 in assembler format X'nn'

Byte 2-8:

Maincode in assembler format CL7

If a list of commands is passed in the 'command-name' operand (only possible in conjunction with LIST=YES), the specified field contains the return code of the last command to be passed to MCLP.
The operand may be specified only in conjunction with VER=3/4.

addr
Symbolic address of the field to which the return code is to be written. Default setting: 0, i.e. no return code is transferred.

DIALOG=
This indicates whether an error or help dialog is to be conducted if syntax errors are detected.

NO

No error dialog is conducted.

YES
Error dialog is to be conducted, if the terminal type allows this.

DTAEXT=
This determines whether or not the S variable specified in DTAVAR@ should be extended to include the contents of the variables generated by OPS.
This operand may only be specified in conjunction with VER=4 and specifications for DTAVAR@ and DTAVARL.

NO
The S variable should not be extended.
The (old) contents of S variables are replaced by the contents of the OPS variables.

YES
The S variable is extended by adding the contents of the OPS variables. If the S variable cannot be extended, the (old) contents are deleted before saving.

DTAVAR@=
specifies the symbolic address of an area containing the name of a composite S variable. The contents of all variables generated by OPS should be stored in this S variable.
If the S variable was not declared (see DECLARE-VARIABLE command in the SDF-P manual [21]) before the macro is called execution is terminated with the return code X'10'.
This operand may only be specified in conjunction with VER=4.

addr
Symbolic address of the area containing the name of S variables. This can be identical to the address specified in the MSGVAR@ operand so that all variables generated by MIP or OPS are saved in a single area.

DTAVARL=
This specifies the length of the area addressed in DTAVAR@.
This operand may only be specified in conjunction with VER=4.

length
length = length of the field to be specified in bytes.

LIST=
Enables a list of commands and their associated operands to be specified for the 'command-name' operand.

NO
The 'command-name' operand consists of a single command.

YES
The 'command-name' operand contains a list of commands separated by semicolons.This value may be specified only in conjunction with VER=3/4.

MF=

For a general description of the MF operand, its operand values and any subsequent operands (e.g. for a prefix), see "S-type macros". The valid MF values are given at the start of the macro description under “Macro type” and are included in the macro format.
A PREFIX (p = 1 letter) can be specified for MF=C or MF=D, as shown in the macro format.

MSGEXT=
This determines whether or not the S variable specified in MSGVAR@ should be extended to include the contents of the variables generated by MIP.
This operand may only be specified in conjunction with VER=4 and specifications for MSGVAR@ and MSGVARL.

NO
The S variable should not be extended.
The (old) contents of S variables are replaced by the contents of the MIP variables.

YES
The S variable is extended by adding the contents of the MIP variables. If the S variable cannot be extended, the (old) contents are deleted before saving.

MSGVAR@=

specifies the symbolic address of an area containing the name of a composite S variable. The contents of all variables generated by MIP should be stored in this S variable.
If the S variable was not declared (see DECLARE-VARIABLE command in the SDF-P manual [21]) before the macro is called execution is terminated with the return code X'10'.
This operand may only be specified in conjunction with VER=4.

addr
Symbolic address of the area containing the name of S variables. This can be identical to the address specified in the DTAVAR@ operand so that all variables generated by MIP or OPS are saved in a single area.

MSGVARL=
This specifies the length of the area addressed in MSGVAR@.
This operand may only be specified in conjunction with VER=4.

length
length = length of the field to be specified in bytes.

OPARTx=
Allows continuation of the operand list.
x = a member of the set (2, 3, .., 7).

'oplistx'
oplistx = op,op,opkj,.... = (continuation) list of command operands;
x = a member of the set (2,3,...,7).
Length: oplistx = 1..248 characters.
The operand may not be specified in conjunction with LIST=YES.

ORIGIN=
Specifies the origin of the command and must be used when checking whether the command is permitted.
This operand may only be specified in conjunction with VER=4 and MF=D or MF=C.

CMD
The command input must be checked with the CMD-ALLOWED attribute from the syntax file.

CURRENT
In addition to the CMD-ALLOWED attribute, the SDF also checks whether the command is permitted in the current mode, i.e. the mode in which the program was started. This mode may be: interactive, interactive procedure, batch or batch procedure.

PARMOD=

Controls macro expansion. Either the 24-bit or the 31-bit interface is generated.
If PARMOD is not specified here, macro expansion is performed according to the specification for the GPARMOD macro or according to the default setting for the assembler (= 24-bit interface).

24
The 24-bit interface is generated. Data lists and instructions use 24-bit addresses (address space <= 16 Mb). This value may only be specified in conjunction with VER=1.

31
The 31-bit interface is generated. Data lists and instructions use 31-bit addresses (address space <= 2 Gb). Data lists start with the standard header.

SUBST=
Specifies what substitutions are to take place in the command input.

NO
No substitution is to take place in the command input.

JV
All job variables in the command input are to be replaced by their contents.

This value may only be specified in conjunction with VER=4.

ALL
Depending on the program environment, the entire command input is to be replaced, i.e. all S variables, job variables and SYSFILE procedure parameters in the command input are to be replaced in the specified order.
Substitution of SYSFILE procedure parameters is not meaningful for S procedures.
S variables are replaced only if they are known in the current program environment.This value may only be specified in conjunction with VER=4.

SYSOUT=
This indicates whether the log is also to be output to SYSOUT.

YES
Output also to SYSOUT.

NO
No output to SYSOUT.
The receiving area “addr” must be specified in this case.

VER=1 / 2 / 3 / 4

Only important for MF not equal to E and is otherwise ignored. The operand defines the version of the operand list which is to be generated.
Compatibility with other operands: see table below.



VER=1

VER=2

VER=3

VER=4

PARMOD

= 24

x




= 31

x

x

x

x

BUFMOD

= SHORT

x

x

x

x

= LONG


x

x

x

LIST

= NO

x

x

x

x

= YES



x

x

CMDRC




x

x

SUBST

= NO

x

x

x

x

= JV




x

= ALL




x

ORIGIN





x

DTA...





x

MSG...





x

other operands


x

x

x

x


Table 10: compatibility of the VER operand with other operands (CMD)

x means that the operands involved may be combined.

Notes on the macro call

  • The specification DIALOG=YES is ignored in expert mode (MODIFY-SDF-OPTIONS GUIDANCE=EXPERT; see the manual “Commands” [19]). This results in the return code X'10' (instead of X'14').

  • If DIALOG=NO is specified SDF delivers the following return code if the help request is used in the CMD input:

    "?"

    The return code X'10' is delivered.

    "<operation?>"

    (? as part of <operation>) : The return code X'14' is delivered.

    "<operation> ?"

    If <operation> is valid, the return code X'10' is delivered.
    If <operation> is invalid, the return code X'14' is delivered.

    In both modes (interactive or batch), an unclear command is returned for all values of the DIALOG operand with the X'14' return code.

  • Processing of the command list (if LIST=YES) is terminated if one of the specified commands causes an error (syntax error, memory error,..).
    This type of error does not result in SPIN-OFF.

  • The data area generated with MF=C/D must correspond to the data area used with MF=L.

  • If the CMD parameter list was initialized with the standard form or with MF=L, the <PREFIX>CLPLNTH field contains the following information:

    • the length of the entire predefined parameter list of the CMD macro in the first halfword (i.e. 2 bytes, starting at byte 0).

    • the length of the processed command input in the second halfword (i.e. 2 bytes, starting at byte 2). If processing of the CMD macro was aborted due to an error, this halfword indicates the point at which processing was aborted.

  • Structured CMD macro output cannot be directed to the S variable stream SYSINF (as with EXECUTE-CMD command).

  • If OPS variable output is activated via the DTAVAR@ operand, then:

    • the START-EXECUTABLE-PROGRAM command cannot be issued by the CMD macro;

    • it is not possible to chain a number of commands in a single input record ('command name' and LIST=YES operands).

  • Not all the BS2000 commands can be called via the CMD macro, see the following table.

    Command

    Function

    Manual

    ADD-CJC-ACTION

    Submit CJC command sequence (job variables)

    [19]

    BEGIN-BLOCK

    Initiate command block

    [21]

    BEGIN-PARAMETER-
    DECLARATION

    Initiate declaration of procedure parameters in
    procedure header

    [19],[21]

    BEGIN-PROCEDURE

    Define procedure file attributes

    [19]

    BREAK

    Request command mode

    [33]

    CANCEL-PROCEDURE

    Terminate (execution of a) procedure

    [19]

    CANCEL-PROGRAM

    Terminate program run

    [19]

    CHANGE-
    ACCOUNTING-FILE

    Change system accounting file

    [19]

    COPY-SYSTEM-FILE

    Copy system files

    [19]

    CYCLE

    Terminate loop execution

    [21]

    DELON

    Delete ON command

    [33]

    ENDON

    Terminate ON statement sequence

    [33]

    ELSE

    Initiate ELSE branch in IF block

    [19],[21]

    ELSE-IF

    Initiate alternative branch in IF block

    [21]

    END-BLOCK

    Terminate a command block

    [21]

    END-CJC-ACTION

    Terminate CJC command sequence (job variables)

    [19]

    END-FOR

    Terminate a FOR block

    [21]

    END-IF

    Terminate an IF block

    [19],[21]

    END-PARAMETER-
    DECLARATION

    Terminate a procedure parameter declaration

    [19],[21]

    END-PROCEDURE

    Terminate procedure file

    [19]

    END-WHILE

    Terminate a WHILE block

    [21]

    ENDP

    Terminate procedure file

    [33]

    EOF

    Mark the end of the SYSDTA file

    [19]

    ESCAPE

    Interrupt procedure run

    [33]

    EXIT-BLOCK

    Interrupt processing of a command block

    [21]

    FOR

    Initiate FOR block

    [21]

    GOTO

    Branch to tag

    [19],[21]

    HOLD-PROCEDURE

    Interrupt procedure execution and allow command input
    via the data display terminal

    [19]

    HOLD-PROGRAM

    Interrupt program execution and allow command input
    via the data display terminal

    [19]

    IF

    Initiate a block

    [19],[21]

    IF-BLOCK-ERROR

    Initiate a block error handling routine

    [19],[21]

    IF-CMD-ERROR

    Initiate a command error handling routine

    [21]

    LOGON

    Initiate job

    [33]

    MODIFY-
    ACCOUNTING-
    PARAMETERS

    Specify accounting records and record extensions for
    the accounting file

    [19]

    MODIFY-JV-
    CONDITIONALLY

    Modify the value of a job variable and branch to branch
    destination

    [19],[22]

    ON

    Conditionally execute a command sequence

    [33]

    PROCEDURE

    Specify procedure file attributes

    [33]

    REMOVE-CJC-ACTION

    Cancel effect of ADD-CJC-ACTION command (job
    variables)

    [19]

    REPEAT

    Initiate REPEAT block

    [21]

    RESTART-PROGRAM

    Start a program at its checkpoint

    [19]

    RESUME-
    PROCEDURE

    Continue execution of interrupted procedure

    [19]

    SELECT-PRODUCT-
    VERSION

    Select a product version

    [19]

    SET-JOB-STEP

    Terminate spin-off

    [19]

    SET-LOGON-
    PARAMETERS

    Initiate an interactive or batch job

    [19]

    SHOW-ACCOUNTING-
    STATUS

    Display information about accounting system

    [19]

    SKIP-COMMANDS

    Conditional or unconditional branch

    [19]

    SKIPJV

    Branch conditional upon job variables

    [33]

    SKIPUS

    Branch conditional upon user switches

    [33]

    START-ACCOUNTING

    Deactivate accounting system

    [19]

    STEP

    Terminate spin-off

    [33]

    STOP-ACCOUNTING

    Deactivate accounting system

    [19]

    UNTIL

    Terminate REPEAT block

    [21]

    WAIT-EVENT

    Specify conditional wait time (batch job

    [19],[22]

    WHEN

    Set conditional halt for batch job (via user switch)

    [33]

    WHILE

    Initiate WHILE block

    [21]

  • When the following commands are called via the CMD macro, the calling program is unloaded:

    Command

    Function

    Manual

    ABEND

    Terminate the current job

    [33]

    CALL

    Call procedure

    [33]

    CALL-PROCEDURE

    Call procedure

    [19]

    DO

    Call procedure

    [33]

    EXECUTE

    Load and start a module

    [33]

    EXIT-JOB

    Terminate job

    [19]

    HELP-SDF

    Help information on calling SDF commands

    [19]

    LOAD

    Load a module

    [33]

    LOAD-EXECUTABLE-
    PROGRAM

    Load a module

    [19]

    LOAD-PROGRAM

    Load a module

    [19]

    LOGOFF

    Terminate job

    [33]

    START-EXECUTABLE-
    PROGRAM

    Link, load and start a module

    [19]

    START-PROGRAM

    Link, load and start a module

    [19]

    Table 12: Commands that cause the calling program to be unloaded

    The calling program is also unloaded if the called command is implemented by a command procedure. This is, for example, the case for all EDIT commands (see the “Commands” manual [19]). However, self-defined commands of this type can also exist by means of SDF-A (see the “SDF-A” manual [20]).

    To prevent unloading, commands which are initialized via a command procedure and the CALL-PROCEDURE, CALL and DO commands can be called indirectly using the SDF-P command INCLUDE-CMD (see the “SDF-P” manual [21]). The command which is actually to be executed is called as an operand of INCLUDE-CMD.
    INCLUDE-CMD interrupts the calling program, executes the command specified as an operand (and thus the associated command procedure) and then returns to the program. The called command procedure for its part may not, however, execute any command which leads to the program being unloaded.

    A consequence is that in the case of commands which terminate the calling program, the SYSOUT listing will not be copied into the “addr” receiving area. Any STXIT routine which is defined for the event class “program termination” will be activated.Any job variable which monitors the job will be set to “$T”.

Return information and error flags

R15:

+---------------+
|   |   |   |   |
| | | | | | |a|a|
+---------------+

A return code relating to the execution of the CMD macro is specified in the rightmost byte of register R15.

X'aa'

Meaning

X'00'

Function executed successfully

X'04'

The function was aborted due to insufficient memory

X'08'

The function was aborted due to an error in the operand list (address area)

X'0C'

The function was aborted: the receiving area is too short. The last output record placed in
the receiving area was truncated

X'10'

The function was aborted due to a macro/command error (the command returned an error
to the MCLP)

X'14'

The function was aborted due to an invalid command in the operand list

X'24'

The function was aborted due to an error during substitution of the command input

Additionally, if PARMOD=31:

Standard header:

+---------------+
|   |   |   |   |
|c|c|b|b|a|a|a|a|
+---------------+

The following return code regarding execution of the CMD macro is transferred in the standard header (cc=Subcode2, bb=Subcode1, aaaa=Maincode):

cc

bb

aaaa

Meaning

00

00

0000

The function was executed successfully

00

01

0008

The function was aborted due to an operand error

00

20

0004

The function was aborted due to an internal error

00

40

0010

The function was aborted due to a macro/command error

00

40

0014

The function was aborted due to an invalid command in the operand list

00

40

0024

The function was aborted due to an error during substitution of the command
input

02

00

000C

The function was aborted because the receiving area is too short. The last
output record placed in the receiving area was truncated

Other return codes which, in accordance with conventions, apply to all macros are given in the table “Standard return codes” (Standard header).

Layout of the DSECT for VER=4

           CMD MF=D,PARMOD=31,VER=4
1          #INTF REFTYPE=REQUEST,INTNAME=CMD,INTCOMP=4
1          DS    0F
1          MFCHK DMACID=CLP,PREFIX=M,MACID=CLP,MF=D,DNAME=DMCLP
2 MDMCLP   DSECT ,
2                *,##### PREFIX=M, MACID=CLP #####
1 MCLPSTRT DS    0F
1          FHDR  MF=(C,MCLP)
2          DS    0A
2 MCLPFHE  DS    0XL8            0   GENERAL PARAMETER AREA HEADER
2 *
2 MCLPIFID DS    0A              0   INTERFACE IDENTIFIER
2 MCLPFCTU DS    AL2             0   FUNCTION UNIT NUMBER
2 *                                  BIT 15    HEADER FLAG BIT,
2 *                                  MUST BE RESET UNTIL FURTHER NOTICE
2 *                                  BIT 14-12 UNUSED, MUST BE RESET
2 *                                  BIT 11-0  REAL FUNCTION UNIT NUMBER
2 MCLPFCT  DS    AL1             2   FUNCTION NUMBER
2 MCLPFCTV DS    AL1             3   FUNCTION INTERFACE VERSION NUMBER
2 *
2 MCLPRET  DS    0A              4   GENERAL RETURN CODE
2 *
2 * GENERAL_RETURN_CODE CLEARED (X'00000000') MEANS
2 * REQUEST SUCCESSFUL PROCESSED AND NO ADDITIONAL INFORMATION
2 *
2 MCLPSRET DS    0AL2            4   SUB RETURN CODE
2 MCLPSR2  DS    AL1             4   SUB RETURN CODE 2
2 * ALWAYS CLEARED (X'00') IF MAIN_RETURN_CODE IS X'FFFF'
2 * Standard subcode2 values as defined by convention:
2 MCLPR2OK EQU   X'00'               All correct, no additional info
2 MCLPR2NA EQU   X'01'               Successful, no action was necessary
2 MCLPR2WA EQU   X'02'               Warning, particular situation
2 MCLPSR1  DS    AL1             5   SUB RETURN CODE 1
2 *
2 * GENERAL INDICATION OF ERROR CLASSES
2 *
2 * CLASS A    X'00'           FUNCTION WAS SUCCESSFULLY PROCESSED
2 * CLASS B    X'01' - X'1F'   PARAMETER SYNTAX ERROR
2 * CLASS C    X'20'           INTERNAL ERROR IN CALLED FUNCTION
2 * CLASS D    X'40' - X'7F'   NO CLASS SPECIFIC REACTION POSSIBLE
2 * CLASS E    X'80' - X'82'   WAIT AND RETRY
2 *
2 MCLPRFSP EQU   X'00'               FUNCTION SUCCESSFULLY PROCESSED
2 MCLPRPER EQU   X'01'               PARAMETER SYNTAX ERROR
2 *  3 GLOBALLY DEFINED ISL ERROR CODES IN CLASS X'01' - X'1F'
2 MCLPRFNS EQU   X'01'               CALLED FUNCTION NOT SUPPORTED
2 MCLPRFNA EQU   X'02'               CALLED FUNCTION NOT AVAILABLE
2 MCLPRVNA EQU   X'03'               INTERFACE VERSION NOT SUPPORTED
2 *
2 MCLPRAER EQU   X'04'               ALIGNMENT ERROR
2 MCLPRIER EQU   X'20'               INTERNAL ERROR
2 MCLPRCAR EQU   X'40'               CORRECT AND RETRY
2 *  2 GLOBALLY DEFINED ISL ERROR CODES IN CLASS X'40' - X'7F'
2 MCLPRECR EQU   X'41'               SUBSYSTEM (SS) MUST BE CREATED
2 *                                  EXPLICITELY BY CREATE-SS
2 MCLPRECN EQU   X'42'               SS MUST BE EXPLICITELY CONNECTED
2 *
2 MCLPRWAR EQU   X'80'               WAIT FOR A SHORT TIME AND RETRY
2 MCLPRWLR EQU   X'81'                    "     LONG       "
2 MCLPRWUR EQU   X'82'               WAIT TIME IS UNCALCULABLY LONG
2 *                                  BUT RETRY IS POSSIBLE
2 *  2 GLOBALLY DEFINED ISL ERROR CODES IN CLASS X'80' - X'82'
2 MCLPRTNA EQU   X'81'               SS TEMPORARILY NOT AVAILABLE
2 MCLPRDH  EQU   X'82'               SS IN DELETE / HOLD
2 *
2 MCLPMRET DS    0AL2            6   MAIN RETURN CODE
2 MCLPMR2  DS    AL1             6   MAIN RETURN CODE 2
2 MCLPMR1  DS    AL1             7   MAIN RETURN CODE 1
2 *
2 * SPECIAL LAYOUT OF LINKAGE_MAIN_RETURN_CODE (YYYY IN X'00XXYYYY')
2 *
2 MCLPRLNK EQU   X'FFFF'             LINKAGE ERROR / REQ. NOT PROCESSED
2 MCLPFHL  EQU   8               8   GENERAL OPERAND LIST HEADER LENGTH
2 *
1 MCLPFLAG DS    X                       Flag bits
1 *              Flag bits:.0......    : UNUSED
1 *                        0.......    : reserved for TPR usage
1 MCLPDIA  EQU   X'20'     ..1.....    : DIALOG possible (w. SDF only)
1 MCLPNSYS EQU   X'10'     ...1....    : no SYSOUT logging
1 MCLPLIST EQU   X'08'     ....1...    : LIST of commands
1 MCLPNOUT EQU   X'04'     .....10.    : no output buffer
1 MCLPLONG EQU   X'02'     .....01.    : long output buffer
1 *                        .....00.    : short (old) output buffer
1 MCLPREG  EQU   X'01'     .......1     buffer @ given via a register/
1 MCLPADDR EQU   X'00'     .......0     buffer @ given directly
1 MCLPNSRG EQU   X'11'     ...1...1     no SYSOUT, buff.@ in a reg.
1 MCLPNSAD EQU   X'10'     ...1...0     no SYSOUT, buff.@ given directly
1 MCLPFLA3 DS    XL1                    FLAG 3
1 MCLPSJV  EQU   X'80'     10......     substitute jv only
1 MCLPSALL EQU   X'40'     01......     substitute all
1 MCLPDATE EQU   X'20'     ..1.....     data var buf extend
1 MCLPMSGE EQU   X'10'     ...1....     msg var buf extend
1 MCLPCUOR EQU   X'04'     .....1..     origin=current
1 MCLPUNUS DS    XL1                    reserved (unused)
1 MCLPROUT DS    XL1                    reg.# if buffer @ in reg.
1 MCLPOUT  DS    A                      buffer @ or 0
1 MCLPCMD@ DS    A                      @ of command (-> V-field)
1 MCLPRC@  DS    A                      @ return code of command
1 MCLPTPR2 DS    A              reserved for TPR usage.
1 MCLPDAV@ DS    A                      @ of var name for data
1 MCLPMSV@ DS    A                      @ of var name for message
1 MCLPDAVL DS    H                      length of var name
1 MCLPMSVL DS    H                      length of var name
1 MCLPTPR3 DS    A              reserved for TPR usage.
1 MCLPHLN  EQU   *-MCLPSTRT           CMD p.l. length
1 MCLPLNTH EQU   *       command's V-field when CLPCMD@ points here
1 MCLPCMD  EQU   *+4     cmd start when MCLPCMD@ points to MCLPLNTH

Example

With the CMD macro, the SHOW-JOB-STATUS command is run in two variants. The program is executed in 31-bit addressing mode below the 16-Mb boundary.

CMD      START
         PRINT NOGEN
CMD      AMODE ANY
         BALR  3,0
         USING *,3
         CMD   MF=(E,LFORMAD1),PARMOD=31 ——————————————————————————————  (1) 
         CMD   MF=(E,LFORMAD2),PARMOD=31 ——————————————————————————————  (2) 
         MVC   MESSAGE(4),PROTCONT
         MVC   MESSTXT,PROTCONT+4
         WROUT MESSAGE,END,PARMOD=31
END      TERM
LFORMAD1 CMD   'SHOW-JOB-STA','INF=(*STD,*PROGRAM)',MF=L,PARMOD=31 ————  (3) 
LFORMAD2 CMD   'SHOW-JOB-STA','INF=*STD',PROT,SYSOUT=NO,MF=L,PARMOD=31    (4) 
         DS    0F
PROT     DC    Y(PROTEND-PROT) ————————————————————————————————————————  (5) 
         DC    X'4040'
PROTCONT DS    CL2500
PROTEND  EQU   *
MESSAGE  DC    Y(ENDMESS-MESSAGE)      Record length
         DS    CL2                     Reserved
         DC    X'01'                   Print feed control character
MESSTXT  DS    CL255                   Contents
ENDMESS  EQU   *
         END

(1)

The macro call is split into the instruction part and data area (see "S-type macros"). At this point, only the instruction part (SVC) is given, with a reference to the data area LFORMADR1 in the data section of the program.

(2)

The macro is called with a reference to the data area LFORMADR2.

(3)

The SHOW-JOB-STATUS command is called with the INF=(*STD,*PROGRAM) operand. Output is sent to the display terminal.

(4)

The SHOW-JOB-STATUS command is called with the INF=*STD operand. The information is output to the PROT area.

(5)

The command output area starts on a word boundary, with the area length being entered in the first two bytes.

Runtime log

/start-assembh
%  BLS0500 PROGRAM 'ASSEMBH', VERSION '<ver>' OF '<date>' LOADED
%  ASS6010 <ver> OF BS2000 ASSEMBH  READY 
//compile source=*library-element(macexmp.lib,cmd), -
//        compiler-action=module-generation(module-format=llm), -
//        module-library=macexmp.lib, -
//        listing=parameters(output=*library-element(macexmp.lib,cmd))
%  ASS6011 ASSEMBLY TIME: 344 MSEC
%  ASS6018 0 FLAGS, 0 PRIVILEGED FLAGS, 0 MNOTES
%  ASS6019 HIGHEST ERROR-WEIGHT: NO ERRORS
%  ASS6006 LISTING GENERATOR TIME: 80 MSEC
//end
%  ASS6012 END OF ASSEMBH
/start-executable-program library=macexmp.lib,element-or-symbol=cmd
%  BLS0523 ELEMENT 'CMD', VERSION '@' FROM LIBRARY
   ':2OSG:$QM212.MACEXMP.LIB' IN PROCESS
%  BLS0524 LLM 'CMD', VERSION ' ' OF '2<date> <time>' LOADED
NAME      TSN TYPE       PRI      CPU-USED CPU-MAX ACCOUNT#  ———————————  (6) 
MACTEST  2QSE 3 DIALOG1  0 210     58.7710    9000 89002
NAME      TSN TYPE        SIZE CURR-CMD
MACTEST  2QSE 3 DIALOG1      1 START-EXECUTABLE-PROGRAM
              PROG::2OSG:$QM212.MACEXMP.LIB(CMD,@,L)
NAME      TSN TYPE       PRI      CPU-USED CPU-MAX ACCOUNT#  ——————————— (7) 
MACTEST  2QSE 3 DIALOG1  0 210     58.7856    9000 89002

(6)

Output of the first CMD call direct to the display terminal.

(7)

The output area PROT of the second CMD call is displayed using WROUT.