cfxfer Function

Purpose

Checks the status of the programmatic File Transfer.

Library

File Transfer Library (libfxfer.a)

C Syntax

#include <fxfer.h>

cfxfer ( sxfer)

struct fxs *sxfer;

Pascal Syntax

%include fxfer.inc
%include fxhfile.inc

function pcfxfer (var  Sxfer : fxs) : integer; external;

FORTRAN Syntax

INTEGER FCFXFER
EXTERNAL FCFXFER

CHARACTER*XX  SRC,  DST,  TIME

INTEGER  BYTCNT,  STAT

INTEGER  ERRNO

RC = FCFXFER (SRC, DST, BYTCNT, 
+ STAT, ERRNO, TIME, RC)

Description

The cfxfer function returns the status of the file transfer request made by the fxfer function. This function must be called once for each file transfer request. The cfxfer function places the status in the structure specified by the sxfer parameter for C and Pascal. For FORTRAN, status is placed in each corresponding parameter.

Each individual file transfer and file transfer status completes the requests in the order the requests are made. If multiple asynchronous requests are made:

If the file transfer is run asynchronously and the cfxfer function is immediately called, the function returns a status not available -2 code. An application performing a file transfer should not call the cfxfer function until an error -1 or ready status 0 is returned. The application program can implement the status check in a FOR LOOP or a WHILE LOOP and wait for a -1 or 0 to occur.

The cfxfer function is part of the Host Connection Program (HCON).

C Parameters

Item Description
sxfer Specifies an fxs structure as defined in the fxfer.h file. The fxs C structure is:
struct fxs  {
    int     fxs_bytcnt;
    char   *fxs_src;
    char   *fxs_dst;
    char   *fxs_ctime;
    int     fxs_stat;
    int     fxs_errno;
}

Pascal Parameters

Item Description
Sfxfer Specifies a record of type fxs as defined within the fxfer.inc file. The Pascal fxs record format is:
fxs = record
       fxs_bytcnt : integer;
       fxs_src : stringptr;
       fxs_dst : stringptr;
       fxs_ctime : stringptr;
       fxs_stat : integer;
       fxs_errno : integer;
end;

C and Pascal fxs Field Descriptions

Item Description
fxc_bytcnt Indicates the number of bytes transferred.
fxc_src Points to a static buffer containing the source file name. The static buffer is overwritten by each call.
fxc_dst Points to a static buffer containing the destination file name. The static buffer is overwritten by each call.
fxs_ctime Specifies the time the destination file is created relative to Greenwich Mean Time (GMT) midnight on January 1, 1970.
fxs_stat Specifies the status of the file transfer request.
fxs_errno Specifies the error number that results from an error in a system call.

FORTRAN Parameters

Item Description
SRC Specifies a character array of XX length containing the source file name.
DST Specifies a character array of XX length containing the destination file name.
BYTCNT Indicates the number of bytes transferred.
STAT Specifies the status of the file transfer request.
ERRNO Specifies the error number that results from an error in a system call.
TIME Specifies the time the destination file is created.

Return Values

The cfxfer function returns the following:

Value Description
0 Ready status-success. The structure member fxs.fxs_stat contains status of fxfer function.
-1 Error status. Failure of cfxfer function. The fxs structure has NOT been set.
1 Status is not yet available.

The fx_statxxxxxx status file contains the status of each file transfer request made by the application program. The fxfer function fills in the xxxxxx portion of the fx_stat file based on random letter generation and places the file in the $HOME directory.

Files

Item Description
$HOME/fx_statxxxxxx Temporary file used for status