CA XCOM Post Processing Script XCOMPP for Linux, UNIX, & Windows
search cancel

CA XCOM Post Processing Script XCOMPP for Linux, UNIX, & Windows

book

Article ID: 132531

calendar_today

Updated On:

Products

XCOM Data Transport XCOM Data Transport - Windows XCOM Data Transport - Linux PC XCOM Data Transport - z/OS

Issue/Introduction

This CA XCOM Data Transport Exit allows users to specify customized 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 script.

Environment

CA XCOM Data Transport for Linux PC
CA XCOM Data Transport for AIX
CA XCOM Data Transport for HP
CA XCOM Data Transport for Solaris
CA XCOM Data Transport for Unix

Resolution

XCOMPP is used to handle processing after you have received a file. For example, It can be used for
controlling print-spooling
managing notification facilities
additional processing of incoming files after a successful incoming file transfer is completed.

It is only invoked for incoming files. It does not work for jobs or reports.



This optional exit is invoked automatically by specifying the XPPCMD parameter in XCOM.GLB



The name of the command file used for user-defined post-processing for after receiving a file transfer. Specify this parameter in XCOM.GLB to invoke the pre-allocation exit xcompp. A sample command file is provided.



For example, you can use the xcompp exit to:
* controlling print-spooling
* managing notification facilities
* call additional OS and 3rd party utilities for further processing after a successful incoming file transfer is completed.



Customization is useful. For example, rename files, write an entry to the Windows event log , compress a file or start a transfer. The sample XCOMPP script is installed during the installation of CA XCOM Data Transport can be found in your site’s installation directory. In this sample script:



Script for Windows



Note: For Windows platforms, some scripts create new processes that must continue running after the script is returned to the transfer partner. 
To prevent the new process from being terminated, you must include the user in the CA XCOM Batch Interactive group (see below).



  • The XCOMPP_IDENT file transfers are subject to additional processing.
  • Rename the received file
  • Compress the newly named file
  • Transfer the file to XCOMPP_IDENT system
  • 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 MERCHANTABILITY, FITNESS FOR */
REM /* A PARTICULAR PURPOSE OR NONINFRINGEMENT. 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 /* XCOMNPP.bat */
REM /* */
REM /*--------------------------------------------------------------------*/



rem This procedure is invoked by the CA-XCOM Data Transport 
rem transaction program after the transfer is finished before the
rem conversation is terminated.
rem Not every argument will be populated;
rem the values contained in the arguments depend on those provided by the
rem remote system.



rem For a production version, disable the echo and pause statements
rem by setting use_echo to NO in the following SET command.
rem For a debug version, enable the echo and pause statements
rem by setting use_echo to YES in the following SET command.



set use_echo=NO




set compression=%1
rem Compression flag



shift
set notify_flag=%1
rem Notify flag



shift
set notify_name=%1
rem Notify Name



shift
set remoteuser=%1
rem Notify User



shift
set filetype=%1
rem File type (Always '3' for file)



shift
set fileaction=%1
rem File action (Create, replace or append)



shift
set datasettype=%1
rem Dataset type



shift
set carriage_flag=%1
rem Carriage return flag



shift
set code_flag=%1
rem Code flag



shift
set recfm=%1
rem Record format



shift
set lrecl=%1
rem Logical record length



shift
set remote_reqno=%1
rem Remote request Number



shift
set local_reqno=%1
rem Local Request number



shift
set group=%1
rem Group name



shift
set sysdata=%1
rem System Dependent User Data



shift
set xferdata=%1
rem Transfer Dependent User Data



shift
set ident=%1
rem Ident



shift
set truncation_flag=%1
rem Truncation flag



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



if NOT /%use_echo%/ == /YES/ GOTO SKIP_ECHO
      echo xcompp
      echo compression: %compression%
      echo notify_flag: %notify_flag%
      echo notify_name: %notify_name%
      echo remoteuser: %remoteuser%
      echo filetype: %filetype%
      echo fileaction: %fileaction%
      echo datasettype: %datasettype%
      echo carriage_flag: %carriage_flag%
      echo code_flag: %code_flag%
      echo recfm: %recfm%
      echo lrecl: %lrecl%
      echo remote_reqno: %remote_reqno%
      echo local_reqno: %local_reqno%
      echo groupname: %group%
      echo sysdata: %sysdata%
      echo xferdata: %xferdata%
      echo ident: %ident%
      echo truncation_flag: %truncation_flag%
      echo tmp_file: %tmp_file%
      echo local file: %file%
      echo remote_file: %remote_file%



pause



rem POSTPROCESS HERE !



 



:SKIP_ECHO
       if /%use_echo%/ == /NO/ echo XCOMPRE_REMOTE
      GOTO XCOMPP_END 
      if /%ident%/ == /"xcomvtest"/ GOTO XCOMPP_IDENT



 



:XCOMPP_IDENT
       if /%use_echo%/ == /YES/ echo XCOMPP_IDENT
rem copy file to temp work area 
      copy %remote_file% %TEMP%.%remote_file%
rem compress file using zip
      zip -r %TEMP%.%remote_file% %TEMP%.%remote_file%.zip
rem transfer file to IDENT system
      xcomtcp -c1 -f %XCOM_HOME%\config\xcomvtest.cnf LOCAL_FILE=%TEMP%.%remote_file%.zip QUEUE=NO
rem check RC and write an entry to the windows event log
      if %ERRORLEVEL% neq 0 GOTO XCOMPP_ERROR



rem write an entry to the windows event log
      eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO CA-XCOM /D "XCOMPP XCOMPP_IDENT"
      GOTO XCOMPP_END



 



XCOMPP_ERROR:



rem write an entry to the windows event log



       0 eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO CA-XCOM /D "XCOMPP XCOMPP_IDENT ERROR" 



 



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



      exit




Script for Linux and UNIX



#!/bin/sh
# @(#)xcompp.sh 1.1 3/27/92 20:19:33
# This procedure is invoked by the Unicenter CA-XCOM Data Transport transaction
# program after the transfer is finished before the conversation is terminated.
# Not every argument will be populated;
# the values contained in the arguments depend on those provided by the
# remote system.
###### START OF DEBUG SECTION ######
######
###### UNCOMMENT THE LINES BELOW TO DEBUG THIS SCRIPT ######
#exec >> /tmp/xcompp.out
#exec 2>&1
#set -vx
#PS4='[$0: $LINENO]+ '
#export PS4
###### END OF DEBUG SECTION ######
compression=$1 # Compression flag
shift
notify_flag=$1 # Notify flag
shift
notify_name=$1 # Notify Name
shift
remoteuser=$1 # Notify User
shift
filetype=$1 # File type (Whether it's file, job or report)
shift
fileaction=$1 # File action (Create, replace or append)
shift
datasettype=$1 # Dataset type
shift
carriage_flag=$1 # Carriage return flag
shift
code_flag=$1 # Code flag
shift
recfm=$1 # Record format
shift
lrecl=$1 # Logical record length
shift
remote_reqno=$1 # Remote request Number
shift
local_reqno=$1 # Local Request number
shift
group=$1 # Group name
shift
sysdata=$1 # System Dependent User Data
shift
xferdata=$1 # Transfer Dependent User Data
shift
ident=$1 # Ident
shift
truncation_flag=$1 # Truncation flag
shift
tmp_file=$1 # Local temporary file name
shift
file=$1 # Local file name
shift
remote_file=$1 # Remote file name



# POSTPROCESS HERE !




if [ $xferdata == "HR" ]
then



# encrtpt file



gpg -e -r $remoteuser $remoteuser/tmp/test.fil



# change file permissions 
chmod 644 $file
exit 0
fi



exit 0

Additional Information

Documentation to Create the CA XCOM Batch Interactive Group
CA XCOM Data Transport for Unix and Linux 12.0 Documentation