DOCMD: IMS commands front end
DOCMD is an automatic operator interface (AOI) transaction program that issues IMS commands and allows dynamic filtering of their output. The term dynamic means that you use the headers for the command as the selectors (variable names) in the filter expression (Boolean expression resulting in 1 if line is to be displayed and 0 if it is not).
This listing is shown in the code example at the end of this topic.
Not all commands are allowed through transaction AOI, and some setup needs to be done to use this AOI.
Some examples of DOCMD are given in the following figures.
Please supply an IMS Command to execute.
EXEC DOCMD ended with RC= 0
Headers being shown for command: /DIS NODE ALL
Variable (header) #1 = RECTYPE
Variable (header) #2 = NODE_SUB
Variable (header) #3 = TYPE
Variable (header) #4 = CID
Variable (header) #5 = RECD
Variable (header) #6 = ENQCT
Variable (header) #7 = DEQCT
Variable (header) #8 = QCT
Variable (header) #9 = SENT
EXEC DOCMD ended with RC= 0
Selection criteria =>CID>0<= Command: /DIS NODE ALL
NODE_SUB TYPE CID RECD ENQCT DEQCT QCT SENT
L3270A 3277 01000004 5 19 19 0 26 IDLE CON
L3270C 3277 01000005 116 115 115 0 122 CON
Selected 2 lines from 396 lines.
DOCMD Executed 402 DL/I calls in 2.096787 seconds.
EXEC DOCMD ended with RC= 0
Selection criteria =>TYPE=SLU2<= Command: /DIS NODE ALL
NODE_SUB TYPE CID RECD ENQCT DEQCT QCT SENT
WRIGHT SLU2 00000000 0 0 0 0 0 IDLE
Q3290A SLU2 00000000 0 0 0 0 0 IDLE
Q3290B SLU2 00000000 0 0 0 0 0 IDLE
Q3290C SLU2 00000000 0 0 0 0 0 IDLE
Q3290D SLU2 00000000 0 0 0 0 0 IDLE
V3290A SLU2 00000000 0 0 0 0 0 IDLE
V3290B SLU2 00000000 0 0 0 0 0 IDLE
H3290A SLU2 00000000 0 0 0 0 0 IDLE
H3290B SLU2 00000000 0 0 0 0 0 IDLE
E32701 SLU2 00000000 0 0 0 0 0 IDLE
E32702 SLU2 00000000 0 0 0 0 0 IDLE
E32703 SLU2 00000000 0 0 0 0 0 IDLE
E32704 SLU2 00000000 0 0 0 0 0 IDLE
E32705 SLU2 00000000 0 0 0 0 0 IDLE
ADLU2A SLU2 00000000 0 0 0 0 0 IDLE
ADLU2B SLU2 00000000 0 0 0 0 0 IDLE
ADLU2C SLU2 00000000 0 0 0 0 0 IDLE
ADLU2D SLU2 00000000 0 0 0 0 0 IDLE
ADLU2E SLU2 00000000 0 0 0 0 0 IDLE
ADLU2F SLU2 00000000 0 0 0 0 0 IDLE
ADLU2X SLU2 00000000 0 0 0 0 0 IDLE
ENDS01 SLU2 00000000 0 0 0 0 0 IDLE
ENDS02 SLU2 00000000 0 0 0 0 0 IDLE
ENDS03 SLU2 00000000 0 0 0 0 0 IDLE
ENDS04 SLU2 00000000 0 0 0 0 0 IDLE
ENDS05 SLU2 00000000 0 0 0 0 0 IDLE
ENDS06 SLU2 00000000 0 0 0 0 0 IDLE
NDSLU2A1 SLU2 00000000 0 0 0 0 0 ASR IDLE
NDSLU2A2 SLU2 00000000 0 0 0 0 0 ASR IDLE
NDSLU2A3 SLU2 00000000 0 0 0 0 0 ASR IDLE
NDSLU2A4 SLU2 00000000 0 0 0 0 0 ASR IDLE
NDSLU2A5 SLU2 00000000 0 0 0 0 0 IDLE
NDSLU2A6 SLU2 00000000 0 0 0 0 0 ASR IDLE
OMSSLU2A SLU2 00000000 0 0 0 0 0 IDLE
Selected 34 lines from 396 lines.
DOCMD Executed 435 DL/I calls in 1.602206 seconds.
EXEC DOCMD ended with RC= 0
Selection criteria =>ENQCT>0 & RECTYPE='T02'<= Command: /DIS TRAN ALL
TRAN CLS ENQCT QCT LCT PLCT CP NP LP SEGSZ SEGNO PARLM RC
TACP18 1 119 0 65535 65535 1 1 1 0 0 NONE 1
Selected 1 lines from 1104 lines.
DOCMD Executed 1152 DL/I calls in 5.780977 seconds.
EXEC DOCMD ended with RC= 0
Selection criteria =>ENQCT>0<= Command: /DIS LTERM ALL
LTERM ENQCT DEQCT QCT
CTRL 19 19 0
T3270LC 119 119 0
Selected 2 lines from 678 lines.
DOCMD Executed 681 DL/I calls in 1.967670 seconds.
EXEC DOCMD ended with RC= 0
The source code for the DOCMD exec is shown in the following code example.
DOCMD exec: process an IMS command
/*********************************************************************/
/* A REXX EXEC that executes an IMS command and parses the */
/* output by a user supplied criteria. */
/* */
/* */
/*********************************************************************/
/* Format: tranname DOCMD IMS-Command;Expression */
/* Where: */
/* tranname is the tranname of a command capable transaction that */
/* will run the DFSREXX program. */
/* IMS-Command is any valid IMS command that generates a table of */
/* output like /DIS NODE ALL or /DIS TRAN ALL */
/* Expression is any valid REXX expression, using the header names*/
/* as the variables, like CID>0 or SEND=0 or more */
/* complex like CID>0 & TYPE=SLU2 */
/* Example: TACP18 DOCMD DIS A Display active */
/* TACP18 DOCMD DIS NODE ALL;? See headers of DIS NODE */
/* TACP18 DOCMD DIS NODE ALL;CID>0 Show active Nodes */
/* TACP18 DOCMD DIS NODE ALL;CID>0;SYSOUT Output to SYSOUT */
/* TACP18 DOCMD DIS NODE ALL;CID>0 & TYPE='SLU2' */
/*********************************************************************/
Address REXXTDLI
Parse Upper Arg Cmd ';' Expression ';' SysOut
Cmd=Strip(Cmd);
Expression=Strip(Expression)
SysOut=(SysOut¬='')
If Cmd='' Then Do
Call SayIt 'Please supply an IMS Command to execute.'
Exit 0
End
AllOpt= (Expression='ALL')
If AllOpt then Expression=''
If Left(Cmd,1)¬='/' then Cmd='/'Cmd /* Add a slash if necessary */
If Expression='' Then
Call SayIt 'No Expression supplied, all output shown',
'from:' Cmd
Else If Expression='?' Then
Call SayIt 'Headers being shown for command:' Cmd
Else
Call SayIt 'Selection criteria =>'Expression'<=',
'Command:' Cmd
x=Time('R'); Calls=0
ExitRC= ParseHeader(Cmd,Expression)
If ExitRC¬=0 then Exit ExitRC
If Expression='?' Then Do
Do i=1 to Vars.0
Call SayIt 'Variable (header) #'i '=' Vars.i
Calls=Calls+1
End
End
Else Do
Call ParseCmd Expression
Do i=1 to Line.0
If AllOpt then Line=Line.i
Else Line=Substr(Line.i,5)
If SysOut then Do
Push Line
'EXECIO 1 DISKW DOCMD'
End
Else Do
Call SayIt Line
Calls=Calls+1
End
End
If SysOut then Do
'EXECIO 0 DISKW DOCMD ( FINIS'
End
If Expression¬='' then
Call SayIt 'Selected' Line.0-1 'lines from',
LinesAvail 'lines.'
Else
Call SayIt 'Total lines of output:' Line.0-1
Call SayIt 'DOCMD Executed' Calls 'DL/I calls in',
Time('E') 'seconds.'
End
Exit 0
ParseHeader:
CurrCmd=Arg(1)
CmdCnt=0
'CMD IOPCB CURRCMD'
CmdS= IMSQUERY('STATUS')
Calls=Calls+1
If CmdS=' ' then Do
Call SayIt 'Command Executed, No output available.'
Return 4
End
Else If CmdS¬='CC' then Do
Call SayIt 'Error Executing Command, Status='CmdS
Return 16
End
CurrCmd=Translate(CurrCmd,' ','15'x) /* Drop special characters */
CurrCmd=Translate(CurrCmd,'__','-/') /* Drop special characters */
CmdCnt=CmdCnt+1
Interpret 'LINE.'||CmdCnt '= Strip(CurrCmd)'
Parse Var CurrCmd RecType Header
If Expression='' then Nop
Else If Right(RecType,2)='70' then Do
Vars.0=Words(Header)+1
Vars.1 = "RECTYPE"
Do i= 2 to Vars.0
Interpret 'VARS.'i '= "'Word(CurrCmd,i)'"'
End
End
Else Do
Call SayIt 'Command did not produce a header',
'record, first record''s type='RecType
Return 12
End
Return 0
ParseCmd:
LinesAvail=0
CurrExp=Arg(1)
Do Forever
'GCMD IOPCB CURRCMD'
CmdS= IMSQUERY('STATUS')
Calls=Calls+1
If CmdS¬=' ' then Leave
/* Skip Time Stamps */
If Word(CurrCmd,1)='X99' & Expression¬='' then Iterate
LinesAvail=LinesAvail+1
CurrCmd=Translate(CurrCmd,' ','15'x)/* Drop special characters */
If Expression='' then OK=1
Else Do
Do i= 1 to Vars.0
Interpret Vars.i '= "'Word(CurrCmd,i)'"'
End
Interpret 'OK='Expression
End
If OK then Do
CmdCnt=CmdCnt+1
Interpret 'LINE.'||CmdCnt '= Strip(CurrCmd)'
End
End
Line.0 = CmdCnt
If CmdS¬='QD' Then
Call SayIt 'Error Executing Command:',
Arg(1) 'Stat='CmdS
Return
SayIt: Procedure
Parse Arg Line
'ISRT IOPCB LINE'
Return RC