FTP を使用して SQL 照会を行うには、FTP に対してコレクション EZAFTPMQ 内のパッケージ EZAFTPMQ の呼び出しを許可するプランをバインドし、そのプランの実行特権を PUBLIC に付与します。プランの名前は、FTP.DATA で DB2PLAN キーワードを使用して指定できます。指定しない場合のデフォルトは EZAFTPMQ です。この FTP 機能は、DB2® の表での SELECT 操作のみを行い、UPDATE 操作、INSERT 操作、または DELETE 操作は行いません。
次のサンプル・ジョブは、SEZAINST データ・セットの FTOEBIND メンバーに含まれています。これを使用して、FTP サーバーおよびクライアントが SQL 照会を実行できるようにすることができます。
//FTPSETUP JOB FTPSETUP,
// CLASS=A,
// NOTIFY=&SYSUID
//**************************************************************
//*
//* File name: tcpip.SEZAINST(FTOEBIND)
//* SMP/E distribution name: EZAFTPAB
//*
//* Licensed Materials - Property of IBM
//* This product contains "Restricted Materials of IBM"
//* 5647-A01 Copyright IBM Corp. 1997, 2011
//* All rights reserved.
//* US Government Users Restricted Rights -
//* Use, duplication or disclosure restricted by GSA ADP Schedule
//* Contract with IBM Corp.
//* See IBM Copyright Instructions.
//*
//* This JCL binds a plan that allows the application to ability the
//* invoke the package EZAFTPMQ in collection EZAFTPMQ.
//* The JCL allows execution of the plan EZAFTPMQ by PUBLIC.
//*
//* The FTP server and client use this plan. (See
//* Usage note #7)
//*
//*
//* Usage notes:
//*
//* 1. You must execute this job from a user ID that has
//* the authority to bind the EZAFTPMQ plan.
//*
//* 2. Change the STEPLIB DD statement in the FTPBIND and
//* FTPGRANT steps to reflect the DB2 DSNLOAD data set.
//*
//* 3. Change the DB2 sybsystem name in the FTPBIND and
//* FTPGRANT steps from SYSTEM(xxx) to the
//* installation defined DB2 subsystem name.
//*
//* 4. Change the library parameter in the FTPBIND step from
//* TCPIP.SEZADBRM to the installation defined TCPIP
//* SEZADBRM library.
//*
//* 5. Change the plan name in the FTPGRANT step from
//* DSNTIAYY to reflect the plan associated with the
//* program DSNTIAD.
//*
//* 6. Change the library parameter in the FTPGRANT step
//* from xxxxxx.RUNLIB.LOAD to reflect the library
//* where the DSNTIAD program resides.
//*
//* 7. You can bind the DBRM to a package and a plan name
//* other than EZAFTPMQ by changing the plan specified
//* in the FTPBIND and FTPGRANT steps.
//*
//**************************************************************
//FTPBIND EXEC PGM=IKJEFT01,DYNAMNBR=20
//STEPLIB DD DSN=xxxxxx.DSNLOAD,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(xxx)
BIND CURRENTDATA(NO) -
EXPLAIN(NO) -
ISOLATION(CS) -
LIBRARY('TCPIP.SEZADBRM') -
MEMBER(EZAFTPMQ) -
PACKAGE(EZAFTPMQ) -
RELEASE(COMMIT) -
VALIDATE(RUN)
BIND ACQUIRE(USE) -
ACTION(REPLACE) -
CACHESIZE(1024) -
CURRENTDATA(NO) -
EXPLAIN(NO) -
ISOLATION(CS) -
NODEFER(PREPARE) -
PKLIST(EZAFTPMQ.EZAFTPMQ) -
PLAN(EZAFTPMQ) -
RELEASE(COMMIT) -
VALIDATE(RUN) -
RETAIN
END
//*
//FTPGRANT EXEC PGM=IKJEFT01,DYNAMNBR=20
//STEPLIB DD DSN=xxxxxx.DSNLOAD,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(xxx)
RUN PROGRAM(DSNTIAD) -
PLAN(DSNTIAYY) -
LIBRARY('xxxxxx.RUNLIB.LOAD')
END
//SYSIN DD *
GRANT EXECUTE ON PLAN EZAFTPMQ TO PUBLIC;
//*