IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Submitting REXX in Batch mode


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Praveen India

New User


Joined: 30 Apr 2008
Posts: 2
Location: Bangalore

PostPosted: Thu May 01, 2008 8:32 am
Reply with quote

I have a REXX exec that I want to submit in batch mode.

When running it in batch mode, the following things are erroring out:

1) ALLOC statement inside REXX to allocate a dataset
2) VGET and VPUT functions (Passing value to a macro)

they give me a RC(-3)
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu May 01, 2008 8:44 am
Reply with quote

Hello Praveen and welcome to the forums,

I'd suggest you post the problem code.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu May 01, 2008 9:35 am
Reply with quote

There are two ways you can run a REXX exec in batch:

- IRXJCL. This is the REXX interpreter program. It does not setup a TSO address space, so any REXX exec you run here cannot contain commands for other environments, such as TSO and ISPF. There is no particular reason to use IRXJCL if you intend to use TSO commands.

- IKJEFT01. This is the TSO Terminal Monitor Program (TMP). This program sets up a TSO address space, allowing any REXX exec you run here to use TSO commands. This is usually the preferred program to use.

In addition, you can write programs that use ISPF Services. Whether they are compiled programs, or interpreted, the one thing that must be done is that ISPF must be started. Since ISPF also requires TSO, you need to use the IKJEFT01 program. You must use the ISPSTART command to start ISPF before your program, then you normally use the SELECT CMD or SELECT PGM service to activate your program. Your JCL must contain DD statements for all of the required and optional ISPF libraries that you will be using.

Some similar topics you should review:

REXX Program run.

TSO ? ISPF ? REXX ? Keeping them Straight.

Difference between IKJEFT1B and IKJEFT01.

Running REXX pgm having ispexec in Batch mode.

LMINIT returning -3 RC in BATCH.
Back to top
View user's profile Send private message
Praveen India

New User


Joined: 30 Apr 2008
Posts: 2
Location: Bangalore

PostPosted: Fri May 02, 2008 3:24 pm
Reply with quote

Thanks Dick...



1)I want to delete the dataset first if it already exists and then allocate it.
2) Copy the skel to the temporary dataset
3) Edit the temp dataset with the Macro ( for this I am passing the values using VPUT to the macro)
4) The macro gets the value using VGET and edits the skel with the actual values.
5) copy the member created in the temp dataset to the actual dataset


This is the code that troubles me...
-----------------------------------------------------------------------------------
REXX code.

Code:

PDS = SYSDSN("'PRAVEEN.TEMPCOPY'")                               
IF PDS = OK THEN DO                                               
DELETE "'PRAVEEN.TEMPCOPY'" PURGE                                 
END                                                               
CALL OUTTRAP "OFF"                                               
"ALLOC F(TMPFILE) DA('PRAVEEN.TEMPCOPY') NEW CATALOG LRECL(80)   
 BLKSIZE(8000) RECFM(F B) DSORG(PO) CYL SPACE(5 5) DIR(30)"       
                                                                 
"QACOPY 'PRAVEEN.SKEL("DLYMEM")' 'PRAVEEN.TEMPCOPY("A4")' NONUM"
                                                                 
"ISPEXEC VPUT (DVOC DVBK)"                                           
"FREE ALL"                                                                 
"ALLOC DA('PRAVEEN.TEMPCOPY') F(DIDIN) SHR REUSE"                   
"ISPEXEC EDIT DATASET('PRAVEEN.TEMPCOPY("A4")') MACRO(DMACRO)"   
 "FREE ALL"                                                       


MACRO :

Code:

/******* REXX ******/           
"ISREDIT MACRO"                                                 
"ISPEXEC CONTROL ERRORS RETURN"                                 
"ISPEXEC VGET (DVOC DVBK BAOC)"                                         
"ISREDIT CHANGE ALL "DVOC1" "DVOC""                             
"ISREDIT CHANGE ALL "DVBK1" "DVBK""                             
"ISREDIT CHANGE ALL "BAOC1" "BAOC""                             
"ISREDIT SAVE"                                                   
"ISREDIT END"                                                   
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri May 02, 2008 7:31 pm
Reply with quote

The forum will have to assume that you've tested the macro already and that it's working as designed.

It might be nice if you could post a run-time trace of this code. Nothing jumps out as a potential problem, except this:

You VPUT only two variables

"ISPEXEC VPUT (DVOC DVBK)"

but you VGET three

"ISPEXEC VGET (DVOC DVBK BAOC)"

The missing variable will cause a RC=4 on the VGET call.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri May 02, 2008 11:03 pm
Reply with quote

Only one point I would make,
Code:

PDS = SYSDSN("'PRAVEEN.TEMPCOPY'")                               
IF PDS = OK THEN DO                                               
DELETE "'PRAVEEN.TEMPCOPY'" PURGE                                 
END     

I would just use the DELETE statement, if the dataset does not exist then nothing untoward happens, and if it does exist, it gets deleted.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts HILITE on Browse mode? TSO/ISPF 2
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top