[ Previous | Next | Contents | Search ]
3270 Host Connection Program 2.1 and 1.3.3 for AIX: Guide and Reference

Pascal File Transfer Program Example

The following programming example displays how to use the pfxfer function to upload the binary file, bin_file, to a TSO host.

{***************************************************************}
{                                                               }
{ This Pascal program uses the File transfer pfxfer function to }
{ upload the binary file bin_file to a TSO host.  The program   }
{ will prompt the user for a session profile to do the file     }
{ transfer and will use the AUTOLOG script SYStso2 to logon to  }
{ the host id johndoe with trace and time=10 being set.         }
{***************************************************************}
program pname;
const
%include /usr/include/fxconst.inc
type
%include /usr/include/fxfer.inc
%include /usr/include/fxhfile.inc
var
        strc2   : fxs;
        strc1   : fxc;
        source, destin: stringptr;
        profid  : stringptr;
        login   : stringptr;
        inputfld  : stringptr;
        aixcodepg  : stringptr;
        rtval1  : integer;
        rtval2  : integer;
begin
        new(source, 256);
        new(destin, 256);
        new(profid, 256);
        new(login, 102);
        new(inputfld, 64);
        source@ := '/bin_file';
        destin@ := 'binfile';
{   Prompt the user for the session profile to use                        }
        writeln('Enter a profile id: ');
        readln(profid@);
{   Set login Host user id to johndoe, Autolog profile to SYStso2         }
{   turn trace on, and set time to 10 seconds.                            }
        login@ := 'johndoe,tso2,trace,time=10';
        inputfld := char(0);
        aixcodepg := char(0);
        strc1.fxc_opts.f_logonid := login;
{   Set the options to upload to a TSO host                               }
        strcl.fxc_opts.f_inputfld := inputfld;
        strcl.fxc_opts.f_aix_codepg := aixcodepg;
        strc1.fxc_opts.f_flags := FXC_UP + FXC_TSO;
        strc1.fxc_src := source;
        strc1.fxc_dst := destin;
        strc1.fxc_opts.f_lrecl := 0;
        rtval1 := pfxfer(strc1,profid);
        writeln('pfxfer return   = ',rtval1);
        rtval2 := pcfxfer(strc2);
        writeln('pcfxfer return  = ',rtval2);
        writeln('------------------------------------------------');
        writeln('Source file      = ',strc2.fxs_src@);
        writeln('Destination file = ',strc2.fxs_dst@);
        writeln('Byte count       = ',strc2.fxs_bytcnt);
        writeln('Time             = ',strc2.fxs_ctime@);
        writeln('Stats            = ',strc2.fxs_stat);
        writeln('Errno            = ',strc2.fxs_errno);
        writeln('------------------------------------------------');
        writeln;
end.


[ Previous | Next | Contents | Search ]