178 lines
6.7 KiB
HTML
178 lines
6.7 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="reference" />
|
|
<meta name="DC.Title" content="Example: Using Remote iSeries Access for Windows Command/Distributed Program Call APIs" />
|
|
<meta name="abstract" content="This example illustrates using remote iSeries Access for Windows Command/Distributed Program Call APIs." />
|
|
<meta name="description" content="This example illustrates using remote iSeries Access for Windows Command/Distributed Program Call APIs." />
|
|
<meta name="DC.Relation" scheme="URI" content="rzaikapprc.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="rcdpcprogex" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>Example: Using Remote iSeries Access for Windows Command/Distributed
|
|
Program Call APIs</title>
|
|
</head>
|
|
<body id="rcdpcprogex"><a name="rcdpcprogex"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Using Remote <span class="keyword">iSeries Access for Windows</span> Command/Distributed
|
|
Program Call APIs</h1>
|
|
<div><p>This example illustrates using remote iSeries™ Access for Windows<sup>®</sup> Command/Distributed
|
|
Program Call APIs.</p>
|
|
<div class="example"> <pre>#ifdef UNICODE
|
|
#define _UNICODE
|
|
#endif
|
|
#include <windows.h>
|
|
|
|
// Include the necessary RC/DPC Classes
|
|
#include <stdlib.h>
|
|
#include <iostream.h>
|
|
#include <TCHAR.H>
|
|
#include "cwbrc.h"
|
|
#include "cwbcosys.h"
|
|
/**********************************************************************/
|
|
|
|
void main()
|
|
{
|
|
cwbCO_SysHandle system;
|
|
cwbRC_SysHandle request;
|
|
cwbRC_PgmHandle program;
|
|
|
|
// Create the system object
|
|
if ( (cwbCO_CreateSystem("AS/400SystemName",&system)) != CWB_OK )
|
|
return;
|
|
|
|
// Start the system
|
|
if ( (cwbRC_StartSysEx(system,&request)) != CWB_OK )
|
|
return;
|
|
|
|
// Call the command to create a library
|
|
char* cmd1 = "CRTLIB LIB(RCTESTLIB) TEXT('RC TEST LIBRARY')";
|
|
if ( (cwbRC_RunCmd(request, cmd1, 0)) != CWB_OK )
|
|
return;
|
|
|
|
cout << "Created Library" << endl;
|
|
|
|
// Call the command to delete a library
|
|
char* cmd2 = "DLTLIB LIB(RCTESTLIB)";
|
|
if ( (cwbRC_RunCmd(request, cmd2, 0)) != CWB_OK )
|
|
return;
|
|
|
|
cout << "Deleted Library" << endl;
|
|
|
|
// Create a program object to create a user space
|
|
if ( cwbRC_CreatePgm(_TEXT("QUSCRTUS"),
|
|
_TEXT("QSYS"),
|
|
&program) != CWB_OK )
|
|
return;
|
|
|
|
// Add the parameters
|
|
// name is DPCTESTSPC/QGPL
|
|
unsigned char name[20] = {0xC4,0xD7,0xC3,0xE3,0xC5,0xE2,0xE3,0xE2,0xD7,0xC3,
|
|
0xD8,0xC7,0xD7,0xD3,0x40,0x40,0x40,0x40,0x40,0x40};
|
|
|
|
// extended attribute is not needed
|
|
unsigned char attr[10] = {0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40};
|
|
|
|
// initial size is 100 bytes
|
|
unsigned long size = 0x64000000;
|
|
|
|
// initial value is blank
|
|
unsigned char init = 0x40;
|
|
|
|
// public authority is CHANGE
|
|
unsigned char auth[10] = {0x5C,0xC3,0xC8,0xC1,0xD5,0xC7,0xC5,0x40,0x40,0x40};
|
|
|
|
// description is DPC TEMP SPACE
|
|
unsigned char desc[50] = {0xC4,0xD7,0xC3,0x40,0xE3,0xC5,0xD4,0xD7,0x40,0xE2,
|
|
0xD7,0xC1,0xC3,0xC5,0x40,0x40,0x40,0x40,0x40,0x40,
|
|
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
|
|
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
|
|
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40};
|
|
|
|
if ( cwbRC_AddParm(program, CWBRC_INPUT, 20, name) != CWB_OK)
|
|
return;
|
|
|
|
if ( cwbRC_AddParm(program, CWBRC_INPUT, 10, attr) != CWB_OK)
|
|
return;
|
|
|
|
if ( cwbRC_AddParm(program, CWBRC_INPUT, 4, (unsigned char*)&size) != CWB_OK)
|
|
return;
|
|
|
|
if ( cwbRC_AddParm(program, CWBRC_INPUT, 1, &init) != CWB_OK)
|
|
return;
|
|
|
|
if ( cwbRC_AddParm(program, CWBRC_INPUT, 10, auth) != CWB_OK)
|
|
return;
|
|
|
|
if ( cwbRC_AddParm(program, CWBRC_INPUT, 50, desc) != CWB_OK)
|
|
return;
|
|
|
|
|
|
// Call the program
|
|
if ( cwbRC_CallPgm(request, program, 0) != CWB_OK )
|
|
return;
|
|
|
|
cout << "Created User Space" << endl;
|
|
|
|
// Delete the program
|
|
if ( cwbRC_DeletePgm(program) != CWB_OK )
|
|
return;
|
|
|
|
// Create a program object to delete a user space
|
|
if ( cwbRC_CreatePgm(_TEXT("QUSDLTUS"),
|
|
_TEXT("QSYS"),
|
|
&program) != CWB_OK )
|
|
return;
|
|
|
|
// Add the parameters
|
|
// error code structure will not be used
|
|
unsigned long err = 0x00000000;
|
|
|
|
if ( cwbRC_AddParm(program, CWBRC_INPUT, 20, name) != CWB_OK)
|
|
return;
|
|
|
|
if ( cwbRC_AddParm(program, CWBRC_INOUT, 4, (unsigned char*)&err) != CWB_OK)
|
|
return;
|
|
|
|
// Call the program
|
|
if ( cwbRC_CallPgm(request, program, 0) != CWB_OK )
|
|
return;
|
|
|
|
// Delete the program
|
|
if ( cwbRC_DeletePgm(program) != CWB_OK )
|
|
return;
|
|
|
|
cout << "Deleted User Space" << endl;
|
|
|
|
// Stop the system
|
|
if ( cwbRC_StopSys(request) != CWB_OK )
|
|
return;
|
|
|
|
// Delete the system object
|
|
if ( cwbCO_DeleteSystem(system) != CWB_OK )
|
|
return;
|
|
|
|
}</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaikapprc.htm" title="The iSeries Access for Windows Remote Command/Distributed Program Call APIs allow the PC application programmer to access functions on the iSeries system. User program and system commands can be called without requiring an emulation session. A single iSeries program serves commands and programs, so only one iSeries job is started for both.">iSeries Access for Windows Remote Command/Distributed Program Call APIs</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |