FTAM/9000 Programmer's Guide
Chapter 10 355
Example Programs
Using HLCF Functions Example
Using HLCF Functions Example
This example program synchronously calls the high level context free
functions ft_fcopy(), ft_fcattributes(), ft_fdelete(). Additionally, the
program uses ft_dfdcb() to free dynamic memory. Refer to the following
three sections for associated routines: “Setting Ae_dir_name and P
address Utility Example,” “Checking for Errors Example,” and “Common
Code Example.”
#include %</opt/ftam/include/map.h>
#include %</opt/ftam/include/mapftam.h>
#include “ftm_globs.h”
#include %<stdio.h>
main()
/*
** ftm_hlcopy
**
** DESCRIPTION:
** This example program uses high level, context free functions
** synchronously. This program copies a file, changes the
** attributes of the destination file and deletes the source file.
*/
{
Ae_label ae_label;
Ae_dir_name source_dirname;
Ft_filename source_filename;
Ae_dir_name destination_dirname;
Ft_filename destination_filename;
Local_event_name return_event_name;
struct Ft_fcopy_in_dcb *fco_input_dcb;
struct Ft_fcopy_out_dcb *fco_inout_dcb;
struct Ft_fcattributes_in_dcb *fca_input_dcb;
struct Ft_fcattributes_out_dcb *fca_inout_dcb;
struct Ft_fdelete_in_dcb *fde_input_dcb;
struct Ft_fdelete_out_dcb *fde_inout_dcb;
Return_code res;
Api_rc outcome;
struct Ft_diagnostic *diag = NULL;
(void)printf(“ftm_fcopy: starting\n”);
/*
** Copy the source file to the destination directory.
**
** Get the parameters for ft_fcopy.
** Call ft_fcopy and verify the outcome.
*/
(void)printf(“Copying the source file to the destination directory...\n”);
fco_parm_in( & source_dirname, & source_filename,
& destination_dirname, & destination_filename,
& ae_label, & return_event_name, & fco_input_dcb,
& fco_inout_dcb );
res = ft_fcopy(source_dirname, source_filename, destination_dirname,
destination_filename, & ae_label,
return_event_name, fco_input_dcb, & fco_inout_dcb);
if (res != SUCCESS)
error_handler(fco_inout_dcb->result, fco_inout_dcb->diagnostic);