OK, dumb question time.

My job is working with some JCL I found in another job:
//STEP01   EXEC PGM=IKJEFT1A,REGION=0M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT  DD SYSOUT=*
//SYSTERM  DD SYSOUT=*
//SYSTSOUT DD SYSOUT=*
//SYSTSIN  DD *
 OC C('DS QD,TYPE=ALL,ONLINE')
/*

But, I want to look at the "OC" rexx and I can not find it in any of the normal libraries that I have been told are used by our jobs.

How do I find 'OC'? (Or, am I looking for the wrong thing?)

Tony Thigpen

Itschak Mugzach wrote on 05/16/2016 03:20 PM:
OK. my version is based on TSO CONSOLE command. It reads command and
verification value from sysin (see rexx test below), execure the command
and verifies that the command response equal to the one read from sysin. it
can be easily modified to read multiple commands and verification strings.
The idea behind the verification is to ensure that the command executed as
expected (file was closed, job was started, etc.). igone the copywrite
statement of course...

Best,
ITschak

/* MugiRexx V1.3 */
ConsoleCommandInterface:
    Signal ConsoleCommandInterface.main
ConsoleCommandInterface.Doc:
    ------------------------------------------------------------------
                                  CCC
                     Console Command Confirmation

    the program receives input from Parmlib in the format of:
    SET CMDTEXT   = 'command'
    SET CMDVERIFY = 'value to look in the command response'

    > CmdVerify must follow CMDTEXT.
    > example:
      set cmdtext   = '+dbr db pge'
      set cmdverify = 'DFS0488I  DBR COMMAND COMPLETED'

    Copyright (c) SecuriTeam Software, 1999-2012.  All Rights Reserved
    ------------------------------------------------------------------
ConsoleCommandInterface.Main:
    Call ReadParmlib
    Call ConsoleCmd
    Return
    ------------------------------------------------------------------
ConsoleCmd:
    MsgMode = Msg('OFF')
    xTrap   = Outtrap('xMsgs.')
    "CONSPROF SOLDISP(NO) UNSOLDISP(NO)"
    "CONSOLE ACTIVATE NAME(IMS)"
    Do i = 1 to K
       CmdText   = CmdBuff.i.Cmd
       CmdVerify = CmdBuff.i.Verify
       "CONSOLE SYSCMD("CmdText") cart(x1938)"
       MsgResp = GetMsg('Msg.','SOL',x1938,,162)
       say 'number of responses from cmd:' msg.0
       do j = 1 to Msg.0
          say 'response from mvs:' msg.j
          If ((Pos(CmdVerify,Msg.j)>0) | (Pos('DFS058I',Msg.j) > 0)) ,
             Then Do
             Say 'STE5006I Command execution confirmed by server.',
                'command:' CmdText
             Leave
             End
          End
       If (j > Msg.0) Then Do
          Say 'STE5007E Command execution not confirmed by server.'
          Say 'STE5008W Command text:' CmdText
          Say 'STE500iE Rest of commands not executed!'
          Exit 20
          End
       End
    "CONSOLE DEACTIVATE"
    Say 'STE5010I Console session completed.'
    Return
    ------------------------------------------------------------------
ReadParmlib:
    /* ------------------------------------------------------------ */
    /* Parmlib should be pre-allocated by the caller, as the  main  */
    /* use of this program is to run under a job step.              */
    /* ------------------------------------------------------------ */
    AuthVars   = 'CMDTEXT CMDVERIFY'
    FileStatus = ListDsi('PARMLIB FILE')
    If (FileStatus > 4) Then Do
       If (sysreason <> 3) Then Do
          Say 'STE5001E Parmlib not allocated in JCL.',
             FileStatus SysReason
          Say 'STE5002I Fix JCL and re-run the job.'
          Exit 20
          End
       End
    "ExecIO * DiskR PARMLIB (Stem Parm. finis"
    K = 0
    Do i = 1 to Parm.0
       parm.i = Substr(Parm.i,1,71)
       xPos = Pos(';',Parm.i)
       If (xPos > 0) Then Do
          parm.i = Substr(Parm.i,1,xPos-1)
          End
       Parse Upper Var Parm.i CmdOpt CmdVar . CmdValue
       If (CmdOpt = 'SET') Then Do
          If (POS(CmdVar,AuthVars) = 0) Then Do
             Say 'STE5003E Variable' CmdVar 'is not defined to Program'
             Say 'STE5004I Please verify PARMLIB syntax.'
             Exit 20
             End
          Interpret CmdVar '=' CmdValue
          If (CmdVar = 'CMDTEXT') Then Do
             CmdFound = 'YES'
             End
          If (CmdVar = 'CMDVERIFY') Then Do
             If (CmdFound Ž= 'YES') Then Do
                Say 'STE5006E Sequence error. No command definded for',
                   'verification by line' i'.'
                exit 20
                End
             K = K + 1
             say 'k='k cmdtext
             CmdBuff.k.Cmd    = CmdText
             CmdBuff.k.Verify = CmdVerify
             CmdFound = 'NO'
             End
          Say 'STE5005I Variable' CmdVar 'SET TO' Value(CmdVar)'.'
          End
       End
    Return


ITschak Mugzach
Z/OS, ISV Products and Application Security & Risk Assessments Professional

On Mon, May 16, 2016 at 10:08 PM, Jousma, David <[email protected]> wrote:

This is similar to Charles, using SDSF, but it captures the output, and
writes it to DD, you can stack as many commands in there as you wish.

//OPERCMD   EXEC PGM=IKJEFT1B,PARM='%OPERCMDB'
//SYSEXEC   DD   DSN=your.sysexec.dataset,DISP=SHR
//SYSIN     DD   *
D ASM
/*
//SYSTSIN  DD   DUMMY
//SYSTSPRT DD   DUMMY
//

/* REXX */
/* this REXX exec will issue operator commands via SDSF REXX interface
    security is based on the person using the command.  this exec is to be
    used for batch only   */
'EXECIO * DISKR SYSIN (STEM mycmd. FINIS'
if rc > 0 then do
    say 'Return code from OPEN was' rc
    say 'Aborting...'
    exit
    end

/* Allocate results output file  */
ddnm = 'DD'||random(1,99999)
Address TSO "Alloc Fi("ddnm") SYSOUT"

/* Process all input commands    */
Do c=1 to mycmd.0
  oper_command.0 = 1
  oper_command.1 = mycmd.c
  Call Main_process
End

/* Free results output file  */
Address TSO "Free Fi("ddnm")"
Return 0

Main_process:
/* process all data from SYSIN   */
rc=isfcalls('ON')
Address SDSF ISFSLASH "("oper_command.") (WAIT)"
l_cnt = 0
If datatype(isfulog.0) = "NUM" Then Do
  If isfulog.0 <> 0 Then Do
   l_cnt = l_cnt + 1
   l.l_cnt = substr(isfulog.1,1,43)
   Do ix=1 to isfulog.0
    ll = length(isfulog.ix)
    qdata = substr(isfulog.ix,44,ll-43)
    l_cnt = l_cnt + 1
    l.l_cnt = qdata
   End
  End
Else Do
  l_cnt = l_cnt + 1
  l.l_cnt = "No command response available"
  End
End
Else Do
  l_cnt = l_cnt + 1
  l.l_cnt = "Error in command reponse"
End
rc=isfcalls("OFF")
If (l_cnt = 0) Then Do
  l_cnt = l_cnt + 1
  l.l_cnt = ' /* no data produced */'
End
l.0 = l_cnt
Address MVS "ExecIO "l_cnt" DiskW "ddnm" (Finis Stem l.)"
l_cnt = 0
Return

_________________________________________________________________
Dave Jousma
Assistant Vice President, Manager, Mainframe Engineering
[email protected]
1830 East Paris, Grand Rapids, MI  49546 MD RSCB2H
p 616.653.8429
f 616.653.2717

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Charles Mills
Sent: Monday, May 16, 2016 11:38 AM
To: [email protected]
Subject: Re: JCL "COMMAND" statements

Don't know the answer to 'normal' but you are welcome to this FWIW

/* CONSCMD: Rexx to issue any arbitrary console command via SDSF */
rc=isfcalls('ON')
Address SDSF ,
   "ISFEXEC '/" || Arg(1) || "'"
rc=isfcalls('OFF')

//stepname EXEC PGM=IRXJCL,
//         PARM='CONSCMD  some.console.command      '
//*             :        :                             :
//* NAME OF EXEC <------>:                             :
//* ARGUMENT             :<--------------------------->:
//SYSEXEC  DD   DSN=pds.where.above.stored,DISP=SHR

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Tony Thigpen
Sent: Monday, May 16, 2016 8:21 AM
To: [email protected]
Subject: JCL "COMMAND" statements

I have spent most of my life as a z/VSE and z/VM systems programmer, but
during the last year, I have been managing a couple of z/OS systems in our
small outsourcing shop.

At this point, I would consider myself just a very knowledgeable, but
still novice z/OS systems programmer. So, be gentle with your replies. :-)
And, please don't laugh.

Last night/this morning, I have stumped because I noticed that some JCL
set up by a previous systems programmer was not working as it appeared it
should. [At least, until I read the manual.]

We have many jobs set up something like thus:

//STEP1    EXEC PGM=IEFBR14
//COMMD1   COMMAND 'S CICSPTOR'
//WAIT1    EXEC PGM=WAITRCAB,PARM='30'   wait 30 seconds
//STEP2    EXEC PGM=IEFBR14
//COMMD1   COMMAND 'S CICSPDOR'
//WAIT2    EXEC PGM=WAITRCAB,PARM='30'   wait 30 seconds
//STEP3    EXEC PGM=IEFBR14
//COMMD1   COMMAND 'S CICSPAOR1'
//COMMD1   COMMAND 'S CICSPAOR2'
//WAIT3    EXEC PGM=WAITRCAB,PARM='30'   wait 30 seconds
//*

I, of course, though the commands would be synchronized with the execution
JCL. But, we were seeing timing errors that could not be corrected by just
increasing the wait timers. So, I started looking for the problem and found
that all the commands were being issued to the console before the first
IEFBR14 even executed.

I was totally surprised when I found that IBM documents the COMMAND jcl
card as being processed during the JCL conversion phase and not during the
execution phase. *And* that a previous systems programmer must not have
known it either.

So, now I have 2 questions for the knowledgeable people on the list:

1) Are there any other jcl statements that are executed outside the normal
execution phase?

2) What is the 'normal' method to issue console commands synchronized with
the job execution?

--
Tony Thigpen

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email
to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email
to [email protected] with the message: INFO IBM-MAIN

This e-mail transmission contains information that is confidential and may
be privileged.   It is intended only for the addressee(s) named above. If
you receive this e-mail in error, please do not read, copy or disseminate
it in any manner. If you are not the intended recipient, any disclosure,
copying, distribution or use of the contents of this information is
prohibited. Please reply to the message immediately by informing the sender
that the message was misdirected. After replying, please erase it from your
computer system. Your assistance in correcting this error is appreciated.


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN



----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to