bs2cp copies files from the POSIX file system to BS2000 and vice versa. The command has four formats:
The command creates physical copies. Hence, after copying the files are physically present in both the POSIX and BS2000 file systems.
Syntax
Format 1: Copying a single POSIX file to BS2000 and vice versa
bs2cp[ -k| -t table][ -f][ -l][ -h] bs2:file filecopy |
The file content is converted during copying:
This option is ignored and no conversion is performed if the original file or the file copy is a PLAM library element of the L (LLM) type. Unlike control with the IO_CONVERSION environment variable, -k will convert independently of the POSIX file system type. Hence, it will also convert when the POSIX file system is an EBCDIC file system (i.e. not an ASCII file system or an NFS-mounted file system). -k is only meaningful with text files. The b2cp command does not perform any contents plausibility check for meaningful conversion.
The file content is converted during copying using the table file as conversion table. The options -k and -t are mutually exclusive. This is similar to the option -k in that the option will be ignored and no conversion will take place if the original file or the file copy is a PLAM library element of the L (LLM) type. Properties of the table file:
If the absolute path name of the table file is not given, the command will look up in $BS2CPTABS. If this variable is not set or is empty, the command will search for the table file in the /usr/lib/bs2cp directory. At first, a 256-byte conversion table is created from the table file during the conversion. This is done by compressing each of the 256 character bytes to a hex decimal character. After that, each of the characters from the file to be copied is replaced by a character from the conversion table which is addressed via the binary value of the input character. The input character M is for example substituted by byte 212 of the conversion table because M has the EBCDIC value X’D4’ and hence the decimal value 212. An example of the structure of the code table can be found under “Example table for option -t”.
By default, stderr is checked during copying from POSIX to BS2000 and the user is prompted if existing BS2000 files/elements should be overwritten or not. This dialog prompt is suppressed with -f and existing files are overwritten. This option is ignored (if indicated) during copying from BS2000 to POSIX. Existing POSIX files are always overwritten. If the environment variable OV exists, the dialog query is omitted regardless of the -f option. If OV = "Y", existing BS2000 files/elements are overwritten, otherwise they are not overwritten and a message is issued instead.
Each successfully copied file is reported as follows:
Output of the command syntax with explanation of options.
The file or filecopy entered with this option is a BS2000 file. DMS files are addressed by their name. Special characters (e.g. $ in the BS2000 user ID) in file names must be masked by a preceding backslash character or by bracketing the character strings bs2: file or bs2: filecopy in single inverted commas. A library element is called in the following form (also see Example 3): 'lib(elem[,[type][,vers]])' where
One of the files (file or filecopy) must be a BS2000 file or library element. POSIX file directories cannot be copied into BS2000. Wildcard syntax and construction entries are not supported. file Name of the file to be copied. filecopy Name of the copy. If filecopy is an existing BS2000 file or a library element, the user is prompted if it should be overwritten. The option -f and the environment variable OV=Y suppress this prompt. The following is valid for a filecopy that is a BS2000 DMS file:
The following is valid if filecopy is an element of a BS2000 PLAM library:
|
Format 2: Copying POSIX files to BS2000 as DMS files
|
Extended format of the bs2cp command.
see Format 1.
This is analogous to format 1. By default, stderr is checked during copying and the user is prompted if existing BS2000 files should be overwritten. However, the prompt offers several reply options: If q is selected, the command bs2cp is aborted with an exit status unequal to null. The dialog query is suppressed with -f. Already existing files are always overwritten. If the environment variable OV exists, the dialog query is omitted regardless of the -f option. If OV = "Y", existing BS2000 files/elements are overwritten, otherwise they are not overwritten and a message is issued instead.
Each successfully copied file is reported as follows:
Output of the command syntax with explanation of options.
The prefix character string precedes the names of the copies.
The suffix character string is appended to the names of the copies.
is a list consisting of one or more POSIX files where shell special characters (wildcards) can be used to generate file names. file must not be a file directory.
The copies are placed in BS2000 as DMS files. The copies always receive the same plain file names as the originals written in upper case. They can, however, be expanded with prefixes and suffixes. Any underscore characters will be converted into dollar signs. If files already exist, the user will be prompted if they are to be overwritten. Moreover, the user can specify that all the following files will be overwritten without any prompt being displayed. It is also possible to cancel processing. By default, the files are copied to the BS2000 user ID of the POSIX user in the home pubset. The prefix entered with -p can be used to indicate another Cat ID or User ID. See Example 4. |
Format 3: Copying POSIX files to a BS2000 PLAM library
|
Extended format of the bs2cp command.
By default, stderr is checked and the user is prompted if existing BS2000 elements should be overwritten or not. This dialog prompt is suppressed with -f and existing files will be overwritten. If the environment variable OV exists, the dialog query is omitted regardless of the -f option. If OV = "Y", existing BS2000 files/elements are overwritten, otherwise they are not overwritten and a message is issued instead.
Each successfully copied file is reported as follows:
Output of the command syntax with explanation of options.
The prefix character string precedes the names of the copies.
The suffix character string is appended to the names of the copies.
is a list consisting of one or more POSIX files where shell special characters (wildcards) can be used to generate file names. file must not be a file directory.
The copies are created as elements of the BS2000 PLAM library lib. For type and vers see Format 1. The element names are created from the original simple file names (in upper case). They can be expanded with prefixes and suffixes. See Example 5. |
Format 4: Copying BS2000 files with wildcard syntax to a POSIX file directory
|
Extended format of the bs2cp command.
Each successfully copied file is reported as follows:
Output of the command syntax with explanation of options.
The prefix character string precedes the names of the copies.
The suffix character string is appended to the names of the copies.
file is a fully or partially qualified DMS file name with wildcard syntax (special character "*" of the BS2000 command SHOW-FILE-ATT or FS). Only one bs2: file operand is permitted. Important: If the name consists of blank spaces only or is missing altogether, this is equivalent to the "*" wildcard character.
elem is the fully qualified name of a PLAM element or the partially qualified name of several PLAM elements with LMS wildcard syntax. The following wildcard special characters are supported: * < : >. Other special characters for LMS wildcards are not guaranteed. Special case: If elem is not specified, all elements of the corresponding type and version will be used (this is equivalent to the wildcard character "*"). Minimal entry: bs2: lib () all elements of type S and of highest version are copied. directory The BS2000 files/elements are copied to the POSIX file directory indicated. The common shell notation is permitted for file directories. For example: |
Hint
EXIT status in the extended formats 2 through 4If several files are to be copied with the same bs2cp call, the exit status will only be 0 if all copies were successfully completed. If an error occurs, the copying continues with the remaining files. If none of the files has been copied, the exit status 1 is returned. If only a subset of the files could be copied, the exit status 2 is returned. Copying library elementsWhen library elements are copied to POSIX files or vice versa, the software product LMS must be installed. DMS file attributes supportedbs2cp only supports file attributes which are supported by the C runtime system with STREAM I/O. Hence, SAM files with fixed record length can only be opened as binary type (ftyp binary). ftyp binary supports the following file attributes: FCB- REC- BLKCTRL BLKSIZE (STD,n) RECSIZE (r Byte) Max. number TYPE FORM of data bytes ----------------------------------------------------------------------- SAM F PAMKEY 1<=n<=16 1<=r<=n*2048 RECSIZE SAM F DATA(2K) 1<=n<=16 1<=r<=n*2048-16 RECSIZE SAM F DATA(4K) 2<=n<=16 1<=r<=n*2048-16 RECSIZE SAM V PAMKEY 1<=n<=16 4<=r<=n*2048-4 RECSIZE - 4 SAM V DATA(2K) 1<=n<=16 4<=r<=n*2048-16 RECSIZE - 4 SAM V DATA(4K) 2<=n<=16 4<=r<=n*2048-16 RECSIZE - 4 SAM U PAMKEY 1<=n<=16 BLKSIZE SAM U DATA(2K) 1<=n<=16 BLKSIZE - 16 SAM U DATA(4K) 2<=n<=16 BLKSIZE - 16 PAM PAMKEY 1<=n<=16 BLKSIZE PAM DATA(2K) 1<=n<=16 BLKSIZE - 12 PAM DATA(4K) 2<=n<=16 BLKSIZE - 12 PAM NO(2K) 1<=n<=16 BLKSIZE PAM NO(4K) 2<=n<=16 BLKSIZE ftyp text supports the following file attributes: FCB- REC- BLKCTRL BLKSIZE (STD,n) RECSIZE (r Byte) Max. number TYPE FORM of data bytes ---------------------------------------------------------------------- SAM V PAMKEY 1<=n<=16 4<=r<=n*2048-4 RECSIZE - 4 SAM V DATA(2K) 1<=n<=16 4<=r<=n*2048-16 RECSIZE - 4 SAM V DATA(4K) 2<=n<=16 4<=r<=n*2048-16 RECSIZE - 4 SAM U PAMKEY 1<=n<=16 BLKSIZE SAM U DATA(2K) 1<=n<=16 BLKSIZE - 16 SAM U DATA(4K) 2<=n<=16 BLKSIZE - 16 ISAM PAMKEY 1<=n<=16 12<=r<=n*2048 BLKSIZE ISAM DATA(2K) 1<=n<=16 12<=r<=n*2048 BLKSIZE - 12 ISAM DATA(4K) 2<=n<=16 12<=r<=n*2048 BLKSIZE - 12 The record keys of ISAM files are not transferred. It is not possible to copy temporary files from BS2000 or via remote file access. Example table for option -tStructure of a EBCDIC standard table. A target file is created with a 1:1 copy of the source file: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF |
Error
path name You do not have read permission for this file or you do not have write permission for the file directory. path name path name path name
An erroneous conversion table was indicated with option -t.
The options -k and -t cannot be used at the same time.
A name was indicated after bs2: in format 2.
An element name was given in format 3.
The name of the target file contains an "*". lib lib file path name: path name
The closing bracket is missing in the element specification (An opening bracket was found).
Copying a BS2000 file to a BS2000 file is not supported. The /COPY-FILE command must be used for this purpose.
A library element and a BS2000 file were specified as the source and the destination or vice versa.
The opening bracket is missing in the element specification (A closing bracket was found).
The specified element name is longer than 64 characters.
The element name is missing in the element specification for format 1.
The specified element version is longer than 24 characters.
The specified type is not
The library name is missing in the element specification.
The library name is longer than 54 characters.
The element name ends with more than one closing bracket.
The element specification contains more than one opening bracket.
The element specification contains more than three elem, type, vers specifications separated by commas. |
Example 1
Copy the BS2000 techdoc file into the file directory /usr/fl, using the same file name. The character set should converted from EBCDIC to ASCII (option -k). $ |
Example 2
Copy the techdoc file in the POSIX file system to BS2000, using the file name flcopy. The current character set is retained (no option -k). $ |
Example 3
The documentation file is a D-type element in the BS2000 PLAM library product. Copy the element to the file directory /usr/product. $ |
Example 4
$ |
Example 5
$ Creates the PLAM library CLIB with the following content: TYPE NAME VER (VAR#) date (S) PHRCV.C 300 (0001) 2008-05-27 (S) PHRMGT.C 300 (0001) 2008-05-27 (S) PHRUPOS.C 300 (0001) 2008-05-27 |
Example 6
|
Example 7
From the BS2000 PLAM library $USER2.DOCLIB, all elements of type D, file names starting with KVH and version 300 are to be copied to the file directory /home/usr/doc. The prefix doc. is to precede the names of the copies.
|
See also
bs2file, ftyp |