Submitting JCL to a Server
You can use the SubmitJCL method (function) from your program or script to submit JCL to a z/OS server. A situation where you might use SubmitJCL is when a program or script, that runs from Windows Task Scheduler, needs to submit a nightly batch job to a z/ OS server.
The following scripts illustrate how to submit JCL to a z/OS server.
VBScript Example
'*********************************************************************
' File Name: SubmitJcl.vbs
' Description: Submit a JCL file to a server.
' Usage: SubmitJcl.vbs <server> <file.name>
'*********************************************************************
Dim strServerName
Dim strFileName
Dim objNetwork
Dim objServer
Dim bSuppressMessage
'----------------------------
' Get command line arguments
'----------------------------
If WScript.Arguments.Count < 2 Then
WScript.Echo "Usage: SubmitJcl.vbs <server> <file.name>"
WScript.Quit(1)
End If
strServerName = WScript.Arguments(0)
strFileName = WScript.Arguments(1)
'------------
' Submit JCL
'------------
Set objNetwork = CreateObject("ZosCom.ZosNetwork")
Set objServer = objNetwork.Server(strServerName)
bSuppressMessage = False
objServer.SubmitJcl strFileName, bSuppressMessage
WScript.Echo "Jcl submitted: Server=" & strServerName, _
"FileName=" & strFileName
...
JScript Example
/*********************************************************************
*
* JScript Example
*
* File Name: SubmitJcl.js
*
* Description: Submit a JCL file to a server.
*
* Usage: SubmitJcl.js <server> <file.name>
*********************************************************************/
var strServerName;
var strFileName;
var objNetwork;
var objServer;
var bSuppressMessage;
//////////////////////////////
// Get command line arguments
//////////////////////////////
if (WScript.Arguments.Count() < 2)
{
WScript.Echo("Usage: SubmitJcl.js <server> <file.name>");
WScript.Quit(1);
}
strServerName =
WScript.Arguments(0);
strFileName = WScript.Arguments(1);
//////////////
// Submit JCL
//////////////
objNetwork = new ActiveXObject("ZosCom.ZosNetwork");
objServer = objNetwork.Server(strServerName);
bSuppressMessage = false;
objServer.SubmitJcl(strFileName bSuppressMessage);
WScript.Echo("Jcl submitted: Server=" + strServerName,
"FileName=" + strFileName);
...