CA XCOM Data Transport

CA XCOM Data Transport for LUW FYI: Exits and Scripts: XCOMPRE 

May 20, 2019 12:29 PM

CA XCOM Data Transport for LUW Exits and Scripts:

 

The CA XCOM Data Transport Exits allow users to specify customize processing, by means of a batch script, before or after sending or receiving a file transfer request, allowing users to reference particular transfer parameters and by putting commands at the end of the scrip

 

The XCOMPRE exit can be used to:


* validate all locally and remotely initiated transfers before they begin
* customize CA XCOM parameters
  FILE_OPTION
  LOCAL_FILE
  REMOTE_FILE
  CARRIAGE_CONTROL_CHARACTERS 
  REMOVE_TRAIL_BLANKS

* Call Windows or other 3rd party utilities and/or API's for additional processing.

 

This optional exit is invoked by specifying the XPRECMD parameter in XCOM.GLB:

 

XPRECMD:
The name of the command file used for user-defined pre-allocation processing, for both locally and remotely initiated transfers. Specify this parameter in XCOM.GLB to invoke the pre-allocation exit xcompre. A sample command file is provided in %XCOM_HOME%\xcompre.bat.

 

If XPRECMD is set when the XCOMD CA XCOM Scheduler service is invoked, the pre-allocation exit will be active for locally and remotely initiated transfers. This gives the system administrator additional 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. For example, 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 as in certain email applications. Or, 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 into a different file, depending on the user ID of the sender. The script retrieves parameter values and if desired, changes the values using the -p option.

 

Note: The -p option, as shown in the sample script, is intended only for use with the xcompre exit and is not supported with the xcomqm command line options. The pre-allocation exit is invoked after CA XCOM Data Transport receives the CA XCOM Data Transport header from the partner, but before the transfer commences.

 

Xcompp.bat – for Windows:

 

https://support.ca.com/cadocs/1/x000031e.pdf

 

The sample XCOMPRE script, xcompp.bat, is installed during the installation of CA XCOM Data Transport for Windows and can be found in your site’s installation directory. In this sample script:

 

- The only LOCAL file transfers permitted are ones that do not specify %XCOM_HOME%\config\xcom.reject.
- The only REMOTE file transfers permitted are ones that do not have xcomv31 in USERID.
- If %XCOM_HOME%\config\xcom.force is in the LOCAL_FILE, the -p option is used to specify the values to use for LOCAL_FILE, 
  REMOTE_FILE, and FILE_OPTION.
- Write informational message to the Windows event log

 

echo off
REM /**********************************************************************/
REM /* */
REM /* ccccccccc aaaaaaaaa */
REM /* ccccccccccccc aaaaaaaaaaaaa ----------------------------- */
REM /* cccccccccccccccaaaaaaaaaaaaaaa C A X C O M (TM) */
REM /* ccccccccccccccccccaaa aaaaaa */
REM /* ccccccc cccccca aaaaa D A T A */
REM /* ccccccc aaaaa */
REM /* cccccc aaaaaaaaaaaaaaa T R A N S P O R T (R) */
REM /* cccccc aaaaaaaaaaaaaaaaa */
REM /* cccccc aaaaaaaaaaaaaaaaaa ----------------------------- */
REM /* cccccc aaaaaa aaaaa */
REM /* ccccccc caaaaa aaaaa */
REM /* ccccccc ccaaaaa aaaaa */
REM /* ccccccccccccccaaaaaa aaaaaa */
REM /* ccccccccccccccaaaaaaaaaaaaaaaaaa */
REM /* ccccccccccccc aaaaaaaaaaa aaaaa */
REM /* ccccccccc aaaaaaaa aaaaa */
REM /* */
REM /**********************************************************************/
REM /* */
REM /* Sample Code Notice v2.3 */
REM /* */
REM /* Copyright (c) 2012 CA. All rights reserved. */
REM /* */
REM /* This software and all information contained therein is */
REM /* confidential and proprietary and shall not be duplicated, used, */
REM /* disclosed or disseminated in any way without the express written */
REM /* permission of CA. All authorized reproductions must be marked */
REM /* with this language. */
REM /* */
REM /* TO THE EXTENT PERMITTED BY APPLICABLE LAW, CA PROVIDES THIS */
REM /* SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, INCLUDING WITHOUT */
REM /* LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANT-ABILITY, FITNESS FOR */
REM /* A PARTICULAR PURPOSE OR NON-INFRINGEMENT. IN NO EVENT WILL CA BE */
REM /* LIABLE TO THE END USER OR ANY THIRD PARTY FOR ANY LOSS OR DAMAGE, */
REM /* DIRECT OR INDIRECT, FROM THE USE OF THIS MATERIAL, INCLUDING */
REM /* WITHOUT LIMITATION, LOST PROFITS, BUSINESS INTERRUPTION, GOODWILL, */
REM /* OR LOST DATA, EVEN IF CA IS EXPRESSLY ADVISED OF SUCH LOSS OR */
REM /* DAMAGE. */
REM /* */
REM /*--------------------------------------------------------------------*/
REM /* */
REM /* XCOMPRE.bat */
REM /* */
REM /*--------------------------------------------------------------------*/

rem This procedure is invoked by the CA-XCOM Data Transport
rem transaction program for all locally and remotely initiated transfers 
rem before they begin.

rem For production version, disable the ECHO and PAUSE statements
rem by changing YES to NO in the following set command.

set use_echo=NO
set xcomqm="%XCOM_HOME%\xcomqm"

set local_reqno=%1
rem local request number/tid (000000 if unassigned)

shift
set initiator=%1
rem LOCAL or REMOTE

shift
set transfer_type=%1
rem JOB, REPORT or FILE

shift
set direction=%1
rem SEND or RECEIVE

shift
set restarting=%1
rem RESTARTING or FIRST_TRY

shift
set start_time=%1
rem transfer start date/time

shift
set end_time=%1
rem transfer end date/time

shift
set remote_system=%1
rem remote system id

shift
set remoteuser=%1
rem Remote user

shift
set remote_reqno=%1
rem Remote request Number

shift
set group=%1
rem REMOTE initiated only: transferGroup name

shift
set sysdata=%1
rem REMOTE initiated UNIX only: System Dependent User Data

shift
set xferdata=%1
rem REMOTE initiated UNIX only: Transfer Dependent User Data

shift
set ident=%1
rem REMOTE initiated UNIX only: Ident

shift
set tmp_file=%1
rem Local temporary file name

shift
set file=%1
rem Local file name

shift
set remote_file=%1
rem Remote file name

shift

set carriage_flag=%1
rem Carriage return / packing flag

shift
set code_flag=%1
rem Code flag

shift
set compression=%1
rem Compression flag

shift
set carriagecontrol=%1
rem Carriage Control Characters flag

if NOT /%use_echo%/ == /YES/ GOTO SKIP_ECHO
      echo xcompre
      echo Common parameters:
      echo local_reqno: %local_reqno%
      echo initiator: %initiator%
      echo transfer_type: %transfer_type%
      echo direction: %direction%
      echo restarting: %restarting%
      echo start_time: %start_time%
      echo end_time: %end_time%
      echo remote_system: %remote_system%
      echo remoteuser: %remoteuser%
      echo remote_reqno: %remote_reqno%
      echo group: %group%
      echo sysdata: %sysdata%
      echo xferdata: %xferdata%
      echo ident: %ident%
      echo tmp_file: %tmp_file%
      echo file: %file%
      echo remote_file: %remote_file%
      echo carriage_flag: %carriage_flag%
      echo code_flag: %code_flag%
      echo compression: %compression%
      echo cariage controle %carriagecontrol%
      pause
:SKIP_ECHO

rem PREPROCESS HERE !

if /%initiator%/ == /"LOCAL"/ GOTO XCOMPRE_LOCAL
if /%initiator%/ == /"REMOTE"/ GOTO XCOMPRE_REMOTE

 

GOTO XCOMPRE_END

 

:XCOMPRE_LOCAL
      if /%use_echo%/ == /YES/ echo XCOMPRE_LOCAL

rem The following two if statements are case-sensitive. To make them not case-sensitive
rem a "/I" must follow the word "if" as if /I /%file%/ == ......

      if /%file%/ == /"%XCOM_HOME%\config\xcom.reject"/ GOTO XCOMPRE_REJECT
      if NOT /%file%/ == /"%XCOM_HOME%\config\xcom.force"/ GOTO XCOMPRE_END
      %xcomqm% -p%local_reqno% LOCAL_FILE=c:\xcomnt\config\xcom.glb REMOTE_FILE=c:\temp\test.txt FILE_OPTION=CREATE
      GOTO XCOMPRE_END

 

:XCOMPRE_REMOTE
      if /%use_echo%/ == /YES/ echo XCOMPRE_REMOTE

rem The following two if statements are case-sensitive. To make them not case-sensitive
rem a "/I" must follow the word "if" as if /I /%file%/ == ......

      if /%remoteuser%/ == /"xcomv31"/ GOTO XCOMPRE_REJECT
      if NOT /%file%/ == /"%XCOM_HOME%\config\xcom.force"/ GOTO XCOMPRE_END    
      %xcomqm% -p%local_reqno% LOCAL_FILE=c:\tmp\test.txt REMOTE_FILE=c:\xcomnt\config\xcom.glb FILE_OPTION=CREATE
rem Process trailing blanks removal
      if /%xferdata%/ == /"REMOVETRBL"/ GOTO XCOMPRE_RMVTRBL
      %xcomqm% -p%local_reqno% REMOVE_TRAIL_BLANKS=NO
rem write an entry to the windows event log
      eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO CA-XCOM /D "XCOMPRE REMOVE_TRAIL_BLANKS=NO"
      GOTO XCOMPRE_END

 

:XCOMPRE_RMVTRBL
      %xcomqm% -p%local_reqno% REMOVE_TRAIL_BLANKS=YES
rem write an entry to the windows event log
      eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO CA-XCOM /D "XCOMPRE REMOVE_TRAIL_BLANKS=YES"
      GOTO XCOMPRE_END 

:XCOMPRE_REJECT
      if /%use_echo%/ == /YES/ echo XCOMPRE_REJECT
      %xcomqm% -p%local_reqno% TRANSFER=REJECT
rem write an entry to the windows event log
      eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO CA-XCOM /D "XCOMPRE TRANSFER=REJECT"

:XCOMPRE_END
      if /%use_echo%/ == /YES/ echo XCOMPRE_END
      exit

 

The sample XCOMPRE script, xcompp.sh, is installed during the installation of CA XCOM Data Transport for Linus/UNIX and can be found in your site’s installation directory. In this sample script:

 

- 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.

 

xcompre.sh - Linux and Unix platforms:

 

https://support.ca.com/cadocs/1/x000111e.pdf

 

The sample XCOMPRE script, xcompre.sh, is installed during the installation of CA XCOM Data Transport for Windows and can be found in your site’s installation directory. In this sample script:

 

- The only file transfers permitted are ones that do not have ‘payroll’ or ‘finance’ in USERID.
- If ‘payroll’ or ‘finance’ in USERID the -p option is used to specify the values to use for LOCAL_FILE, REMOTE_FILE and REMOTE_OPTION

 

The following is the sample xcompre script.

 

# /**********************************************************************/

# /*                                                                    */

# /*        ccccccccc      aaaaaaaaa                                    */

# /*     ccccccccccccc  aaaaaaaaaaaaa     ----------------------------- */

# /*    cccccccccccccccaaaaaaaaaaaaaaa          C A   X C O M (TM)      */

# /*   ccccccccccccccccccaaa     aaaaaa                                 */

# /*  ccccccc      cccccca         aaaaa             D A T A            */

# /* ccccccc                       aaaaa                                */

# /* cccccc              aaaaaaaaaaaaaaa        T R A N S P O R T (R)   */

# /* cccccc            aaaaaaaaaaaaaaaaa                                */

# /* cccccc           aaaaaaaaaaaaaaaaaa  ----------------------------- */

# /* cccccc          aaaaaa        aaaaa                                */

# /* ccccccc        caaaaa         aaaaa                                */

# /*  ccccccc      ccaaaaa         aaaaa                                */

# /*   ccccccccccccccaaaaaa       aaaaaa                                */

# /*    ccccccccccccccaaaaaaaaaaaaaaaaaa                                */

# /*     ccccccccccccc aaaaaaaaaaa aaaaa                                */

# /*       ccccccccc     aaaaaaaa   aaaaa                               */

# /*                                                                    */

# /**********************************************************************/

# /*                                                                    */

# /* Sample Code Notice                                            v2.3 */

# /*                                                                    */

# /* Copyright (c) 2012 CA.  All rights reserved.                       */

# /*                                                                    */

# /* This software and all information contained therein is             */

# /* confidential and proprietary and shall not be duplicated, used,    */

# /* disclosed or disseminated in any way without the express written   */

# /* permission of CA. All authorized reproductions must be marked      */

# /* with this language.                                                */

# /*                                                                    */

# /* TO THE EXTENT PERMITTED BY APPLICABLE LAW, CA PROVIDES THIS        */

# /* SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, INCLUDING WITHOUT   */

# /* LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR */

# /* A PARTICULAR PURPOSE OR NONINFRINGEMENT.  IN NO EVENT WILL CA BE   */

# /* LIABLE TO THE END USER OR ANY THIRD PARTY FOR ANY LOSS OR DAMAGE,  */

# /* DIRECT OR INDIRECT, FROM THE USE OF THIS MATERIAL, INCLUDING       */

# /* WITHOUT LIMITATION, LOST PROFITS, BUSINESS INTERRUPTION, GOODWILL, */

# /* OR LOST DATA, EVEN IF CA IS EXPRESSLY ADVISED OF SUCH LOSS OR      */

# /* DAMAGE.                                                            */

# /*                                                                    */

# /*--------------------------------------------------------------------*/

# /*                                                                    */

# /*    xcompre.sh.slinux                                               */

# /*                                                                    */

# /*--------------------------------------------------------------------*/

 

#!/bin/sh

# @(#)xcompre.sh

 

#       This procedure is invoked by the Unicenter CA-XCOM Data Transport

#       transaction program for all locally and remotely initiated transfers before they

#       begin.

 

###### START OF DEBUG SECTION ######

######

###### UNCOMMENT THE LINE BELOW TO DEBUG THIS SCRIPT ######

# exec > /tmp/xcompre.$1.out

# exec 2>&1

# set -vx

# PS4='[$0: $LINENO]+'

# export PS4

###### END OF DEBUG SECTION ######

 

tid=$1                          # Transfer request number/tid

echo $1 > /tmp/$tid.tidlog

shift

initiator=$1                    # LOCAL or REMOTE

echo $1 > /tmp/$tid.initlog

shift

file=$1

echo $1 >> /tmp/$tid.initlog

shift

receive=$1

echo $1 >> /tmp/$tid.initlog

shift

first_try=$1

echo $1 >> /tmp/$tid.initlog

shift

date=$1

echo $1 >> /tmp/$tid.initlog

shift

date_1=$1

echo $1 >> /tmp/$tid.initlog

shift

remote_ip_addr=$1

echo $1 >> /tmp/$tid.initlog

shift

user=$1

echo $1 >> /tmp/$tid.initlog

shift

remote_tid=$1

echo $1 >> /tmp/$tid.initlog

shift

var_1=$1

echo $1 >> /tmp/$tid.initlog

shift

var_2=$1

echo $1 >> /tmp/$tid.initlog

shift

xferdata=$1

echo $1 >> /tmp/$tid.initlog

shift

var_3=$1

echo $1 >> /tmp/$tid.initlog

shift

local_file=$1

echo $1 >> /tmp/$tid.initlog

shift

local_file_1=$1

echo $1 >> /tmp/$tid.initlog

shift

remote_file=$1

echo $1 >> /tmp/$tid.initlog

shift

var_X=$1

echo $1 >> /tmp/$tid.initlog

shift

var_A=$1

echo $1 >> /tmp/$tid.initlog

shift
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

 

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Related Entries and Links

No Related Resource entered.