Sample Custom scripts to modify MAXRECLEN value for XCOM Gateway
search cancel

Sample Custom scripts to modify MAXRECLEN value for XCOM Gateway


Article ID: 211041


Updated On:


XCOM Data Transport - Windows


I have multiple files uploaded to the Gateway via the SFTP protocol. These files have different record lengths (LRECL) and will be onward transferred to the mainframe system as binary files. How can I accomplish that if the MAXRECLEN value of the Transfer XML needs to be modified accordingly for each of the files to be transferred with the proper LRECL? Otherwise, the data will wrap and not be useful for processing.


CA XCOM Gateway for Windows r12.0

CA XCOM Data Transport for Windows r11.6

CA XCOM Data Transport for z/OS 12.0


This can be accomplished by creating a Custom script and assigning it to the Policy. In this case a PRE-Onward script will need to be created.  For this example we will have a total of 3 scripts. A Transfer XML script, a Pre-Onward script, and a PowerShell script. The Sample Pre-Onward and PowerShell script will be included with the Knowledge Document.

Please be aware that these are Sample scripts, the user will be responsible for modifying and maintaining them.

Here are instructions and screen shots on how to implement the Custom script for Gateway and this specific scenario.

Note: Download the 3 sample scripts attached to this Knowledge Document and rename them as mentioned in the following instructions. The files are: Transfer_xml.dat, Modifyxml_ps1.dat, and Custom_bat.dat.

  1. We will assume that you already have a Policy defined. Otherwise, please refer to our XCOM Gateway manual for details on how to create a Policy.
  2. Make sure to have a Transfer XML script ready to use for the Policy. That Transfer XML script is the one used to onward transfer a file from the Gateway to the XCOM on the mainframe. We have attached a Sample Transfer XML for this example. The file is named Transfer_xml.dat and requires that you modify it.

You can also use the XCOM GUI to create one and modify the MAXRECLEN parameter to be MAXRECLEN="00000" as shown in the sample. In addition to  having FILE NAME="HLQ.&GUFILE" for the Remote file. You would replace the “HLQ” with your HLQ for the dataset.

By using the XCOM GUI you will be able to provide all the necessary information for the transfer, such as userid, password, remote file, and other important information.

For details, please refer to the XCOM for Windows manual.

  1. The first step to implement the Custom script is to add the Sample Transfer XML script and the Modifyxml_ps1.dat script to the “Manage Scripts” tab of the Policy.

Note: The sample scripts will need to be renamed by removing the “.dat” at the end of the file name. We purposely named them with the “.dat” to allow you to download them to your system without any problems.


  1. Adding the Transfer_xml.dat to the “Manage Scripts” is straightforward. Click the “Add” button, seen above, specify a Script Name, leave the Script Type as Onward, and cut and paste the contents of the Transfer_xml.dat into the Transfer XML box and modify. See Step 2. Once you have a modified script you want to click on the Validate XML button. Make any corrections if necessary if validation fails.


Note: The Transfer XML shown in the screen is a sample and will need to be modified to your site specifications.

  1. Adding the Custom script requires some details. Click the “Add” button, specify the Script Name as Modifyxml, the Script type will be Custom, check the “File Details” and “Transfer XML” boxes, specify the Custom Script file path and finally check the Response parameters box.

Note: This would be the Custom_bat.dat script. Again, remember to rename  the script to remove the “.dat”. You also want to put that batch script in a safe directory.


Note: You can display the Custom.bat script by clicking on the button next to the path.


  1. Now that you have added the 2 scripts to the “Manage Scripts” tab, you can continue with implementing the Policy for the Sample Custom script. You want to select the Policy and click Edit.


  1. Click on “Assign Scripts Non XCOM Insertions” to assign the Transfer XML to the Policy. Click on the drop box for the Script Name in the “Transfer XML” box and select the Transfer XML.


Note: You can display the actual XML by pressing the button next to the script name.


  1. Let us assign the Pre-Onward script under the “Custom Script Configuration” box, click on the Assign button. Once you get the “Assign Custom Script” box, click on the drop down for the Script name and select Modifyxml, and the Event would be PRE-ONWARD.


Here is how the screen will look like after you click the Done button:


  1. Save the Policy with the configuration and test your transfers.



custom_bat_1616420790961.dat get_app
modifyxml_ps1_1616420782246.dat get_app
transfer.xml_1616420764892.dat get_app