Connect Enterprise Integration Tools Users Guide
Connect Enterprise Integration Tools Users Guide
Connect Enterprise Integration Tools Users Guide
Version 2.4
Connect:Enterprise UNIX Integration Tools Users Guide Version 2.4 First Edition
(c) Copyright 2004-2006 Sterling Commerce, Inc. All rights reserved. Additional copyright information is located at the end of the release notes. STERLING COMMERCE SOFTWARE ***TRADE SECRET NOTICE*** THE CONNECT:ENTERPRISE UNIX SOFTWARE (STERLING COMMERCE SOFTWARE) IS THE CONFIDENTIAL AND TRADE SECRET PROPERTY OF STERLING COMMERCE, INC., ITS AFFILIATED COMPANIES OR ITS OR THEIR LICENSORS, AND IS PROVIDED UNDER THE TERMS OF A LICENSE AGREEMENT. NO DUPLICATION OR DISCLOSURE WITHOUT PRIOR WRITTEN PERMISSION. RESTRICTED RIGHTS. This documentation, the Sterling Commerce Software it describes, and the information and know-how they contain constitute the proprietary, confidential and valuable trade secret information of Sterling Commerce, Inc., its affiliated companies or its or their licensors, and may not be used for any unauthorized purpose, or disclosed to others without the prior written permission of the applicable Sterling Commerce entity. This documentation and the Sterling Commerce Software that it describes have been provided pursuant to a license agreement that contains prohibitions against and/or restrictions on their copying, modification and use. Duplication, in whole or in part, if and when permitted, shall bear this notice and the Sterling Commerce, Inc. copyright notice. As and when provided to any governmental entity, government contractor or subcontractor subject to the FARs, this documentation is provided with RESTRICTED RIGHTS under Title 48 52.227-19. Further, as and when provided to any governmental entity, government contractor or subcontractor subject to DFARs, this documentation and the Sterling Commerce Software it describes are provided pursuant to the customary Sterling Commerce license, as described in Title 48 CFR 227-7202 with respect to commercial software and commercial software documentation. These terms of use shall be governed by the laws of the State of Ohio, USA, without regard to its conflict of laws provisions. If you are accessing the Sterling Commerce Software under an executed agreement, then nothing in these terms and conditions supersedes or modifies the executed agreement. Where any of the Sterling Commerce Software or Third Party Software is used, duplicated or disclosed by or to the United States government or a government contractor or subcontractor, it is provided with RESTRICTED RIGHTS as defined in Title 48 CFR 52.227-19 and is subject to the following: Title 48 CFR 2.101, 52.227-19, 227.7201 through 227.7202-4, FAR 52.227-14, and FAR 52.227-19(c)(1-2) and (6/87), and where applicable, the customary Sterling Commerce license, as described in Title 48 CFR 227-7202 with respect to commercial software and commercial software documentation including DFAR 252.227-7013, DFAR 252,227-7014, DFAR 252.227-7015 and DFAR 252.227-7018, all as applicable. The Sterling Commerce Software and the related documentation are licensed either AS IS or with a limited warranty, as described in the Sterling Commerce license agreement. Other than any limited warranties provided, NO OTHER WARRANTY IS EXPRESSED AND NONE SHALL BE IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR USE OR FOR A PARTICULAR PURPOSE. The applicable Sterling Commerce entity reserves the right to revise this publication from time to time and to make changes in the content hereof without the obligation to notify any person or entity of such revisions or changes. Connect:Direct is a registered trademark of Sterling Commerce. Connect:Enterprise is a registered trademark of Sterling Commerce, U.S. Patent Number 5,734,820. All Third Party Software names are trademarks or registered trademarks of their respective companies. All other brand or product names are trademarks or registered trademarks of their respective companies.
CEUITUG604
Contents
5
5 6 6 7 7 8 8 8 10 12 13 14 14 14 14 15 16 16 17 17 17 17 18 18 18
19
19 20 21 22
23
23 23 23 24 24 24 24 24 26 26 26 27 27 27 27 28 28 28 29 30 30 31
33
33 33 34 35 35 35 37 41 42 44 44 44 45
47
47
Index
49
Chapter 1
Connect:Enterprise File Agent is the component of Connect:Enterprise that monitors specified directories for files, then begins processing those files. It provides consistent monitoring capability to Connect:Enterprise, which allows directories to become active transfer points for a specific database.
Caution:
Errors in the File Agent configuration file are fatal to the program. The checking parameter (c) can be used to validate the configuration file.
The File Agent also has the capability of a direct API level interface with Connect:Enterprise for adding data files as batches to the Connect:Enterprise server. If the API connection attempt to Connect:Enterprise fails, the connection is retried once per minute for 5 minutes, for a total of five retries. If all attempts fail, a critical error is posted to the log stream. The program immediately starts another 5-minute cycle. Normal processing is suspended until the connection to Connect:Enterprise is reestablished. Logging is done to the File Agent stderr stream. The file name matching mechanism is implemented with the UNIX regular expression functions. This gives you a great deal of flexibility when specifying file-matching criteria. The documentation for the regular expression syntax is available as part of the standard UNIX documentation in the regcomp(3c) and regex(5) manual pages. Under normal conditions, each file is only processed once. The file is processed by the first configuration entry that matches the file name. You can use the regular expression-matching capabilities of the file= and ignore= entries to control the granularity of the selection, and ignore some files for selection entirely. All files that begin with a period character, with the exception of a .stop file, are ignored by the File Agent. When the .stop file is detected, the program is terminated. Existing files in the directory are re-recognized and reprocessed if their modification time or file size changes. This reprocessing allows you to accommodate remote sites repeatedly sending files of the same name.
When does the transfer occur? Do you want the File Agent to continue processing after an application or command is initiated or do you want the processing to pause until the initiated application or command is complete? How large are the data files? The File Agent monitors the directory periodically at specified intervals and for a number of cycles. What is a good time interval to check that the file is complete? Larger files require long periods of time and more cycles than shorter files. Do you want to delete the file after processing? Do you want to copy the file to other mailboxes? Read the process lines and option lines in the following section. This gives you a clear picture of the types of information you must collect for the configuration file. Before you execute the File Agent, you must create a File Agent configuration file, then check the configuration file syntax and program arguments.
4. Correct any errors that result from step 3 on page 7. 5. Repeat step 3 on page 7 and step 4 on page 8 until there are no errors. 6. Copy the contents of the temporary file into the active File Agent configuration file.
Comment Lines
Comment lines consist of a line beginning with a hash character (#). The remaining text up to the following new line character is ignored. Blank lines are ignored.
Option Lines
Option lines can consist of five different option fields, each of which can be overridden by the associated command line options to the program when it is started. If the associated command line option is specified, the option specified in the File Agent configuration file is ignored. For example, if D directory-path is specified on the command line, any instance of dir=directory-path in the configuration file is ignored.
Option Line Definition Command Line Option
The full path of the directory where File Agent locates the files. Number of wait cycles to delay processing a file to ensure that the file is complete. Number of seconds in a wait cycle. Number of concurrent child processes the File Agent can have at one time. Level of extended debugging information from the program. Use this option for debugging programs. The host name, TCP/IP port, user ID, and password needed to connect to the Connect:Enterprise server via TCP/IP. The user ID is used as the origination ID for all batches placed in the repository by the File Agent.
D W I n d M
Process Lines
Process lines consist of file=expression or ignore=expression fields followed by optional fields that specify the actions taken when the file is identified. When a file is identified, the File Agent can perform three tasks: 1. Add the file to the repository through the API. Turn off with id=none. 2. Run a command and wait for the program to complete, or initiate the command and continue running.
3. Delete the specified file and purge it from the file system. All process line fields support one or a combination of these three tasks. The supporting process fields are displayed in the following table and defined in the following section.
Process Line Field file=expression or ignore=expression addcard=addcard string bid=batch id string or batchid=batch id string case=y|n cclist=mbox1,mbox2,mbox3,mbox4 code=a|e|b command=shell command or synccmd=shell command delete=y|n id=mailbox or mailbox=mailbox id=none or mailbox=none multxmit=y|n trigger=y|n Inbound Both Outbound Delete file after processing. Default is delete=n. Mailbox ID to add file to. Turned off with id=none. Default is mailbox ID used for the Connect:Enterprise API. Turns off the mailbox add step. Both Outbound Outbound Both Character case sensitivity on matching. Default is case=y. List of carbon-copy mailboxes. Default is no cclist. Data type for added batches. Default is code=a. Shell command specification. Outbound Outbound Header record for API add. No Default. Batch ID for batch corresponding to file. Default is name of matched file. Data Direction Both Function Performed Select a file by file name. Required line.
Outbound Outbound
Batch MultiTransmit Flag. Default is multxmit=n. Auto connect trigger for contact = data_immediate in ACD. Default is trigger=n.
delete = y|n
10
Field command=shell-command
Description specifies a UNIX shell command. The command uses the UNIX system (3) command and processing continues immediately. That is, the child UNIX process runs asynchronously with the File Agent. The command field supports the following string substitution macros and is also eligible for substitution of RE subfields from the file field. %PThe %P token is replaced with the fully qualified file name of the staged file. %DThe %D token is replaced with the directory name of the staging directory. %FThe %F token is replaced with the simple file name of the staged file. %TThe %T token is replaced with the transaction number corresponding to the staged file. %LThe %L token is replaced with the directory name of the logging directory. For example, a command=/bin/cp %P /tmp/ftpdir/%F with an input file name of /opt/stercomm/stage/add.992341.08 results in a shell-command of /bin/cp /opt/stercomm/stage/add.992341.08 /tmp/ftpdir/add.992341.08. Caution: Use of delete=y is not allowed with the command field because it would be possible for the File Agent to purge the staged file before the shell-command opened the file for processing.
synccmd=shell command
specifies a UNIX shell command. The command uses the UNIX system (3) command, and the File Agent waits until the command is finished. That is, the child UNIX process runs synchronously with the File Agent. The delete field can be used with the synccmd parameter to purge the file after the command is finished. Note: If the program that the shell command is executing hangs when using the synccmd, the entire file agent daemon will hang until the hung program is resolved.
id=mailbox
specifies the destination mailbox ID for the file (outbound). The field defaults to the remote ID field of the M command parameter or the coemption string. If none is specified as the destination mailbox (id=none), the file is not added to the repository. Any subsequent commands and deletions are processed normally. Use id=none to process files without adding them to the repository (inbound). The id field is eligible for substitution of RE subfields from the file field. However, only the first eight characters are used.
bid=mailbox batch id
specifies the batch name to be used as the batch identifier when the file is inserted into the destination mailbox (id=mailbox). The value of the bid field defaults to the file name matched by the file field. The bid field is eligible for substitution of RE subfields from the file field.
11
Field multxmit=y|n
Description allows the multiple transmit (M) mailbox batch flag to be set on batches added to the repository. The default is multxmit=n.
cclist=mbox1,mbox2,mbox3 designates a carbon copy list of mailbox ID fields that receive a copy of the batch being added to the mailbox designated in the ID field. trigger=y|n triggers a Connect:Enterprise auto connect session if File Agent is configured appropriately. The default is trigger=n.
# Ignore files ending in .tmp # Note: if you allow FTP renames (the default in CEU 2.0 and above unless # you code -K on your cmuftpd daemon startup), you will want to code # the -e parm on your cmumboxd startup, to also kick off the Informer when # the rename from filename.tmp to filename occurs. # ignore="[.]tmp$"
12
# INBOUND DATA FROM CEU VIA BATCH RECEIVE INFORMER # # Detect a touch file from the Batch Receive Informer of the format: # # ce.batch_num.batch_file_size.mailbox_id.canonical_batch_id # # Example 1: # Invoke the /home/ceunix/etc/eob-caller.sh script which then calls the # /home/ceunix/eob.sh script with the fully qualified touch file name (%P) # and the batch number (&1). The eob-caller.sh script will delete # the touch file after calling the eob.sh script. #file="^ce[.]([0-9]+)[.]([0-9]+)[.](.*)[.](.*)" case=n id=none command="/home/ceunix/etc/eob-caller.sh %P &1" # Example 2: # Invoke the /home/ceunix/etc/direct.sh script so Connect:Direct can # process the inbound batch represented by the touch file. # The direct.sh script is responsible for deleting the touch file. #file="^ce[.]([0-9]+)[.]([0-9]+)[.]([^.]+)[.](.*)" case=n id=none command="/home/ceunix/etc/direct.sh %P &1 %L %T" # Example 3: # Invoke the /home/ceunix/etc/mqwrite.sh script to send the inbound # batch represented by the touch file to an MQ Series queue. # The mqwrite.sh script is responsible for deleting the touch file. # Note: synccmd allows only one process, regardless of procs= setting above. #file="^ce[.]([0-9]+)[.]([0-9]+)[.]([^.]+)[.](.*)" id=none delete=y synccmd="/home/ceunix/etc/mqwrite.sh -f %P -t %T -b &1 -l %L -q ENTERPRISE.LOCAL.QUEUE -r ENTERPRISE.QUEUE.MANAGER -g yes -m text" # OUTBOUND DATA FROM STAGING DIRECTORY TO CEU # # Detect a real file to be added to the Connect:Enterprise UNIX mailbox. # # Example 1: # Add a file of the form "add_to_mailbox.anything" to the repository #file="^add_to_mailbox.*" id=your_mailboxid_here code=b # Example 2: # Add a file from Connect:Direct to the repository #file="(.*)[.]CCOD[.](.*)[.](.*)[.](.*)[.](.*)[.](.*)"
id=ceuser code=b
13
C file name
File Agent configuration file name check configuration file directory path debugging level help number of wait cycles log file x x x
14
Parameter
Function
M host
name:ip-port:remote-id:password
mailbox-designation
n W seconds
x x
Parameter Descriptions
The following table describes each parameter:
Parameter C file name c Description specifies the full path name to the File Agent configuration file for file name matching. This parameter can be specified only on the command line. checks the File Agent configuration file and program arguments, then exits the program. Use this parameter to validate File Agent configuration file changes before starting the program in production mode. Errors in parameters and the configuration file are logged. If errors exist, the program exits with a non-zero return code. If no errors exist, a zero return code is issued. specifies the full path to the file directory the File Agent monitors for files to arrive. This path should be a fully qualified path beginning with a back slash (/). You can specify this parameter in the File Agent configuration file with the dir field. turns on logging of extended debugging information from the program. A high value for level results in more detailed diagnostics. This parameter is mostly for debugging the program during development. You can specify this parameter by using debug=nnn in the File Agent configuration file, but the command line takes precedence. prints a short-form help message concerning program arguments to the stderr of the program then exits the program. specifies the number of full wait cycles the watch program delays processing a file to make sure that it is complete. This parameter can also be specified as cycles in the File Agent configuration file. specifies the full path for the file where the file agent log information is written. This parameter is required when checking the File Agent configuration file. Note: If an instance of File Agent is already running in a given directory, and you attempt to start an additional File Agent in the same directory, a log file with the name filename.{pid} is created and the contents of filename.{pid} will indicate which UNIX process is already running in the directory. The {pid} is the process ID assigned by Connect:Enterprise when attempting to create an additional instance File Agent.
D directory-path
d level
h I number
l file name
15
Description specifies the information for establishing the File Agent API session via TCP/IP to the Connect:Enterprise server. The specific elements are the host name of the server where the repository resides, the TCP/IP listening port used by Connect:Enterprise server on that host, the mailbox remote ID to use for the session, and the mailbox password to use for the session. The M parameter must be specified with all 4 values. If an API session cannot be established, the program goes into a timer-retry session. It waits for 60 seconds and then tries to establish the session again. An error message is issued upon each failure. If the program fails five times in a row, the attempt is aborted, a critical error message is logged, and another wait cycle is observed before another connection attempt is made. If problems persist, verify that Connect:Enterprise is started. Other causes can be related to network or File Agent configuration. The File Agent attempts to contact the mailbox server at 1-minute intervals for 5 minutes before terminating an attempt. Another attempt is made at the next interval when the File Agent checks the directory.
W seconds
specifies the number of seconds that constitute a wait cycle. The total time that a file must remain unmodified to be processed can be calculated as cycles times interval. For example, with I 4 and W 15, the file would have to be idle for a total of at least 60 seconds and a maximum of 75 seconds before processing begins. This parameter can also be specified as interval in the File Agent configuration file.
fashutdown Format
During normal operations, the ceushutdown script calls the fashutdown script to shut down the File Agent. The default call to fashutdown uses the file $CMUHOME/etc/fileagent.cfg to locate the corresponding File Agent and terminate it.
Note: If you run more than one File Agent or if you use a configuration file other than $CMUHOME/etc/fileagent.cfg, you must modify the ceushutdown script.
You can request a shutdown of the File Agent using the following command:
fashutdown [immediate] [config-file|stage directory]
16
fashutdown Parameters
The fashutdown command has the following optional parameters:
Parameter immediate Description with the immediate argument, the File Agent is terminated by signal (immediately). Otherwise, the File Agent is terminated gracefully. If the -i parameter is supplied to ceushutdown, then the immediate parameter is used with fashutdown. with this argument, the fashutdown script terminates the corresponding instance of File Agent.
The value for the staging.directory parameter is the full path to the File Agent staging directory.
17
Following is an example:
file=cddelete.me.CCOD.0.0.cdunix.node.P
Startup
In order for the Connect:Direct to File Agent notification to work, you must start the components in the following order: 1. Connect:Enterprise server 2. Connect:Enterprise File Agent 3. Connect:Direct server
18
Chapter 2
The Batch Receive Informer is part of the mailbox daemon and is notified whenever a batch is added to the repository. Use the Batch Receive Informer to designate which batches are to be processed by the File Agent and to notify the File Agent that a batch matching the preset criteria has been received. This chapter discusses the following topics: Understanding the Batch Receive Informer functionality Setting the CE_BATCHRECEIVE variable Creating and Modifying the Batch Receive Informer configuration file
19
The Batch Receive Informer searches for the file in the $CMUHOME/etc directory unless an absolute path name is defined. If CE_BATCHRECEIVE is not set, the Batch Receive Informer looks for $CMUHOME/etc/ce_receive.cfg. For example:
#!/bin/ksh # # This script will bring up Connect:Enterprise UNIX. # Each daemon will be started on the host that was specified # during the Connect:Enterprise UNIX customization procedure. # # Please note that this sample script should be reviewed and # edited as necessary before starting Connect:Enterprise UNIX. # As a default, this sample, as created at the time of installation, # assumes that all the daemons will be running locally, not distributed. # The commented lines, below, illustrate these same daemons being # started on remote hosts: # # export CE_BATCHRECEIVE=informer.cfg" cd /home/fremont6/user1/enterprise/ceunix/trace "/home/fremont6/user1/enterprise/ceunix/sun/bin/cmuctld" -P 17500 & sleep 1 "/home/fremont6/user1/enterprise/ceunix/sun/bin/cmumboxd" -H georges -P 17500 & sleep 1 "/home/fremont6/user1/enterprise/ceunix/sun/bin/cmuacd" -H georges -P 17500 & sleep 1 "/home/fremont6/user1/enterprise/ceunix/sun/bin/cmulogd" -H georges -P 17500 & sleep 1 "/home/fremont6/user1/enterprise/ceunix/sun/bin/cmuexitd" -H georges -P 17500 & sleep 1 # "/home/fremont6/user1/enterprise/ceunix/sun/bin/cmubscda" -H georges -P 17500 & sleep 1 # "/home/fremont6/user1/enterprise/ceunix/sun/bin/cmuasyd" -H georges -P 17500 & sleep 1 "/home/fremont6/user1/enterprise/ceunix/sun/bin/cmuftpd" -H georges -P 17500 & sleep 1 # # End of the Connect:Enterprise UNIX startup script. #
20
protocol
The Batch Receive Informer configuration file can consist of as many definition lines as needed. The first line to match an incoming batch is used. Comment lines begin with # and blank lines are allowed.
21
!offline,!ediint,!http '*'
22
Chapter 3
MQSeries Support
Connect:Enterprise provides basic integration with IBM MQSeries. Users can retrieve data from MQSeries queues and write it to the Connect:Enterprise repository. This functionality is referred to as MQREAD and involves the Message Agent (Magent) component. With the MQWRITE functionality, users can retrieve data from the repository and write it to an MQSeries queue. MQWRITE is implemented as part of the existing Connect:Enterprise File Agent component.
System Requirements
IBM MQSeries version 5.1 or later is required for Connect:Enterprise MQSeries support. Only MQSeries Type 2 headers are supported. Connect:Enterprise MQSeries support is available on all AIX, HP-UX, and Solaris platforms as described in the Connect:Enterprise UNIX Version 2.3.00 Release Notes with the exception of Solaris 8. MQSeries is not certified for the Solaris 8 operating system.
23
cmu=host:port:id:pass
The host name, TCP/IP port, user ID, and password needed to connect to the Connect:Enterprise server via TCP/IP. The user ID is used as the origination ID for all batches placed in the repository by the File Agent.
Global Lines Global lines apply to all process line entries. These options are not available from the command line.
Parameter qmname
Description Specifies the queue manager name that the Message Agent accesses when processing messages on the defined message queues. If not supplied, the Message Agent uses the default queue manager defined on the system.
Process Lines The process lines define each queue to be monitored. Process lines consist of mqname= followed by optional fields that specify the actions taken for the defined message queue. The following table lists each parameter and its description that is passed from Magent to MQREAD. Required parameters are in bold. Default values are underlined.
24
Description Specifies the mailbox ID where the batches should be created. Name of MQSeries queue to monitor. Specifies if and how multiple messages are concatenated into a single batch. The value group indicates that batches are created according to the MQSeries message groups. Messages belonging to the same message group are concatenated into a single repository batch. Messages that arrive ungrouped are written to separate batches containing only the data from that message. The value count indicates that messages are concatenated into a single batch based on the mcount value. MQREAD retrieves mcount messages one at a time from the queue and concatenates their data into a single batch. If the queue is empty before mcount messages are retrieved, then the batch is created with data from fewer than mcount messages. The queue is considered empty if no message arrives for mdelay seconds.
mode
text|stream
Specifies whether or not to append new line characters to the message data. The value text indicates that a new line character is appended to the data of each message received before it is written to the repository. In this mode, the repository batch is written with a new line character following the data of each message. The pad and padlen parameters are ignored. Specifies the maximum number of messages to concatenate into a single batch. The default value is 10000. The parameter mcount is only used when moption=count. Specifies the number of seconds to delay before assuming that the queue is empty. The parameter mdelay is only used when moption=count. The default value of 0 indicates that MQREAD should close the batch immediately if the queue is emptied before mcount messages have been retrieved. Specifies the character used to pad message data before it is written to the repository. Padding is not performed if pad is not specified. This parameter is ignored when mode=text. Specifies the length to pad message data before it is written to the repository. This parameter is ignored when mode=text. Specifies the queue manager name that the Message Agent accesses when processing messages on the defined message queues. If not supplied, the Message Agent uses the default queue manager defined on the system. Specifies the batch ID for the created batch. Specifies the user ID for the Connect:Enterprise connection. Specifies the user password for the Connect:Enterprise connection.
mcount
mdelay
pad
character
padlen qmname
25
none
26
Parameter M
Value
Description
host:port:login[:password] Specifies the Connect:Enterprise connection information. If you include this information, the value of the cmu= configuration variable in the configuration file is ignored. path to mqagent.cfg Specifies the path of the mqagent.cfg file. If you do not provide this path, the default of $CMUHOME/etc/mqagent.cfg is used.
Following is an example startup script. Items in bold identify where the parameters are added:
#!/bin/ksh # # MQ Agent Startup Script - Installed InstallationDateTime # mqagent=/users/l2/ce20/aix/bin/magent if [ "X$1" != "X" ]; then echo $1 | $mqagent -d -p else $mqagent -d fi
Starting the Message Agent Using the Startup Script The Message Agent is normally started as part of ceustartup using the cemqstartup.sh script. The system administrator password is required at startup. The password can be specified in the mqagent.cfg file or the startup script prompts for the password. Starting the Message Agent from the Command Line To start the Message Agent from the command line, enter the following command:
$ cemqstartup.sh
There are no parameters associated with cemqstartup.sh. Stopping the Message Agent Using the Shutdown Script The Message Agent is normally shut down as part of ceushutdown. The Message Agent shutdown script sends a SIGTERM to the Message Agent so that all currently running processes are completed prior to shutdown. Stopping the Message Agent from the Command Line To stop the Message Agent from the command line, enter the following command:
$mashutdown
27
MQWRITE
MQWRITE reads a stream file and writes messages to a configured MQSeries message queue. The mqwrite.sh script extracts data from theConnect:Enterprise repository based on a file name created by the Batch Receive Informer. After extracting the data to a temporary file, the script calls the MQWRITE executable. MQWRITE reads the file, then writes the file as messages according to the parameters defined in the File Agent configuration file. The functionality of MQWRITE accommodates two general data formats in stream files. The first format is one continuous stream of bytes as might be represented by an executable binary file. The second format is a stream file containing one or more logical records identified by a record delimiter or byte count.
Configuring MQWRITE
The MQWRITE feature is configured in the File Agent configuration file, which is located at $CMUHOME/etc/fileagt.cfg. The following table lists each MQWRITE configuration parameter and its description. Required parameters are in bold. Default values are underlined.
Parameter f -F
Description Specifies the full path and file name. It is specified as f %P in the UNIX shell command in the configuration file. nspecifies that the data format for the MQ Series message will be set to MQMD_FMT_NONE. This is the default. sspecifies that the data format for the MQ Series message will be set to MQMD_FMT_STRING.
t b l q
Specifies the transaction number. It is specified as t %T in the UNIX shell command in the configuration file. Specifies the batch number. It is specified as b &1 in the UNIX shell command in the configuration file. Specifies the MQWRITE log file directory name. It is specified as l %L in the UNIX shell command in the configuration file. Specifies the message queue name where messages are written.
28
MQWRITE
Parameter r
Description Specifies the local MQSeries queue manager to which MQWRITE connects. The default value is the default local queue manager configured with MQSeries. Specifies the maximum data size of the messages. When q specifies a local queue, a value of 0 indicates that the MaxMsgSize defined for the queue is used. The 0 value is invalid when q specifies a local definition of a remote queue. The default value is 10000. This parameter is ignored when m text is specified and q specifies a local queue. Specifies if messages from a file are written as a message group. Messages assigned to a message group can be retrieved from the final destination queue as a group in the original sequence. The default value is yes. Indicates to write debugging information to the given file name. Indicates if the file information is read as a continuous stream or one line at a time based on new line characters. See the Continuous Stream File on page 30 and Logical Record Stream File on page 30 for more information. Displays usage information.
y|n or yes|no
d m
-h or -?
MQWRITE Configuration Example The following sample excerpts from fileagt.cfg show the MQWRITE information:
# # Filenames of the format created by the Batch Receive Informer are matched # It is not added to the repository # The file is passed to MQSeries mqwrite.sh to be processed # The file is deleted after processing by mqwrite.sh # # -f %P The %P token is replaced with the fully qualified file name of the staged # file # -t %T The %T token is replaced with the transaction number corresponding to the # staged file # -b %1 The %1 token is replaced with the first field in the regular expression # parsed in the -f statement. In this example it is (.*) # -l %L The %L token is replaced with the directory path of the MQWRITE log file # -q ENTERPRISE.LOCAL.QUEUE Specifies the queue name where the staged file will be # written # -r ENTERPRISE.QUEUE.MANAGER Specifies the name of the queue manager on the local # system where MQWRITE will connect # -g yes Specifies that the messages written to the queue are to be grouped # -m text Specifies that the file data is to be interpreted as text with native # new line controls # file=^ce[.]([0-9]+)[.]([0-9]+)[.]([^.]+)[.](.*) id=none delete=y \ synccmd=mqwrite.sh -f %P -t %T -b &1 -l %L \ -q ENTERPRISE.LOCAL.QUEUE -r ENTERPRISE.QUEUE.MANAGER -g yes -m text
29
# # Filenames of the format created by the Batch Receive Informer are matched # The file is passed to MQSeries mqwrite.sh to be processed # The file is deleted after processing by mqwrite.sh # # -f %P The %P token is replaced with the fully qualified file name of the staged # file # -t %T The %T token is replaced with the transaction number corresponding to the # staged file # -b %1 The %1 token is replaced with the first field in the regular expression # parsed in the -f statement. In this example it is (two[.]three) # -l %L The %L token is replaced with the directory path of the MQWRITE log file # -q ENTERPRISE.LOCAL.QUEUE Specifies the queue name where the staged file will be # written # -r ENTERPRISE.QUEUE.MANAGER Specifies the name of the queue manager on the local # system where MQWRITE will connect # -s 8000 Specifies 8000 bytes as the maximum message size # -g yes Specifies that the messages written to the queue are to be grouped # -m stream Specifies that the file data is to be interpreted as a continuous stream # file=^ce[.]([0-9]+)[.]([0-9]+)[.]([^.]+)[.](.*) id=none delete=y \ synccmd=mqwrite.sh -f %P -t %T -b &1 -l %L -q ENTERPRISE.LOCAL.QUEUE \ -r ENTERPRISE.QUEUE.MANAGER -s 8000 -g yes -m stream
30
MQWRITE
Variable-length records The records within a file are not the same length and are not delimited. You can read the variable-length record file into messages using the stream mode to create fixed-length messages of a size specified by the s parameter. Variable-length records do not translate smoothly into messages. It can be difficult to reconstruct the original records from the message data because individual records are split between messages. Delimited records The records within a file end in a new line character. MQWRITE can be configured to read a line of data and write that line as a separate message to the message queue. The new line character is stripped from the record and is not written to the message. If a line exceeds the maximum message size defined for the queue, then the record data is separated into additional messages as needed and a warning is written to mq.log. To write messages from a file containing delimited records, set m text as in the following example:
file=^ce[.]([0-9]+)[.]([0-9]+)[.]([^.]+)[.](.*) id=mailbox01 delete=y \ synccmd=mqwrite.sh -f %P -t %T -b &1 -l %L -q ENTERPRISE.LOCAL.QUEUE \ -r ENTERPRISE.QUEUE.MANAGER -g yes -m text
Note: The s parameter is optional for writing messages from delimited records.
MQWRITE Logging
MQWRITE log information is written to $CMUHOME/log/agent/mq.log. This file contains the results of writing messages to message queues. Common reporting uses a unique transaction number to match entries in cfa.log with entries in mq.log.
31
32
Chapter 4
Connect:Enterprise uses scripts to link Connect:Enterprise, Connect:Direct, and File Agent components. Connect:Enterprise common reporting allows you to track data movement within all three components based on a file name, transaction number, or time stamp. This chapter contains a description of how the scripts work together and instructions on configuring, installing, and performing common reporting.
Connect:Enterprise to Connect:Direct
When a file targeted for Connect:Direct is added to Connect:Enterprise, the Batch Receive Informer creates a zero length notification file named ce.batch_number.batch_file_size.mailbox_id.batch_id, in a staging directory monitored by Connect:Enterprise File Agent. When Connect:Enterprise File Agent detects the notification file in the staging directory, it calls a script, direct.sh, that sends the file to Connect:Direct. At each step in this process, the system writes to log records that can be viewed with the cereport command.
33
The following illustration shows file navigation from Connect:Enterprise base to Connect:Direct.
Log records
Log File
File Agent
File
Remote Node
Connect:Enterprise base
Staging directory
Connect:Direct
Log records
Log records
Log File
Log File
Connect:Direct to Connect:Enterprise
When Connect:Direct receives a file from the remote node, it copies the file into the staging directory monitored by the File Agent. The File Agent adds the file to Connect:Enterprise. Records created for each step of the process can be viewed using the cereport command. A file moving from Connect:Direct to Connect:Enterprise base is handled differently. When Connect:Direct successfully copies a file, it sends a copy completion log message to the statistics file. This alerts File Agent, which then notifies Connect:Enterprise to extract the file from Connect:Direct. Log records are created at each step in this process. View the logging information with the cereport command.
34
Log File
Log records
File Agent
Log File
Adds file Log records Notices file
Log File
Log records
Remote Node
Connect:Direct
35
# Installed Wed Oct 13 11:00:26 CDT 2004 # # Directory to watch dir = /home/users/enterprise/ceunix/fileagent/stage cmu = "ceusun:17500:freds:freds" cycles = 2 interval = 15 procs = 2 # # file recognition patterns go below # # Send a file from Connect:Enterprise to Connect:Direct # file="^ce[.]([0-9]+)[.]([0-9]+)[.]([^.]+)[.](.*)" case=n id=none \ command="/$CMUHOME/etc/direct.sh %P &1 %L %T" # Add a file to the repository without cereport visibility # file="^add_to_mailbox.*" id=mailboxID code=b # Add a file from Connect:Direct to the repository with cereport visibility # file="(.*)[.]CCOD[.](.*)[.](.*)[.](.*)[.](.*)[.](.*)" id=ceuser code=b # ignore files ending in .tmp \(example\) ignore="[.]tmp$"
This file contains three file recognition patterns with associated commands. They are:
Pattern ^ce[.]([0-9]+)[.]([0-9]+)[.]([^.]+)[.](.*) Command /$CMUHOME/etc/dire ct.sh %P &1 %L %T Description When one or more files match the pattern, File Agent executes the /$CMUHOME/etc/direct.sh %P &1 %L %T command, sending matching files from the repository to Connect:Direct. When one or more files match the pattern, File Agent adds the matching files to the mailbox specified by id= . If you use this pattern, the transfer does not appear when the cereport command is issued. When one or more files match the pattern, File Agent adds the matching files to the mailbox specified by id= . If you use this pattern, the transfer does appear when the cereport command is issued.
^add_to_mailbox.*
id=mailboxID code=b
(.*)[.]CCOD[.](.*)[.](.*)[.](.*)[.](.*)[.](.*)
id=mailboxID code=b
Perform one or more of the following: To send a file from Connect:Enterprise using Connect:Direct, uncomment the first file recognition pattern and specify the location of you $CMUHOME directory. To add a file to the repository that is not visible to cereport, uncomment the second file recognition pattern and specify the mailbox ID to place the file (id=). To add a file to the repository from Connect:Direct that is visible to cereport, uncomment the third file recognition pattern and specify the mailbox ID to place the file (id=).
36
3. Change the snode line to point to the target snode. In the following example, cd_node is the target snode.
snode="cd_node"
4. Change snodeid to a Connect:Direct remote user ID. In the following example, cd_user is the snodeid.
snodeid="cd_user"
5. Change snodepass to a Connect:Direct remote user password. In the following example, direct_password is the snode password.
snodepass="cd_password"
Note: If no password is required for the snodeid specified in step 4, include only the quotation marks. For example, snodepass="".
6. Change snodedir to a directory on a remote server where files are placed after copy. In the following example, /home/cdunix/incoming/ is the snode directory:
snodedir="/home/cdunix/incoming/"
7. Change directbase to point to a local copy of Connect:Direct. In the following example, /home/cdunix/ndm is the directory location of a local copy of Connect:Direct.
directbase="/home/cdunix/ndm"
37
The following example illustrates the changes made in the preceding steps:
Note: This sample script is written to send a file from a UNIX operating system to a UNIX operating system. When sending to or from operating systems other than UNIX, you may need to change the to and from portion of the copy statement to compatible syntax.
#!/bin/ksh #================================================================ # # Connect:Enterprise UNIX (tm) # COPYRIGHT (C) 1999 # Sterling Commerce, Inc. # All Rights Reserved # # This material is the confidential trade secret and proprietary # information of Sterling Commerce, Inc. and/or its subsidiaries. # It may not be reproduced, used, sold, or transferred to any # third party without the prior written consent of Sterling # Software, Inc. All rights reserved. # # Use, duplication, or disclosure by the Government is subject # to restrictions as set forth in subparagraph (c)(1)(ii) of # the Rights in Technical Data and Computer Software clause at # FAR 52.227-7013. # #================================================================ # # # # This script depends on the environment variable "CMUHOME" being set, and the presence of $CMUHOME/os/bin (where os is sun, aix, or hpux). These variables are set automatically by running $CMUHOME/etc/cshrc, profile, or kshrc.
#================================================================ # CHANGE THE FOLLOWING LINES: # ## uncomment the following two lines for debugging #exec > /tmp/shellout.$$ 2>&1 #set -x # Connect:Direct SNODE snode="cd_node"
38
# Remote User ID on SNODE, if needed snodeid="" # Password for ID on SNODE, if needed snodepass="" # destination directory on SNODE snodedir="/home/cdunix/incoming/" # process name--It is ok not to change this process_name="cefa" # $directbase is where direct lives directbase="/home/cdunix/ndm" # $NDMAPICFG is where the Connect:Direct api configuration lives. # probably should not change this. export NDMAPICFG=$directbase/cfg/cliapi/ndmapi.cfg You
# $direct is the full path to the direct executable. You probably should not # change this. direct=$directbase/bin/direct # # END OF CHANGE SECTION #================================================================ #================================================================ # Usage: # # sample_direct.sh inputfile batch_number log_directory trans_number # # This script takes the name of an input file and dynamically # generates a Connect:Direct Process to copy the file to a # remote. The batch_number is the batch_number generated for the file by # the Connect:Enterprise daemon. The log_directory is the log directory # of the Connect:Enterprise File Agent. The trans_number is the transaction # number assigned to the file by the Connect:Enterprise File Agent. These # four arguments are configured in the fileagent.cfg file. Without # the batch_number/trans_number being written to the log_directory, the # common reporting feature (cereport) will fail to operate properly. # # If the copy operation is successful, then the input # file is destroyed. #================================================================ # To submit the file to Connect:Direct, use the following function. # Do NOT change this function to do multiple submissions. Instead, # call it multiple times in the body of this script. # Takes 7 arguments: # input_path, process_name, snode, snode_dir, snode_filename # snode_id, snode_pass submit_to_direct()
39
SNODEID= if [ ! -z "$6" ]; then if [ ! -z "$7" ]; then SNODEID="snodeid=($6,$7)" else SNODEID="snodeid=($6)" fi fi sd_status=1 output=/tmp/.direct_out.$$ $($direct -x << ZEOF > $output 2>&1 submit $2 process snode=$3 $SNODEID copy from (file=$1 pnode) to (file=$4/DIRECT.$5 snode) pend; ZEOF) for pnum in `cat $output|grep -i ", Process Number ="|awk '{print $NF}'`; do slock -b -l $FALOGDIR/direct.log echo $FATRNUM $pnum >> $FALOGDIR/direct.log slock -u $FALOGDIR/direct.log sd_status=0 done rm -f $output return $sd_status PATH=${PATH}:${CMUHOME}/bin dir=`dirname "$1" ` filename=`basename "$1" ` inputpath=$dir/DIRECT.$filename CEBNUM="$2" FALOGDIR="$3" FATRNUM="$4" # Extract the batch into file DIRECT.$filename cmuextract -b#${CEBNUM} -f $inputpath exitcode=1 # Submit the file to Connect:Direct submit_to_direct $inputpath $process_name $snode $snodedir $filename $snodeid $snodepass if [ "$?" = "0" ]; then exitcode=0 rm -f $1 fi exit $exitcode
40
Running CeReportCust
Running CeReportCust
Before you run CeReportCust or cereport for the first time, complete all the configuration procedures in Configuring Connect:Enterprise File Agent on page 35. The CeReportCust command invokes a script that creates the cereport script. 1. Run CeReportCust.
$CMUHOME/etc/CeReportCust
41
4. Accept the path name of the log directory and the script exits to the shell prompt.
Running cereport
When you run cereport, the requested information is displayed on the screen. For a detailed explanation of the output, refer to the Viewing cereport Output on page 44. Type the following command to run cereport:
cereport [-h] [-?] [f file name] [B begin_time] [E end_time] [-l] [-s]
42
Running cereport
Option t transaction_number
Description Retrieves records for a particular File Agent transaction number. Records are listed in processing order. For example, if a file comes into Connect:Direct, is transferred through the File Agent, and is submitted to the Connect:Enterprise base, the records are displayed in the order Connect:Direct, Connect:Enterprise File Agent, Connect:Enterprise base. In the following example, the command retrieves records for File Agent transaction number 46: cereport t 46 Note: Acquire the transaction number by first performing a cereport f file name command.
B begin_time
Retrieves a list of transaction records logged on or after begin_time. The format of the argument is [CC]YYMMDD[:HHMM[SS]] in 24-hour format. The default value for begin_time is 0, which retrieves all records in log. In the following example, the command retrieves all records logged at or after 5:00 am on October 1, 1999: cereport B 19991001:050000
E end_time
Retrieves a list of transaction records logged on or before end_time. The format of the parameter is [CC]YYMMDD[:HHMM[SS]] in 24-hour format. This parameter defaults to now which returns all records in the log. In the following example, the command retrieves all records logged at or before 12:00 pm on October 1, 1999: cereport E 19991001:120000 Running cereport with both B and E retrieves transaction records logged between begin_time and end_time. In the following example, the command retrieves all records logged between 5:00 am and 12:00 pm: cereport E 19991001:120000 B 19991001:050000
Retrieves transaction record and suppresses the first line column headers. This is the default display format. If the search results in no records being found, the no records found message is suppressed. In the following examples, the commands retrieve all transaction records for the file tx.wfg and display them in short format. cereport f tx.wfg cereport f tx.wfg s
Retrieves transaction records in long format. This option overrides the default of short format. In the following example, the command retrieves all transaction records for the file tx.wfg and displays them in long format: cereport f tx.wfg l
43
Short Format
The short format is the default for Connect:Enterprise. The sample entry and output are followed by a description of the output elements.
/home/server6/user1/enterprise/ceunix/etc > cereport tran_num action_time ep file_size 1 19991013:131544 U 52
file_name add_to_mailbox.001
Field tran_num
Example 1
Description Transaction number is assigned by the File Agent and is unique for each transferred file (up to 4294967295 files). Time stamp of the transaction. Entry point identifies the source of the transaction. D=Connect:Direct, E=Connect:Enterprise, M=MQSeries, U=Source other than Connect:Direct or Connect:Enterprise. File size in bytes. Name of the file. Path is not included.
action_time ep
19991013:131544 U
file_size file_name
5200 add_to_mailbox.001
Long Format
You can display the long format using the l option. The sample entry and output are followed by a description of the output elements.
/home/server6/user1/enterprise/ceunix/etc > cereport -l tran_num action_time ep file_size file_name batch_num proc_num file_mtime 1 19991013:131544 U 52 add_to_mailbox.001 8 0 19991013:131545
44
Field tran_num
Example 1
Description Transaction number is assigned by the File Agent and is unique for each transferred file (up to 4294967295 files). Time stamp of the transaction. Entry point identifies the source of the transaction. D=Connect:Direct, E=Connect:Enterprise, M=MQSeries, U=Source other than Connect:Direct or Connect:Enterprise. File size in bytes. File name. Path is not included. Batch number is assigned by Connect:Enterprise. This number is not always unique. Process number is assigned by Connect:Direct. This number is not unique. Last modification time of the file.
action_time ep
19991013:131544 U
5200 add_to_mailbox.001 8
proc_num file_mtime
0 19991013:131545
Transaction Format
You can display the transaction format using the t option. Three sample entries and output are provided:
/home/server6/user1/enterprise/ceunix/etc > cereport -t 16 20000424:105412 MQAGENTBatch Add succeeded. File Name = TESTWRITE1.QUEUE ID Used = mqm BID Used = user1 Batch Number Obtained = 1293 Transaction Number = 16 ENTERPRISE No records show the batch has been accessed after creating.
45
/home/server6/user1/enterprise/ceunix/etc > cereport -t 5 20000407:140133 FILEAGENTRun Sync Command Succeeded. File Name = /sci/users/mqm/fileagent/stage/ce.1250.17 97.user.add_to_mailbox.testfile16 File Last Modification Time = 20000407:140048 File Processing Time = 20000407:140133 File Size = 1797 Command Executed = exec /sci/users/mqm/etc/mqwrite.sh -d /sci/users/mqm/fileagent/control/mqwrite.trc -v -f /sci/users/mqm/fileagent/stage/ce.1250.1797.user.a dd_to_mailbox.testfile16 -t 5 -b 1250.1797.user.add_ to_mailbox.testfile16 -l /sci/users/mqm/fileagent/control -q TESTWRITE1.QUEUE -r sterling.queue.manager -g yes -m text Command Return Code = 0 Transaction Number = 5 20000407:140133 MQ AGENT Successful FileName = /sci/users/mqm/fileagent/stage/MQW.ce.125 0.1797.user.add_to_mailbox.testfile16 MQSeries Name = TESTWRITE.QUEUE Message Size = 10000 Processing Time = 20000407:140133 Last Modification Time = 20000407:140134 Mode = TEXT Group Messages = Y Group ID = 414D5120737465726C696E672E71756538E3B20C0006C02 Bytes Written = 1747 Messages Created = 49 Completion Text = MQWRITE Transaction successful Transaction Number = 5
/home/server6/user1/enterprise/ceunix/etc > cereport -t 15 20000407:145230 DIRECT No information was found. File Name = /sci/users/mqm/fileagent/stage/add_to_mai lbox.ccod.testfile19 File Size = 1796 File Last Modification Time = 20000407:145230 File Processing Time = 20000407:145312 ID Used = user BID Used = add_to_mailbox.testfile19 Batch Number Obtained = 1259 Transaction Number = 15 ENTERPRISE No records show the batch has been accessed after creating.
46
Appendix A
Regular Expressions
This appendix contains a description of how Connect:Enterprise File Agent uses regular expression substrings.
matches the following criteria: 1. File name must start with the explicit string mbox. 2. The string mbox must be followed by a single-digit character. 3. The single-digit character must be followed by a single period. An implicit expression in parentheses matches the file name and is noted as &0. This value is used to replace any occurrence of &0 in a subsequent id, bid, command, or synccmd field. The first parenthetical expression (mbox[::digit::]) replaces a subsequent &1 value in an id, bid, command, or synccmd field. The second parenthetical expression matches any text after the first period character, and is used to replace a subsequent &2 value in a id, bid, command, or synccmd field. Caution: Use the back slash character to ignore the regular expression meaning of the character
immediately following the back slash.
47
The 2>&1 is replaced by 2>mbox6 because the substring &1 is special, resulting in a command of:
rm f mbox6.output.dataset 2>mbox6
The back slash quotes the &1 substring and prevents the replacement. With the back slash in place, the replacement is normal:
rm f mbox6.output.dataset 2>&1
48
Index
Symbols
.stop 6 cmu= 8, 24 cmustartup 20 code= 9
A
addcard= 9 API 6, 8, 16
B
batch ID 21 Batch Receive Informer 19, 28 configuration file 21 sample 22 batch_file_size 19 batch_number 19 batchid= 9 bid 47 bid field 10, 47 bid= 9 blank lines 7, 24
command parameters 14 command= 9 comment lines 7, 24 common reporting 28, 31 Connect:Direct Submission script 37 Connect:Enterprise 14, 16 File Agent 33 file navigation Connect:Direct to Connect:Enterprise 34 Connect:Enterprise to Connect:Direct 33 cycles= 8
D C
-D 8 data file size 7 data flows 6 debug= 8 delete= 9 dir= 8
-C 13, 14 -c 13 canonical_batch_id 19 case= 9, 10 cclist= 9 CE_BATCHRECEIVE 20 cefastartup.sh 14 Cereport function format 42 invoking 42 ceufileagt 13, 14
F
fashutdown 16 File Agent configuration file 5, 6, 7, 14, 35 File Agent Log Files Managing 18
49
Index
O G P
process line fields 9 process lines 7, 8, 24 procs= 8 protocol 21
global lines 24
I
id field 10, 47 id= 9 ignore = 10 ignore field 10 ignore= 6, 8, 9, 10 installation 6 interval= 8
Q
queue manager 29 queues 23, 25, 29, 31
R
Record logging 42
L
logging 6, 42
S M
staging directory 19, 21 stderr 13 stopping the File Agent 16 synccmd 10, 47 synccmd= 9 system requirements 23
-M hostname ip-port 16 password 16 remote-id 16 mailbox ID 21 mailbox= 9 mailbox_id 19 Managing File Agent Log Files 18 Message Agent 23, 24, 26, 27, 28 logging 28 starting 27 stopping 27 message queue 23, 28, 31 modification time 6 MQREAD 23, 24, 25, 28 MQSeries 23, 25, 28, 29 MQWRITE 23, 28, 29, 31 configuring 28 multxmit= 9
T
trigger= 9
W
-W 16 -W seconds 16 wait cycle 16
50