ibm-information-center/dist/eclipse/plugins/i5OS.ic.apiref_5.4.0.1/expackilec.htm

430 lines
21 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 in ILE C: Program for packaging a product" />
<meta name="abstract" content="This example shows you the steps necessary to package your product like IBM's." />
<meta name="description" content="This example shows you the steps necessary to package your product like IBM's." />
<meta name="DC.Relation" scheme="URI" content="ExTaskPackprog.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="expackilec" />
<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 in ILE C: Program for packaging a product</title>
</head>
<body id="expackilec"><a name="expackilec"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example in ILE C: Program for packaging a product</h1>
<div><p>This example shows you the steps necessary to package your product
like IBM's.</p>
<div class="section"><pre>/********************************************************************/
/* Program Name: SFTWPRDEX */
/* */
/* Program Language: ILE C */
/* */
/* Description: This example shows you the steps necessary*/
/* to package your product like IBM's. */
/* */
/* Header Files Included: &lt;stdlib.h&gt; */
/* &lt;signal.h&gt; */
/* &lt;string.h&gt; */
/* &lt;stdio.h&gt; */
/* &lt;qszcrtpd.h&gt; */
/* &lt;qszcrtpl.h&gt; */
/* &lt;qszpkgpo.h&gt; */
/* &lt;qlicobjd.h&gt; */
/* &lt;qusec.h&gt; */
/* &lt;qliept.h&gt; */
/* */
/* APIs Used: QSZCRTPD - Create Product Definition */
/* QSZCRTPL - Create Product Load */
/* QSZPKGPO - Package Product Option */
/* QLICOBJD - Change Object Description */
/********************************************************************/
#include &lt;stdlib.h&gt;
#include &lt;signal.h&gt;
#include &lt;string.h&gt;
#include &lt;stdio.h&gt;
#include &lt;qszcrtpd.h&gt;
#include &lt;qszcrtpl.h&gt;
#include &lt;qszpkgpo.h&gt;
#include &lt;qlicobjd.h&gt;
#include &lt;qusec.h&gt;
#include &lt;qliept.h&gt;
/********************************************************************/
/* Function: Create_Prod_Def_Obj */
/* Description: Create the product definition ABC0050 for product */
/* ABC. */
/********************************************************************/
void Create_Prod_Def_Obj()
{
Qsz_Prd_Inf_t prod_info; /* Product information */
Qsz_Prd_Opt_t prod_opt_list; /* Product option list */
Qsz_Lng_Lod_t prod_lang_load; /* Product language load list */
Qus_EC_t error_code; /* Error code parameter */
char text_desc[50]; /* Text description */
/******************************************************************/
/* Fill in the product information. */
/******************************************************************/
memset(&amp;prod_info,' ',sizeof(prod_info));
memcpy(prod_info.PID,"0ABCABC",7);
memcpy(prod_info.Rls_Lvl,"V3R1M0",6);
memcpy(prod_info.Msg_File,"ABCMSG ",10);
memcpy(prod_info.Fst_Cpyrt,"*CURRENT ",10);
memcpy(prod_info.Cur_Cpyrt,"*CURRENT ",10);
memcpy(prod_info.Rls_Date,"941201",6);
memcpy(prod_info.Alw_Mult_Rls,"*NO ",4);
memcpy(prod_info.Reg_ID_Type,"*PHONE ",10);
memcpy(prod_info.Reg_ID_Val,"5072530927 ",14);
/******************************************************************/
/* Fill in the product option list. */
/******************************************************************/
memset(&amp;prod_opt_list,' ',sizeof(prod_opt_list));
memcpy(prod_opt_list.Opt,"0000",4);
memcpy(prod_opt_list.Msg_ID,"ABC0001",7);
memcpy(prod_opt_list.Alw_Dyn_Nam,"*NODYNNAM ",10);
memcpy(prod_opt_list.Cod_Lod,"5001",4);
/******************************************************************/
/* Fill in the product language load list. */
/******************************************************************/
memset(&amp;prod_lang_load,' ',sizeof(prod_lang_load));
memcpy(prod_lang_load.Lng_Lod,"2924 ",8);
memcpy(prod_lang_load.Opt,"0000",4);
memset(text_desc,' ',50);
memcpy(text_desc,"Product ABC",11);
/******************************************************************/
/* Initialize the error code to have the API send errors through */
/* the error code parameter. */
/******************************************************************/
error_code.Bytes_Provided=sizeof(error_code);
QSZCRTPD("ABC0050 ABC ", /* Product definition name */
&amp;prod_info, /* Product definition info */
&amp;prod_opt_list, /* Product option list */
1, /* Number of options */
&amp;prod_lang_load, /* Language load list */
1, /* Number languages */
text_desc, /* Text description */
"*USE ", /* Public authority */
&amp;error_code); /* Error code */
if (error_code.Bytes_Available &gt; 0)
{
printf("Failed in QSZCRTPD API with error: %.7s",
error_code.Exception_Id);
exit(1);
}
}
/********************************************************************/
/* Function: Create_Prod_Load_Obj */
/* Description: Create the product loads ABC0050 (MRM object) and */
/* ABC0029 (MRI object) for product ABC. */
/********************************************************************/
void Create_Prod_Load_Obj()
{
Qsz_Lod_Inf_t prod_load_info; /* Product load information */
Qsz_Lib_Inf_t prin_lib_info; /* Principal library info */
Qsz_Add_Lib_t add_libs; /* Additional library list */
Qsz_Pre_Ext_t preop_expgm; /* Preoperational exit program */
Qsz_Flr_Lst_t folder_list; /* Folder list */
Qus_EC_t error_code; /* Error code parameter */
char text_desc[50]; /* Text description */
/******************************************************************/
/* Fill in the product load information. */
/******************************************************************/
memset(&amp;prod_load_info,' ',sizeof(prod_load_info));
memcpy(prod_load_info.PID,"0ABCABC",7);
memcpy(prod_load_info.Rls_Lvl,"V3R1M0",6);
memcpy(prod_load_info.Opt,"0000",4);
memcpy(prod_load_info.Lod_Type,"*CODE ",10);
memcpy(prod_load_info.Lod_ID,"*CODEDFT",8);
memcpy(prod_load_info.Reg_ID_Type,"*PRDDFN ",10);
memcpy(prod_load_info.Min_Tgt_Rls,"*CURRENT ",10);
/******************************************************************/
/* Fill in the principal library information. There are no */
/* additional libraries. */
/******************************************************************/
memcpy(prin_lib_info.Dev_Lib,"ABC ",10);
memcpy(prin_lib_info.Prim_Lib,"ABC ",10);
memcpy(prin_lib_info.Post_Exit_Pgm,"ABCPGMMRM2",10);
memset(&amp;add_libs,' ',sizeof(add_libs));
/******************************************************************/
/* Fill in the preoperational exit program. */
/******************************************************************/
memcpy(preop_expgm.Pre_Ext_Pgm,"ABCPGMMRM1",10);
memcpy(preop_expgm.Dev_Lib,"ABC ",10);
/******************************************************************/
/* There are no folders. */
/******************************************************************/
memset(&amp;folder_list,' ',sizeof(folder_list));
memset(text_desc,' ',50);
memcpy(text_desc,"Product ABC",11);
/******************************************************************/
/* Initialize the error code to have the API send errors through */
/* the error code parameter. */
/******************************************************************/
error_code.Bytes_Provided=sizeof(error_code);
QSZCRTPL("ABC0050 ", /* Product load name */
&amp;prod_load_info, /* Product load information */
" ", /* Secondary language lib name */
&amp;prin_lib_info, /* Principal library */
&amp;add_libs, /* Additional libraries */
0, /* Number of additional libs */
&amp;preop_expgm, /* Preoperational exit program */
1, /* Number of preop exit pgms */
&amp;folder_list, /* Folder list */
0, /* Number of folders */
text_desc, /* Text description */
"*USE ", /* Public authority */
&amp;error_code); /* Error code */
if (error_code.Bytes_Available &gt; 0)
{
printf("Failed in QSZCRTPL API with error: %.7s",
error_code.Exception_Id);
exit(1);
}
/******************************************************************/
/* Fill in the product load information. */
/******************************************************************/
memcpy(prod_load_info.Lod_Type,"*LNG ",10);
memcpy(prod_load_info.Lod_ID,"2924 ",8);
/******************************************************************/
/* Fill in the principal library information. There are no */
/* additional libraries. */
/******************************************************************/
memcpy(prin_lib_info.Post_Exit_Pgm,"ABCPGMMRI2",10);
/******************************************************************/
/* Fill in the preoperational exit program. */
/******************************************************************/
memcpy(preop_expgm.Pre_Ext_Pgm,"ABCPGMMRI1",10);
QSZCRTPL("ABC0029 ", /* Product load name */
&amp;prod_load_info, /* Product load information */
"ABC2924 ", /* Secondary language lib name */
&amp;prin_lib_info, /* Principal library */
&amp;add_libs, /* Additional libraries */
0, /* Number of additional libs */
&amp;preop_expgm, /* Preoperational exit program */
1, /* Number of preop exit pgms */
&amp;folder_list, /* Folder list */
0, /* Number of folders */
text_desc, /* Text description */
"*USE ", /* Public authority */
&amp;error_code); /* Error code */
if (error_code.Bytes_Available &gt; 0)
{
printf("Failed in QSZCRTPL API with error: %.7s",
error_code.Exception_Id);
exit(1);
}
}
/********************************************************************/
/* Function: Change_Obj_Descr */
/* Description: Change object descriptions for all objects */
/* that make up Product ABC. Currently there are 15 */
/* objects. */
/********************************************************************/
void Change_Obj_Descr()
{
typedef struct {
char obj_name_lib[21];
char obj_type[11];
char prd_opt_id[5];
char prd_opt_ld[5];
char lp_id[4];
} obj_info_t;
typedef struct {
int numkey;
Qus_Vlen_Rec_3_t PID_rec;
char PID[4];
Qus_Vlen_Rec_3_t LID_rec;
char LID[4];
Qus_Vlen_Rec_3_t LP_rec;
char LP[13];
} change_obj_info_t;
int i;
obj_info_t obj_info[15] = {"ABCPGMMRM1ABC ","*PGM ",
"0000","5001","0ABCABCV3R1M0",
"ABCPGMMRM2ABC ","*PGM ",
"0000","5001","0ABCABCV3R1M0",
"ABCPGMMRI1ABC ","*PGM ",
"0000","2924","0ABCABCV3R1M0",
"ABCPGMMRI2ABC ","*PGM ",
"0000","2924","0ABCABCV3R1M0",
"ABCPGM ABC ","*PGM ",
"0000","5001","0ABCABCV3R1M0",
"QCLSRC ABC ","*FILE ",
"0000","2924","0ABCABCV3R1M0",
"ABCDSPF ABC ","*FILE ",
"0000","2924","0ABCABCV3R1M0",
"ABCPF ABC ","*FILE ",
"0000","2924","0ABCABCV3R1M0",
"ABCMSG ABC ","*MSGF ",
"0000","2924","0ABCABCV3R1M0",
"ABC ABC ","*CMD ",
"0000","2924","0ABCABCV3R1M0",
"ABCPNLGRP ABC ","*PNLGRP ",
"0000","2924","0ABCABCV3R1M0",
"ABC0050 ABC ","*PRDDFN ",
"0000","5001","0ABCABCV3R1M0",
"ABC0050 ABC ","*PRDLOD ",
"0000","5001","0ABCABCV3R1M0",
"ABC0029 ABC ","*PRDLOD ",
"0000","2924","0ABCABCV3R1M0",
"ABC ABC ","*LIB ",
"0000","5001","0ABCABCV3R1M0"};
change_obj_info_t cobji; /* Change object information */
Qus_EC_t error_code; /* Error code parameter */
char rtn_lib[10]; /* Return library */
/******************************************************************/
/* Fill in the changed object information. */
/******************************************************************/
cobji.numkey=3;
cobji.PID_rec.Key=13;
cobji.PID_rec.Length_Vlen_Record=4;
cobji.LID_rec.Key=12;
cobji.LID_rec.Length_Vlen_Record=4;
cobji.LP_rec.Key=5;
cobji.LP_rec.Length_Vlen_Record=13;
/******************************************************************/
/* Initialize the error code to have the API send errors through */
/* the error code parameter. */
/******************************************************************/
error_code.Bytes_Provided=sizeof(error_code);
for (i=0; i&lt;15; i++)
{
memcpy(cobji.PID,obj_info[i].prd_opt_id,4);
memcpy(cobji.LID,obj_info[i].prd_opt_ld,4);
memcpy(cobji.LP,obj_info[i].lp_id,13);
QLICOBJD(rtn_lib, /* Return library */
obj_info[i].obj_name_lib, /* Object name */
obj_info[i].obj_type, /* Object type */
&amp;cobji, /* Changed object information*/
&amp;error_code); /* Error code */
if (error_code.Bytes_Available &gt; 0)
{
printf("Failed in QLICOBJD API with error: %.7s",
error_code.Exception_Id);
exit(1);
}
}
}
/********************************************************************/
/* Function: Package_Prod */
/* Description: Package Product ABC so that all the SAVLICPGM, */
/* RSTLICPGM and DLTLICPGM commands work with the */
/* product. */
/********************************************************************/
void Package_Prod()
{
Qsz_Prd_Opt_Inf_t prod_opt_info; /* Product option information */
Qus_EC_t error_code; /* Error code parameter */
/******************************************************************/
/* Fill in the product option information. */
/******************************************************************/
memset(&amp;prod_opt_info,' ',sizeof(prod_opt_info));
memcpy(prod_opt_info.Opt,"0000",4);
memcpy(prod_opt_info.PID,"0ABCABC",7);
memcpy(prod_opt_info.Rls_Lvl,"V3R1M0",6);
memcpy(prod_opt_info.Lod_ID,"*ALL ",8);
/******************************************************************/
/* Initialize the error code to have the API send errors through */
/* the error code parameter. */
/******************************************************************/
error_code.Bytes_Provided=sizeof(error_code);
QSZPKGPO(&amp;prod_opt_info, /* Product option information */
"*YES", /* Repackage */
"*NO ", /* Allow object change */
&amp;error_code); /* Error code */
if (error_code.Bytes_Available &gt; 0)
{
printf("Failed in QSZPKGPO API with error: %.7s",
error_code.Exception_Id);
exit(1);
}
}
/********************************************************************/
/* Start of main procedure */
/********************************************************************/
void main()
{
/******************************************************************/
/* Create Product Definition Object */
/******************************************************************/
Create_Prod_Def_Obj();
/******************************************************************/
/* Create Product Load Objects */
/******************************************************************/
Create_Prod_Load_Obj();
/******************************************************************/
/* Change Object Description */
/******************************************************************/
Change_Obj_Descr();
/******************************************************************/
/* Package Product ABC */
/******************************************************************/
Package_Prod();
}
</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="ExTaskPackprog.htm" title="You can define, create, distribute, and maintain your own product using APIs. These examples demonstrate how you can use the APIs to package a product similar to the way IBM packages products.">Examples: Packaging your own software products</a></div>
</div>
</div>
</body>
</html>