View previous topic :: View next topic
|
Author |
Message |
Patrick Bacelar
New User
Joined: 05 Sep 2022 Posts: 15 Location: Brazil
|
|
|
|
Hello everyone, I'm creating a job that will run once a week and it basically needs to issue commands in JES2. These are basic commands such as "P OPCC" or "S OPCC" to terminate and start the task.
I have a REXX script that does this, and I can execute it directly or through screen 6 of IPSF:
EX 'MFTD.REXX(STOPOPCC)'
It works fine this way, but when I try to execute it through a job, it simply doesn't work...
Code: |
/* REXX */
RCODE = ISFCALLS('ON')
"ALLOC F(ISFTRACE) DA('MFTD.SDSF.TRACE') SHR"
ADDRESS SDSF "ISFEXEC '/S OPCT'"
"FREE F(ISFTRACE)"
CALL ISFCALLS('OFF')
RETURN RCODE |
Code: |
//STOPOPCC JOB (),'STOP OPCC',NOTIFY=&SYSUID,CLASS=A,MSGLEVEL=(1,1),
// MSGCLASS=X
//*
//STEP0001 EXEC PGM=IKJEFT01
//SYSEXEC DD DSN=MFTD.REXX,DISP=SHR
//SYSTSPRT DD SYSOUT=A
//SYSTSIN DD *
EXEC 'MFTD.REXX(STOPOPCC)'
/*
// |
Job ended with RC 00 but nothing happens with the task...
I appreciate it if anyone has any suggestions. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2131 Location: USA
|
|
|
|
Add "trace r" or "trace i" to your REXX procedure.
Is it the first REXX code you've ever tried?
The coded logic looks extremely strange... |
|
Back to top |
|
|
Patrick Bacelar
New User
Joined: 05 Sep 2022 Posts: 15 Location: Brazil
|
|
|
|
Sorry, I'm not very experienced with REXX.
I updated the REXX script and submitted again the job, now I got this:
EXEC 'IBMUSER.REXX(STOPOPCC)'
3 *-* RCODE = ISFCALLS('ON')
>>> "0"
4 *-* "ALLOC F(ISFTRACE) DA('IBMUSER.SDSF.TRACE') SHR"
>>> "ALLOC F(ISFTRACE) DA('IBMUSER.SDSF.TRACE') SHR"
5 *-* ADDRESS SDSF "ISFEXEC '/S OPCT'"
>>> "ISFEXEC '/S OPCT'"
+++ RC(8) +++
6 *-* "FREE F(ISFTRACE)"
>>> "FREE F(ISFTRACE)"
7 *-* CALL ISFCALLS('OFF')
>>> "OFF"
>>> "0"
8 *-* RETURN RCODE
>>> "0" |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 730 Location: Denmark
|
|
|
|
I think that by now you should use the ISFSLASH command, i.e.
Code: |
Address SDSF "ISFSLASH" "'"cmd"' (WAIT)" |
But you should also have some error handler, like:
Code: |
say 'Sdsf' cmd 'rc' cc isfmsg
if datatype(isfmsg2.0)='NUM' then do n=1 to isfmsg2.0
say isfmsg2.n
end |
Why do you use EXEC 'MFTD.REXX(STOPOPCC)' if STOPOCC is in your SYSEXEC lib? |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1329 Location: Bamberg, Germany
|
|
|
|
When using ISFSLASH, the cmd to be issued is w/o the "/" prefix. |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 730 Location: Denmark
|
|
|
|
Indeed, thank you Joerg for pointing that out.
Sample:
cmd="S AESTSTC" |
|
Back to top |
|
|
Patrick Bacelar
New User
Joined: 05 Sep 2022 Posts: 15 Location: Brazil
|
|
|
|
Like this?
Code: |
//STOPOPCC JOB (),'STOP OPCC',NOTIFY=&SYSUID,CLASS=A,MSGLEVEL=(1,1),
// MSGCLASS=X
//*
//STEP1 EXEC PGM=IKJEFT01,DYNAMNBR=20
//SYSEXEC DD DSN=MFTD.REXX,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
%STOPOPCC
/* |
Code: |
/* REXX */
TRACE R
RCODE = ISFCALLS('ON')
"ALLOC F(ISFTRACE) DA('MFTD.SDSF.TRACE') SHR"
CMD = "S OPCT"
ADDRESS SDSF "ISFSLASH" CMD "(WAIT)"
"FREE F(ISFTRACE)"
CALL ISFCALLS('OFF')
/* ERROR HANDLING */
SAY 'SDSF' CMD 'RC' RCODE ISFMSG
IF DATATYPE(ISFMSG2.0)='NUM' THEN DO N=1 TO ISFMSG2.0
SAY ISFMSG2.N
END
RETURN RCODE |
|
|
Back to top |
|
|
Patrick Bacelar
New User
Joined: 05 Sep 2022 Posts: 15 Location: Brazil
|
|
|
|
RC(20) - According to the IBM website
Return codes for ISFSLASH
20 - A request failed due to an environmental error.
And I noticed this also:
"SDSF S OPCT RC 0 NOT AUTHORIZED FOR CMD"
SDSF S OPCT RC 0 NOT AUTHORIZED FOR CMD
%STOPOPCC
3 *-* RCODE = ISFCALLS('ON')
>>> "0"
4 *-* "ALLOC F(ISFTRACE) DA('IBMUSER.SDSF.TRACE') SHR"
>>> "ALLOC F(ISFTRACE) DA('IBMUSER.SDSF.TRACE') SHR"
5 *-* CMD = "S OPCT"
>>> "S OPCT"
6 *-* ADDRESS SDSF "ISFSLASH" CMD "(WAIT)"
>>> "ISFSLASH S OPCT (WAIT)"
+++ RC(20) +++
7 *-* "FREE F(ISFTRACE)"
>>> "FREE F(ISFTRACE)"
8 *-* CALL ISFCALLS('OFF')
>>> "OFF"
>>> "0"
9 *-* /* ERROR HANDLING */
10 *-* SAY 'SDSF' CMD 'RC' RCODE ISFMSG
>>> "SDSF S OPCT RC 0 NOT AUTHORIZED FOR CMD"
SDSF S OPCT RC 0 NOT AUTHORIZED FOR CMD
11 *-* IF DATATYPE(ISFMSG2.0)='NUM'
>>> "1"
*-* THEN
*-* DO N=1 TO ISFMSG2.0
>>> "1"
>>> "2"
12 *-* SAY ISFMSG2.N
>>> "ISF776I Processing started for action 1 of 2."
ISF776I Processing started for action 1 of 2.
13 *-* END
11 *-* DO N=1 TO ISFMSG2.0
12 *-* SAY ISFMSG2.N |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
One of the examples of ISFSLASH says
Quote: |
Because the commands contain blanks, enclose them in single quotation marks. |
|
|
Back to top |
|
|
hankoerlemans
New User
Joined: 25 Jan 2018 Posts: 61 Location: Australia
|
|
|
|
Pedro is correct. Without the quotes the console sees an S command with no arguments and OPCT on a new "line".
And you might enjoy the copious quantities of messages you get when you add
Code: |
//ISFRXDBG DD DUMMY |
to the job.
It's quite possible you are missing a variety of authorizations in the SDSF and OPERCMDS RACF classes. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
re: "//ISFRXDBG DD DUMMY"
Instead of DUMMY, shouldn't it be SYSOUT=* or a data set name so that the output is saved? |
|
Back to top |
|
|
hankoerlemans
New User
Joined: 25 Jan 2018 Posts: 61 Location: Australia
|
|
|
|
Nope dd dummy. Output goes to the terminal or SYSTSPRT in batch. |
|
Back to top |
|
|
Patrick Bacelar
New User
Joined: 05 Sep 2022 Posts: 15 Location: Brazil
|
|
|
|
It seems to be really an authorization issue. I've been looking at other topics and people have problems executing commands in SDSF through jobs, even though they can perform these commands manually with their own user. I'll take a look at the RACF permissions and try again. I will update this topic with more information soon. |
|
Back to top |
|
|
|