Using NS3000/iX Network Services (36920-90008)

102 Chapter 5
Network File Transfer
Programmatic NFT Examples
Programmatic NFT Examples
The following programs, in COBOL and Pascal, illustrate single and
multiple file transfers via the DSCOPY intrinsic. They also call the
DSCOPYMSG intrinsic to print an error message if necessary.
The multiple-file-transfer examples use transfer specifications that are
read from a file with the formal designator DSCOPYI.
In the COBOL version of the multiple-file transfer, we assume that this
file is the default $STDIN, namely the user’s terminal. A second and
alternative way of doing the COBOL multiple-file transfer would be to
create an actual unnumbered file (“copyfile”) that contains DSCOPY
commands (for instance, SFILEA TO TFILEA). You would then have to
create a file equation that equates DSCOPYI with the copyfile you have
created.
COBOL: Single Transfer
In this application, the opt parameter is set to zero (0). All transfers will
be attempted. Primary output is disabled. The command file spec for
multiple transfers cannot be used. The spec parameter contains the full
text of the transfer specification, including all parameters and options,
and is terminated by an ASCII null character.
001000$CONTROL USLINIT
001100 IDENTIFICATION DIVISION.
001200 PROGRAM-ID. SINGLETRANSFER.
001300 REMARKS. THIS PROGRAM TRANSFERS A FILE TO A REMOTE NODE;
001400 IT CALLS THE DSCOPY AND DSCOPYMSG INTRINSICS.
001500 ENVIRONMENT DIVISION.
001600 CONFIGURATION SECTION.
001700 SOURCE-COMPUTER. HP3000
001800 OBJECT-COMPUTER. HP3000
001900 DATA DIVISION.
002000 WORKING-STORAGE SECTION.
002100 01 OPT PIC S9(4) COMP VALUE 0.
002200 01 SPEC.
002300 02 ASCIIPART PIC X(40) VALUE
002400 "NFTTEST TO NFTTARG:SOMENODE[NSUSER.NSACCT]".
002500 02 TERMINATOR PIC S9(4) COMP VALUE 0.
002600 01 RESULT.
002700 02 RESULTS PIC S9(4) COMP OCCURS 2 TIMES.
002800 01 FNUM PIC S9(4) COMP VALUE 0.
002900 01 R PIC S9(4) COMP VALUE 0.