0

I have to order few jobs in control m from different scheduling tables. this is manual task so i want to automate it using rexx. I found below in 'Order or Force under Batch, REXX or CLIST' section of 'CONTROL M USERGUIDE' EXEC CTMAPI PARM=‘ORDER variable’ I could not find syntax to call CMTAPI using rexx.

Rahul
  • 1
  • 2
  • I do believe that you have just coded the synatx that you require in your question. EXEC CTMAPI PARM=.... Where ... is what you want CTMAPI to do. If you fond it in the manual then anything else you need should be in that manual or a reference to another resource to use. – NicC Dec 14 '18 at 11:36
  • The JCL statement 'EXEC CTMAPI' is instructing the system to use a cataloged procedure call CTMAPI. CTMAPI is not a program. Somewhere in the cTMAPI proc will be a step with EXEC PGM=XXXX indicating the actual program being used. This should be callable from REXX and the DD statements in the proc may indicate any files you need to allocate... – Steve Ives Dec 19 '18 at 13:50

2 Answers2

0

ADDRESS 'LINKMVS' is the equivalent of // EXEC PGM=something,PARM='whatever' in REXX. I don't know what the variable is supposed to be, but since this is Control-M, I am going to assume job name. A very simple example:

say 'Enter name of job'
pull jobname
parmvar = 'ORDER' jobname
`ADDRESS 'LINKMVS' 'CTMAPI parmvar'

Please note that for LINKMVS, the variable name goes inside the string passed. The LINKMVS environment substitutes the variable automatically. For example, if I entered MYJOB to the prompt, LINKMVS will build a PARM string of `ORDER MYJOB'. This is the exact equivalent of

// EXEC PGM=CTMAPI,PARM='ORDER MYJOB'

This IBM® Knowledge Center page for the z/OS 2.3 TSO/E REXX Reference manual shows several examples of calling a program in the same manner as // EXEC PGM=,PARM= (item 1). Items 5 through 9 show different ways of using ADDRESS 'LINKMVS'; note how variables are treated in each example.

zarchasmpgmr
  • 1,422
  • 10
  • 21
  • I tried to execute the above code. It is giving me RC=-3. I tried to execute CTMAPI utility using JCL but it is showing error as //CTMAPI EXEC PGM=CTMAPI **CAY6093E PROGRAM "CTMAPI" NOT FOUND** This may be the reason i am not able to execute CTMAPI utility using REXX. Is there any alternative way or in which library i can find CTMAPI utility? – Rahul Dec 17 '18 at 11:44
  • Also, i am able to order jobs using JCL with some procedure CTMJOBPR. **//CPSD0030 EXEC PROC=CTMJOBPR,** // COND=(7,LT), // LIB=MY.SCHEDULING.LIBRARY, // TABLE=SCHEDTABLE, // JOB='JOBNAME', // ODATE='ORDERDATE', // FORCE=FORCE Is it possible to call above procedure from REXX. – Rahul Dec 17 '18 at 11:45
  • You already have the answers to your questions in the JCL portion of the batch job, in the expansion of the PROC. That shows all of the data sets and DD names you will need to allocate in your REXX proc before you execute the `LINKMVS`. Don't forget to free the allocations after use. – zarchasmpgmr Dec 17 '18 at 17:13
  • CTMAPI is not a program; it is a procedure. Look inside CTMAPI to see what program(s) it calls. – Steve Ives Dec 19 '18 at 13:51
0

After suggestions from NicC, zarchasmpgmr and few research, finally i am able to order job with CTMJOB utility. I searched for the loadlib and called TSO using REXX.

/*****REXX*******/
ADDRESS TSO                                            
"CALL 'MY.IN.LOAD(CTMJOB)'                    
' ORDER DSN=MY.SCHED.LIB  TABLE=SCHDTBL,  
JOB=JOBNAME,DATE=DATE'"
EXIT

Details found in INCONTROL for ZOS utilities guide. This document was very useful. http://documents.bmc.com/supportu/952/56/64/195664/195664.pdf

Rahul
  • 1
  • 2