186 lines
9.6 KiB
HTML
186 lines
9.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: Saving to multiple devices" />
|
|
<meta name="abstract" content="This example program shows how to save a large library using more than one device at the same time." />
|
|
<meta name="description" content="This example program shows how to save a large library using more than one device at the same time." />
|
|
<meta name="DC.Relation" scheme="URI" content="apiexmp.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="apiexsavdev" />
|
|
<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: Saving to multiple devices</title>
|
|
</head>
|
|
<body id="apiexsavdev"><a name="apiexsavdev"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Saving to multiple devices</h1>
|
|
<div><p>This example program shows how to save a large library using more
|
|
than one device at the same time.</p>
|
|
<div class="section"><div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm">Code license and disclaimer information</a> for important
|
|
legal information.</div>
|
|
<pre>/*******************************************************************/
|
|
/* PROGRAM: SaveBigLib */
|
|
/* */
|
|
/* LANGUAGE: ILE C */
|
|
/* */
|
|
/* DESCRIPTION: This is an example program for the use of */
|
|
/* a media definition in a save operation. */
|
|
/* It saves library BIGLIB in parallel format to */
|
|
/* two media files, using tape media library */
|
|
/* TAPMLB01. */
|
|
/* */
|
|
/* The flow of this program is as follows: */
|
|
/* (1) Build media definition input. */
|
|
/* (2) Create a media definition using */
|
|
/* QsrCreateMediaDefinition. */
|
|
/* (3) Save library BIGLIB using the media */
|
|
/* definition. */
|
|
/* */
|
|
/* APIs USED: QsrCreateMediaDefinition, QCMDEXC */
|
|
/* */
|
|
/*******************************************************************/
|
|
|
|
#include <qcmdexc.h>
|
|
#include <qsrlib01.h>
|
|
#include <qusec.h>
|
|
#include <string.h>
|
|
|
|
/*******************************************************************/
|
|
/* Variables for QsrCreateMediaDefinition */
|
|
/*******************************************************************/
|
|
char Data_Buffer[1000];
|
|
Qsr_TAPE0100_t *Input_Data;
|
|
Qsr_TAPE0100_Device_t *Device;
|
|
Qsr_TAPE0100_File_t *Media_File;
|
|
char *Next_Free;
|
|
char *Volid;
|
|
Qus_EC_t Err_Code;
|
|
int Data_Length;
|
|
char Text[50];
|
|
|
|
/*******************************************************************/
|
|
/* Variables for QCMDEXC */
|
|
/*******************************************************************/
|
|
char Cmd_String[100];
|
|
decimal(15,5) Cmd_Length;
|
|
|
|
/*******************************************************************/
|
|
/* Start of main() */
|
|
/*******************************************************************/
|
|
|
|
int main (int argc, char *argv[]) {
|
|
|
|
/*******************************************************************/
|
|
/* Specify input data for QsrCreateMediaDefinition. */
|
|
/*******************************************************************/
|
|
/*-----------------------------------------------------------------*/
|
|
/* Build general media definition input data. */
|
|
/* Use one device with two parallel device resources. */
|
|
/*-----------------------------------------------------------------*/
|
|
memset(Data_Buffer,0,sizeof(Data_Buffer));
|
|
Input_Data = (Qsr_TAPE0100_t*)Data_Buffer;
|
|
Next_Free = (char*)(Input_Data + 1);
|
|
Input_Data->Maximum_Resources = 2;
|
|
Input_Data->Minimum_Resources = 2;
|
|
Input_Data->Offset_First_Device = Next_Free - Data_Buffer;
|
|
Input_Data->Device_Count = 1;
|
|
|
|
/*-----------------------------------------------------------------*/
|
|
/* Build input data for the first device. */
|
|
/* Use device TAPMLB01 with two media files. */
|
|
/*-----------------------------------------------------------------*/
|
|
Device = (Qsr_TAPE0100_Device_t*)Next_Free;
|
|
Next_Free = (char*)(Device + 1);
|
|
memcpy(Device->Device_Name,"TAPMLB01 ",10);
|
|
Device->Offset_First_File = Next_Free - Data_Buffer;
|
|
Device->File_Count = 2;
|
|
|
|
/*-----------------------------------------------------------------*/
|
|
/* Build input data for the first media file for device TAPMLB01. */
|
|
/* Use the default sequence number, and volumes VOL11 and VOL12. */
|
|
/*-----------------------------------------------------------------*/
|
|
Media_File = (Qsr_TAPE0100_File_t*)Next_Free;
|
|
Next_Free = (char*)(Media_File + 1);
|
|
Media_File->Sequence_Number = 0;
|
|
Media_File->Offset_First_Volume_Id = Next_Free - Data_Buffer;
|
|
Media_File->Volume_Id_Count = 2;
|
|
Media_File->Volume_Id_Length = 6;
|
|
Media_File->Starting_Volume = 1;
|
|
Data_Length = Media_File->Volume_Id_Count
|
|
* Media_File->Volume_Id_Length;
|
|
Volid = Next_Free;
|
|
memcpy(Volid,"VOL11 VOL12 ",Data_Length);
|
|
if (Data_Length % 4) /* Ensure that Next_Free */
|
|
Data_Length += (4 - (Data_Length % 4)); /* is incremented by a */
|
|
Next_Free += Data_Length; /* multiple of 4. */
|
|
Media_File->Offset_Next_File = Next_Free - Data_Buffer;
|
|
|
|
/*------------------------------------------------------------------*/
|
|
/* Build input data for the second media file for device TAPMLB01. */
|
|
/* Use the default sequence number, and volumes VOL21 and VOL22. */
|
|
/*------------------------------------------------------------------*/
|
|
Media_File = (Qsr_TAPE0100_File_t*)Next_Free;
|
|
Next_Free = (char*)(Media_File + 1);
|
|
Media_File->Sequence_Number = 0;
|
|
Media_File->Offset_First_Volume_Id = Next_Free - Data_Buffer;
|
|
Media_File->Volume_Id_Count = 2;
|
|
Media_File->Volume_Id_Length = 6;
|
|
Media_File->Starting_Volume = 1;
|
|
Data_Length = Media_File->Volume_Id_Count
|
|
* Media_File->Volume_Id_Length;
|
|
Volid = Next_Free;
|
|
memcpy(Volid,"VOL21 VOL22 ",Data_Length);
|
|
if (Data_Length % 4) /* Ensure that Next_Free */
|
|
Data_Length += (4 - (Data_Length % 4)); /* is incremented by a */
|
|
Next_Free += Data_Length; /* multiple of 4. */
|
|
|
|
/********************************************************************/
|
|
/* Create the media definition. */
|
|
/********************************************************************/
|
|
Data_Length = Next_Free - Data_Buffer;
|
|
memset(Text,' ',sizeof(Text));
|
|
memcpy(Text,"Save BIGLIB",11);
|
|
QsrCreateMediaDefinition(
|
|
"SAVEBIGLIBQTEMP ", /* Media definition */
|
|
name, library */
|
|
Data_Buffer, /* Input data */
|
|
Data_Length, /* Length of data */
|
|
"TAPE0100", /* Format name */
|
|
"*USE ", /* Public authority */
|
|
Text, /* Text description */
|
|
1, /* Replace if it exists */
|
|
&Err_Code); /* Error code */
|
|
|
|
/********************************************************************/
|
|
/* Save library BIGLIB using the media definition. */
|
|
/********************************************************************/
|
|
strcpy(Cmd_String,
|
|
"SAVLIB LIB(BIGLIB) DEV(*MEDDFN) MEDDFN(QTEMP/SAVEBIGLIB)");
|
|
Cmd_Length = strlen(Cmd_String);
|
|
QCMDEXC(Cmd_String,Cmd_Length);
|
|
|
|
return 0;
|
|
}</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="apiexmp.htm" title="Contains example programs that use APIs and exit programs.">Examples: APIs</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |