Job execution

(1) Pre-send Job

You can set the job to start at the point when the Send File or the Send Request is acknowledged.

HULFT starts the Send processing when the started job ends successfully (exit code = 0). When the job ends unsuccessfully, the Send processing is not started. This mechanism can be used, for example, to start a user job to create the target data as soon as the Send File or the Send Request is acknowledged, and to proceed to carry out the Send processing of the data as soon as the data is created.

To use the Pre-send Job function, specify a valid job ID (registered in the Job Information) for Pre-send Job ID (PREJOBID) in the Send Management Information.

(2) Post-send Job or Post-receive Job

You can set the job to start at the point when the Send processing or the Receive processing ends. You can also set different jobs to start depending on whether the Send/Receive processing terminates successfully or unsuccessfully.

To start the job when the Send or Receive processing ends successfully, specify a valid job ID (registered in the Job Information) for Successful Job ID (JOBID) in the Send or Receive Management Information, respectively.

To start the job when the Send processing or the Receive processing ends unsuccessfully, specify a valid job ID (registered in the Job Information) for Unsuccessful Job ID (EJOBID) in the Send or Receive Management Information.

The execution result of the Post-send or Post-receive Job is written to the Post-send Job Execution Log file or the Post-receive Job Execution Log file, respectively.

(3) Replacement of environment variables

If environment variables are used in the startup job, HULFT adds the information of the transfer when the Pre-send Job, the Post-send Job, or the Post-receive Job is started. The list of environment variables that can be used is as follows.

Table 2.1 List of Environment Variables

Variable Name

Replacement Rule

Pre-send

Post-send

Post-receive

$HOST

Replaced with the Send/Receive Host Name

$FILEID

Replaced with the File ID

$DATE (*1)

Replaced with Send/Receive Start Date (Format: YYMMDD)

$TIME (*1)

Replaced with Send/Receive End Time (Format: HHMMSS)

$COUNT

Replaced with the number of records in the file that was sent or received

$FILENM

Replaced with the Send/Receive File Name

$STATUS

Send Status Code or Receive Status Code

Refer to Error Codes and Messages for details about Status codes.

$DETAIL

Send Detail Code or Receive Detail Code

Refer to Error Codes and Messages for details about detail codes.

$SDATE

Replaced with Send/Receive Start Date (Format: YYMMDD) (*2)

$EDATE

Replaced with Send/Receive End Date (Format: YYMMDD) (*2)

$STIME

Replaced with Send/Receive Start Time (Format: HHMMSS)

$ETIME

Replaced with Send/Receive End Time (Format: HHMMSS)

$SDATE2

Replaced with Send/Receive Start Date (Format: YYYYMMDD) (*3)

$EDATE2

Replaced with Send/Receive End Date (Format: YYYYMMDD) (*3)

$MSG0

Replaced with Message 0

$MSG1

Replaced with Message 1

$MSG2

Replaced with Message 2

$MSG3

Replaced with Message 3

$MSG4

Replaced with Message 4

$MSG5

Replaced with Message 5

$MSGL0

Replaced with Long Message 0

$MSGL1

Replaced with Long Message 1

:

Available

Blank

:

Not available

*1

:

These environment variables have been retained for compatibility with lower versions. It is recommended to use '$SDATE' and '$ETIME.'

*2

:

The format YYMMDD is applied for the order of the year, month, and day in the Post-send Job and the Post-receive Job.

*3

:

The order of the year, month, and day in the Post-send Job and the Post-receive Job reflects the order of the date format specified for Date Format (datefmt) in the System Environment Settings.

Note
  • When Notification (JOBWAIT) in the Receive Management Information is set to 'Successful Job Completion,' HULFT replaces '$EDATE,' '$EDATE2,' '$ETIME,' and '$TIME' with the date that the transfer is completed, not with the date that the job is completed.

  • If any unavailable environment variable is used in a Pre-send Job, an unfixed value is set.

  • In the following cases, use alphanumeric characters for the character string (such as a file name or a file path) with which HULFT replaces one of the environment variables '$FILENM', from '$MSG0' to '$MSG5,' or from '$MSGL0' to '$MSGL1.'

    • When the system locale differs between the host on the sending side and the host on the receiving side

    • When HULFT communicates with a version lower than HULFT Ver.8.1

    • When Use HULFT7 Comm. Mode (HUL7MODE) is set to 'Yes'

By specifying the above environment variables in the startup shell script when you specify a startup job in the Job Information, HULFT automatically replaces the environment variables with values and starts the application.

[Replacement example]

Table 2.2 Example of Replacement

Field

Value

Send Host

HOST0001

File ID

FILEID01

Send start date

20141221

Send start time

155400

Send end date

20141221

Send end time

160232

Send record count

12000

Send file name

/hulft/rcv/fileid01.dat

Send status code

0

Send detailed code

0

[Example of script]

#! /usr/bin/sh 
echo $HOST $FILEID $SDATE2 $ETIME > user.log 
echo count=$COUNT status=$STATUS detail=$DETAIL >> user.log 
if [ $STATUS -eq 0 ] 
then 
     echo $FILENM >>user.log 
     cp $FILENM $FILENM.bak 
fi

[Execution result]

HOST0001 FILEID01 20141221 155400 
count=12000 status=0 detail=0 
/hulft/rcv/fileid01.dat

(4) Points to be noted for job execution

If the job cannot be executed, check the following points.

Permissions

The job may not start because of the types of permissions. Refer to Operation by users other than the superuser (root) for details about job execution permissions.

Setting of Job Information

Make sure that the setting of the startup job is correct.

Existence of Job Information

Check whether the command described in the startup job exists or not.

Command

Execute the command registered in the Job Information in the command line and check whether the command works or not.

Setting of Environment Variables

Check whether the environment variables used in the job are defined or not. If they are not defined, their behavior will depend on the environment.

Jobs that use standard output or standard error output

If a command that uses standard output or standard error (echo command) is contained in the job, the job may end unsuccessfully depending on the environment.

Location of shell scripts or commands

HULFT does not support using a shell script or a command on network as a startup job to run. Make sure that the shell script or command set as the startup job is located on the local computer.

Note

Because the environment variables '$STARTTRANSFERID' and '$NEWTRANSFERID' are reserved words in HULFT, you cannot include the words in a job. If you include these words, the job will not work.