Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do I convert Rexx to submit commands to the internal reader 1

Status
Not open for further replies.

haleyja

Technical User
Mar 20, 2003
4
CA
in my shop we use clists still. I'm building a Rexx that will push a cancel command to the internal reader from within the Rexx code. It is a conversion of a clist version. I can't get the Rexx to work. I dabble in rexx just a little... any help would be great.

Here is the clist version:
PROC 1 JOBNUM
ALLOC F(INTRDR) SYSOUT(A) WRITER(INTRDR)
OPENFILE INTRDR OUTPUT
SET &INTRDR = &STR(/*$CJ)&JOBNUM
WRITE &INTRDR
PUTFILE INTRDR
CLOSFILE INTRDR
FREE F(INTRDR)
WRITE &MAXCC

Here is my Rexx (this is one of many versions that don't work.
any help would be great.
/* REXX */
DROP MEMNAME.
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
TRACE IA
JOBNUM = "69552" /* TEST JOB JES NUMBER KEEPS CHANGING */
"ALLOC F(INTRDR) SYSOUT(A) WRITER(INTRDR)"
CANCOM.1 = SUBSTR("/*$CJ"JOBNUM,1,10)
"EXECIO 0 DISKW INTRDR (OPEN"
"EXECIO 1 DISKW INTRDR (STEM CANCOM."
"EXECIO 0 DISKW INTRDR (FINIS"


Thanks
James
 
Suggest you try something like:
Code:
"ALLOC F(INTRDR) SYSOUT WRITER(INTRDR) RECFM(F B) LRECL(80)"

Also, when posting a problem, you need to post something more useful than "it didn't work". We kinda figured something didn't work. . .[wink]
 
Thanks for the alloc format that did the trick. This is one of those automated kill processes we need to terminate adhoc jobs still running at 6:30 am and before our onlines can come up. they wanted a way to put one time read query's in without the hassel of going through a change process. unfortunently they don't always write efficient code. which is probably how I throw together these little helper processes for them. Rexx just seemed like the best way to go here and with the intent to improve my understanding of Rexx. Sometims the manual isn't that obvious to a beginner. :) Thanks for all your help.

Here is the working code, which will be modified further to feed it the adhoc jobnames.

/* REXX */
/* TRACE I OR R OR ?R */
DROP JOB2KILL.
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
CNT = 0
CNT2 = 0
OKTODO = 0
X = OUTTRAP("JOB2KILL.",'*',"CONCAT")
/* TRACE IA */
ST PI0003DL /* WILL BECOME A VARIABLE LATER */
DO WHILE JOB2KILL.CNT \= "JOB2KILL."||CNT
IF SUBWORD(JOB2KILL.CNT,3,1) = "EXECUTING" THEN OKTODO = 1
IF SUBWORD(JOB2KILL.CNT,3,1) = "EXECUTING" THEN DO
SAY SUBSTR(JOB2KILL.CNT,1,22)
J0 = POS('(',JOB2KILL.CNT,1) -5
J1 = POS('(',JOB2KILL.CNT,1) +4
JOBNAME = SUBSTR(JOB2KILL.CNT,5,J0)
JOBNUM = SUBSTR(JOB2KILL.CNT,J1,5)
END
CNT = CNT + 1
END
IF OKTODO = 1 THEN DO
"ALLOC F(INTRDR) SYSOUT(A) WRITER(INTRDR) RECFM(F B) LRECL(80)"
CANCOM.1 = SUBSTR("/*$CJ"JOBNUM,1,10)
"EXECIO 0 DISKW INTRDR (OPEN"
"EXECIO 1 DISKW INTRDR (STEM CANCOM."
"EXECIO 0 DISKW INTRDR (FINIS"
END
OKTODO = 0
ZCNT = CNT
CNT = 0
/* CLEAR THE OUTRAPPED INCASE OF ANOTHER USAGE */
DO ZCNT
JOB2KILL.CNT = ""
CNT = CNT + 1
END
RETURN
END
 
Good to hear it works for you [smile]

Sometims the manual isn't that obvious to a beginner
The manuals are much better for reference than instruction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top