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

Executing A Shell Script using BPXBATCH


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Jun 25, 2009 1:53 pm
Reply with quote

Hi all,

i need to execute a shell script from Mainfram also i need to pass some parameters. can anyone tell how to do using BPXBATCH.

will the below code work...the first parm is the script path i need to trigger and the next line is parameter i need to pass for the above script.

Code:

//STDPARM  DD   *                             
SH script path
REVELAR,export_tdxwrvi1.fxp,test_tdpwrvia.txt,Y
/*


i check all the documents and also searched in the forum. But i did not get the help for my query.

thanks,
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Jun 25, 2009 1:55 pm
Reply with quote

I checked the below paths:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/bpxza460/11.2?DT=20050615135744

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/BPXZA590/HDRBPXBATR?DT=20080605071233&SCROLLTOP=HDRBPXBATR
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 25, 2009 4:54 pm
Reply with quote

Put a plus sign at the end of your first line. You will need to break the command at a space for Unix to process it correctly. If you cannot do so, create a file with LRECL long enough to handle your command, store the command in it, and point STDPARM to this file. I've tested STDPARM with DCB of VB, 27994, 27998 with no problems.
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Jun 25, 2009 5:02 pm
Reply with quote

Hi Robert,

Quote:

You will need to break the command at a space for Unix to process it correctly

you mean to replace comma "," with a space.
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Jun 25, 2009 5:08 pm
Reply with quote

is the below code correct.

Code:


//STDPARM  DD   *                             
SH script path  +
REVELAR export_tdxwrvi1.fxp test_tdpwrvia.txt Y
/*



Aslo, can we supply unxi path to trigger the script. Actually the script is in the UNIX box.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 25, 2009 5:23 pm
Reply with quote

Yeah, assuming the script path includes the script name (which is not REVELAR), your syntax is correct. If the script name is REVELAR then you cannot put a space after the path before the script you're trying to execute.

When you say the script is in the UNIX box, do you mean the script is on another server entirely, or do you mean the script is stored in a z/OS Unix System Services file somewhere? If the latter then your command will execute fine. If the former, you will need to forget BPXBATCH entirely and use REXEC to remotely execute the UNIX script on the UNIX box.

BPXBATCH only executes scripts on the z/OS mainframe somewhere in a Unix System Services file.
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Jun 25, 2009 5:39 pm
Reply with quote

it is on different sever. How to use REXEC in JCL

Code:

rexec -d -l user-id -p password -s port remote-hostname command


Can you please provide me the JCL with REXEC.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 25, 2009 5:51 pm
Reply with quote

I have used this code to access a UNIX server before:
Code:
//FTP01    EXEC PGM=REXEC,
//  PARM='xxx-hry2'
//PROFILE  DD   DISP=SHR,DSN=<TCP/IP profile data>
//NETRC    DD   *
MACHINE xxx-hry2 LOGIN userid PASSWORD userpass
/*
//SYSPRINT  DD SYSOUT=*
//SYSTSPRT  DD SYSOUT=*
//SYSTSIN   DD *
'/app/gen/bin/jqsubmit -jrpt payrpt PR296TST'
/*
where the PARM is the server name, the NETRC contains the server sign on data, and the //SYSTSIN DD * input is the command to execute on the server. IIRC, the quotes around the command are required to ensure the entire string is passed to the remote server; otherwise the first space stops the command. The //PROFILE may not be needed, depending on how your site is set up.

I think there is some set up required on TCP/IP on your mainframe, and the remote server must be listening for REXEC commands on port 512 IIRC. The service is RXSERVE according to my notes. You should verify access through your site support group if you run into any problems along the way.
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Jun 25, 2009 5:57 pm
Reply with quote

Thank you Robert for your help. i think this will be helpful.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 25, 2009 6:05 pm
Reply with quote

I hope so, Arvind -- I do know the posted JCL worked to access a UNIX server here, so with appropriate tweaking it should do the task for you.
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Jun 25, 2009 6:21 pm
Reply with quote

Although this is new to me...but now i can talk to client with some knowledge.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts executing XCTL command in COBOL witho... CICS 10
No new posts Receiving RC 5 when executing REXX pr... CLIST & REXX 3
No new posts Issues with executing a REXX MACRO th... TSO/ISPF 4
No new posts Get name of Subsystem routine is exec... All Other Mainframe Topics 2
This topic is locked: you cannot edit posts or make replies. Control-m JOB executing even when the... Compuware & Other Tools 6
Search our Forums:

Back to Top