152 lines
6.6 KiB
HTML
152 lines
6.6 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: Call i5/OS programs from i5/OS PASE" />
|
||
|
<meta name="abstract" content="You can read the example in this topic to learn about calling programs in an i5/OS PASE program using the _PGMCALL runtime function." />
|
||
|
<meta name="description" content="You can read the example in this topic to learn about calling programs in an i5/OS PASE program using the _PGMCALL runtime function." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzalfcallprog.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2000, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2000, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rzalfcallprogexamp" />
|
||
|
<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: Call i5/OS programs
|
||
|
from i5/OS PASE</title>
|
||
|
</head>
|
||
|
<body id="rzalfcallprogexamp"><a name="rzalfcallprogexamp"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Example: Call <span class="keyword">i5/OS</span> programs
|
||
|
from <span class="keyword">i5/OS</span> PASE</h1>
|
||
|
<div><p>You can read the example in this topic to learn about calling programs
|
||
|
in an <span class="keyword">i5/OS™</span> PASE program
|
||
|
using the _PGMCALL runtime function.</p>
|
||
|
<div class="example"><p>The following example shows how you call programs in an <span class="keyword">i5/OS</span> PASE program using the _PGMCALL
|
||
|
runtime function.</p>
|
||
|
<p>Interspersed in the following example code are comments
|
||
|
that explain the code. Make sure to read these comments as you enter or review
|
||
|
the example.</p>
|
||
|
<div class="note"><span class="notetitle">Note:</span> By using the code examples, you agree
|
||
|
to the terms of the <a href="codedisclaimer.htm">Code license and disclaimer information</a>.</div>
|
||
|
<pre>/* This example uses the i5/OS PASE _PGMCALL function to call the i5/OS
|
||
|
API QSZRTVPR. The QSZRTVPR API is used to retrieve information about
|
||
|
i5/OS software product loads. Refer to the QSZRTVPR API documentation
|
||
|
for specific information regarding the input and output parameters needed
|
||
|
to call the API */
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
#include "as400_types.h"
|
||
|
#include "as400_protos.h"
|
||
|
|
||
|
int main(int argc, char * argv[])
|
||
|
{
|
||
|
|
||
|
/* i5/OS API's (including QSZRTVPR) typically expect character
|
||
|
parameters to be in EBCDIC. However, character constants in
|
||
|
i5/OS PASE programs are typically in ASCII. So, declare some
|
||
|
CCSID 37 (EBCDIC) character parameter constants that will be
|
||
|
needed to call QSZRTVPR */
|
||
|
|
||
|
/* format[] is input parameter 3 to QSZRTVPR and is
|
||
|
initialized to the text 'PRDR0100' in EBCDIC */
|
||
|
const char format[] =
|
||
|
{0xd7, 0xd9, 0xc4, 0xd9, 0xf0, 0xf1, 0xf0, 0xf0};
|
||
|
|
||
|
/* prodinfo[] is input parameter 4 to QSZRTVPR and is
|
||
|
initialized to the text '*OPSYS *CUR 0033*CODE ' in EBCDIC
|
||
|
|
||
|
This value indicates we want to check the code load for Option 33
|
||
|
of the currently installed i5/OS release */
|
||
|
const char prodinfo[] =
|
||
|
{0x5c, 0xd6, 0xd7, 0xe2, 0xe8, 0xe2, 0x40, 0x5c, 0xc3,
|
||
|
0xe4, 0xd9, 0x40, 0x40, 0xf0, 0xf0, 0xf3, 0xf3, 0x5c,
|
||
|
0xc3, 0xd6, 0xc4, 0xc5, 0x40, 0x40, 0x40, 0x40, 0x40};
|
||
|
|
||
|
/* installed will be compared with the "Load State" field of the
|
||
|
information returned by QSZRTVPR and is initialized to the text
|
||
|
'90' in EBCDIC */
|
||
|
const char installed[] = {0xf9, 0xf0};
|
||
|
|
||
|
/* rcvr is the output parameter 1 from QSZRTVPR */
|
||
|
char rcvr[108];
|
||
|
|
||
|
/* rcvrlen is input parameter 2 to QSZRTVPR */
|
||
|
int rcvrlen = sizeof(rcvr);
|
||
|
|
||
|
/* errcode is input parameter 5 to QSZRTVPR */
|
||
|
struct {
|
||
|
int bytes_provided;
|
||
|
int bytes_available;
|
||
|
char msgid[7];
|
||
|
} errcode;
|
||
|
|
||
|
|
||
|
/* qszrtvpr_pointer will contain the i5/OS 16-byte tagged system
|
||
|
pointer to QSZRTVPR */
|
||
|
ILEpointer qszrtvpr_pointer;
|
||
|
|
||
|
/* qszrtvpr_argv6 is the array of argument pointers to QSZRTVPR */
|
||
|
void *qszrtvpr_argv[6];
|
||
|
|
||
|
/* return code from _RSLOBJ2 and _PGMCALL functions */
|
||
|
int rc;
|
||
|
|
||
|
/* Set the i5/OS pointer to the QSYS/QSZRTVPR *PGM object */
|
||
|
rc = _RSLOBJ2(&qszrtvpr_pointer,
|
||
|
RSLOBJ_TS_PGM,
|
||
|
"QSZRTVPR",
|
||
|
"QSYS");
|
||
|
|
||
|
/* initialize the QSZRTVPR returned info structure */
|
||
|
memset(rcvr, 0, sizeof(rcvr));
|
||
|
|
||
|
/* initialize the QSZRTVPR error code structure */
|
||
|
memset(&errcode, 0, sizeof(errcode));
|
||
|
errcode.bytes_provided = sizeof(errcode);
|
||
|
|
||
|
/* initialize the array of argument pointers for the QSZRTVPR API */
|
||
|
qszrtvpr_argv[0] = &rcvr;
|
||
|
qszrtvpr_argv[1] = &rcvrlen;
|
||
|
qszrtvpr_argv[2] = &format;
|
||
|
qszrtvpr_argv[3] = &prodinfo;
|
||
|
qszrtvpr_argv[4] = &errcode;
|
||
|
qszrtvpr_argv[5] = NULL;
|
||
|
|
||
|
/* Call the i5/OS QSZRTVPR API from i5/OS PASE */
|
||
|
rc = _PGMCALL(&qszrtvpr_pointer,
|
||
|
(void*)&qszrtvpr_argv,
|
||
|
0);
|
||
|
|
||
|
/* Check the contents of bytes 63-64 of the returned information.
|
||
|
If they are not '90' (in EBCDIC), the code load is NOT correctly
|
||
|
installed */
|
||
|
if (memcmp(&rcvr[63], &installed, 2) != 0)
|
||
|
printf("i5/OS Option 33 is NOT installed\n");
|
||
|
else
|
||
|
printf("i5/OS Option 33 IS installed\n");
|
||
|
|
||
|
return(0);
|
||
|
}</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzalfcallprog.htm" title="You can take advantage of existing i5/OS programs (*PGM objects) when you create your i5/OS PASE applications. In addition, you can use the systemCL() function to run the CL CALL command.">Call i5/OS programs from i5/OS PASE</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|