xcompre Pre-allocation Exit

Use the xcompre exit to validate all locally and remotely initiated transfers before they begin, and to customize parameters for that transfer as indicated below.
Use the xcompre exit to validate all locally and remotely initiated transfers before they begin, and to customize parameters for that transfer as indicated below. This exit is invoked by specifying the XPRECMD parameter in xcom.glb. If XPRECMD is set when xcomd is invoked, the pre-allocation exit will be active for remotely initiated transfers. This gives the system administrator more capabilities to control access, such as allowing only a particular user to perform a transfer, or only allowing transfers to or from a particular directory.
Customization is useful in certain applications where the remote user does not specify the true file name, and the local system uses a database to map the specified name to the true local name. For example, certain e-mail application systems work in this way. By way of more explanation, for example, an incoming transfer specifies a certain file name, but the administrator of the local system that is receiving the file wants to place the data in a different file, depending on the user ID of the sender. The script retrieves parameter values and sends the relevant information to standard output, using the -g option, and if desired, changes the values using the -p option.
2
How to Use xcompre
An xcompre shell script is provided with
XCOM Data Transport
as a sample script, and is available online. It is an option to run an exit on the local system before the transfer starts. It can be tailored to meet individual user requirements. The xcompre exit collects and passes transfer ID information (tid) to xcomqm, along with the parameter values specified by the available options, -g and -p.
The -g and -p options, for use with xcomqm, as shown in the sample script are intended only for use with this exit.
The pre-allocation exit is invoked after
XCOM Data Transport
receives the
XCOM Data Transport
header from the remote partner, but before the transfer commences.
For information about shells and script changes, see Shells and Script Changes.
For remotely initiated transfers, the pre-allocation exit is invoked after
XCOM Data Transport
receives the
XCOM Data Transport
header from the remote partner, but before the transfer commences. For locally initiated transfers, the pre-allocation exit is invoked based on the value that is specified by the global parameter XCOM_LOCAL. If XCOMPRE_LOCAL is set, the pre-allocation exit is invoked before sending the
XCOM Data Transport
header to a remote partner.
xcompre Options
The following are the available options for xcompre and their associated parameters:
  • -g
    Passes transfer ID to xcomqm, and retrieves the values for the following parameters from the local database and passes them to standard output:
    • FILE_OPTION
    • LOCAL_FILE
    • REMOTE_FILE
    • REMOTE_LU
    • TRANSFER_TYPE
    • USERID
  • -p
    Changes the values for the following parameters based on the specified transfer ID (tid) and applies them to the transfer:
    •   FILE_OPTION
    •   LOCAL_FILE
    • REMOTE_FILE
Sample Script
#!/bin/sh# @(#)xcompre.sh# This procedure is invoked by the CA XCOM Data Transport # transaction program for all locally and remotely initiated # transfers before they begin. tid=$1 echo $1 > /tmp/$tid.tidlog # required for HPUX-10 if [ `uname` = 'HP-UX' ] then PATH=/opt/xcom/bin:$PATH fi xcomqm -g$tid |grep USERID > /tmp/$tid.userlog 'egrep' 'payroll|finance' /tmp/$tid.userlog if [ $? -ne 0 ] then exit 100 else xcomqm -p$tid LOCAL_FILE=/u/jc/test/000040.local \ REMOTE_FILE=abcdefg FILE_OPTION=CREATE 2>&1 > /tmp/$tid.errlog exit 0 fi
Example
In the example only file transfers permitted are ones that have
payroll
or
finance
in the USERID. If the USERID does not meet one of these criteria, the transfer is rejected. If the transfer is permitted, then the -p option is used to specify the values to use for LOCAL_FILE, REMOTE_FILE and FILE_OPTION.