Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

bs2cp - copy POSIX/BS2000 files (BS2000)

&pagelevel(4)&pagelevel

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
bs2cp[ -k| -t table][ -f][ -l][ -h] file bs2:filecopy

-k

The file content is converted during copying:

  • from ASCII to EBCDIC, if file is a file of the POSIX file system

  • from EBCDIC to ASCII, if file is a BS2000 file (bs2: entered).

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.

-t table

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:

  • EBCDIC format.

  • It must contain exactly 256 character pairs. They must be composed of the following characters: 0 to 9, a to f and A to F.

  • All EBCDIC characters from X’00’ to X’40’ can be placed between the character pairs. These are for example blank spaces, tabulators or newline characters.

  • The file can be of any size. However, only the first 8172 characters (max.) are evaluated.

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”.


-f

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.

-l

Each successfully copied file is reported as follows:
bs2cp: copy from path name to path name done

-h

Output of the command syntax with explanation of options.

bs2:

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

libis the name of the PLAM library in BS2000.
elemis the name of the element.
typeis the type of element. The element types S, M, J, P, D, X and L are supported. Default value is S.
versis the version of the element. Default is *HIGH.

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:

  • If filecopy already exists, bs2cp will adopt the file attributes from the file catalog.

  • If filecopy does not yet exist, it will be created. Prior to the bs2cp call, the file type of the new file can be set with the ftyp command. If no file type is set, a SAM file with a variable record length will be created.

The following is valid if filecopy is an element of a BS2000 PLAM library:

  • An existing elem library element will be overwritten if the option -f is set or if the environment variable OV is set to Y.

  • If the elem library element does not yet exist, it will be created. The ftyp and bs2file commands can also be used to influence the file types of non L-type elements.

  • If no PLAM library with the name lib exists, it will be created.


Format 2: Copying POSIX files to BS2000 as DMS files

bs2cp -x[ -k| -t table][ -f][ -l][ -h][ -p prefix]
      [ -s suffix] file ... bs2:

-x

Extended format of the bs2cp command.

-k

-t

see Format 1.

-f

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:
bs2cp: overwrite A ? y (yes), n (no), a (all) or q (quit)

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.

-l

Each successfully copied file is reported as follows:
bs2cp: copy from path name to path name done

-h

Output of the command syntax with explanation of options.

-p prefix

The prefix character string precedes the names of the copies.

-s suffix

The suffix character string is appended to the names of the copies.

file ...

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.

bs2:

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

bs2cp -x[ -k| -t table][ -f][ -l][ -h][ -p pre fix]
      [ -s suffix] file ... 'bs2:lib([,[type][,vers]])'

-x

Extended format of the bs2cp command.

-k

-t

see Format 1.

-f

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.

-l

Each successfully copied file is reported as follows:
bs2cp: copy from path name to path name done

-h

Output of the command syntax with explanation of options.

-p prefix

The prefix character string precedes the names of the copies.

-s suffix

The suffix character string is appended to the names of the copies.

file ...

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.

'bs2:lib([,[type][,vers]])'

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

bs2cp -x[ -k| -t table][ -l][ -h][ -p prefix][ -s suffix]
      'bs2:file' | 'bs2:lib([elem][,[type][,vers]])' directory

-x

Extended format of the bs2cp command.

-k

-t

see Format 1.

-l

Each successfully copied file is reported as follows:
bs2cp: copy from path name to path name done

-h

Output of the command syntax with explanation of options.

-p prefix

The prefix character string precedes the names of the copies.

-s suffix

The suffix character string is appended to the names of the copies.

'bs2:file'

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.

'bs2:lib(elem[,[type][,vers]])'

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:


. (period)Current directory
~ (tilde)Home directory
/dir1/dir2absolute path
dir1/dir2Relative path starting at the current directory


See Example 6 and Example 7.

Hint

EXIT status in the extended formats 2 through 4

If 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 elements

When library elements are copied to POSIX files or vice versa, the software product LMS must be installed.

DMS file attributes supported

bs2cp 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 -t

Structure 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 : Permission denied

You do not have read permission for this file or you do not have write permission for the file directory.


path name : no such file or directory
The file or file directory indicated does not exist.


path name : is a directory
The name entered describes a file directory and not a file.


path name : DMS FSTAT error xxx
Too many files have been entered.


invalid character pair: xx (valid only 0, ..,9,A,..,F)
An erroneous conversion table was indicated with option -t.


incorrect number of character pairs: xxx (must be 256)
An erroneous conversion table was indicated with option -t.


more than 256 character pairs given

An erroneous conversion table was indicated with option -t.


do not use options -k and -t at the same time

The options -k and -t cannot be used at the same time.


file name name invalid in this case

A name was indicated after bs2: in format 2.


element name name invalid in this case

An element name was given in format 3.


invalid target name path name

The name of the target file contains an "*".


lib ( elem , type , vers ) already exists
The output library element already exists. (The -f option was not specified, the environment variable OV does not exist, and the entry takes place from stdin (-)).


lib ( elem , type , vers ) not accessible
The output library element cannot be accessed. You either have no write authorization for the library or for the element, or lib is not a PLAM library.


file already exists
The BS2000 output file already exists. (The -f option was not specified, the environment variable OV does not exist, and the entry takes place from (-)).


path name: is a directory
The path name specified refers to a directory.


path name is not an executable file
An attempt was made to copy a POSIX file which does not have the format (UFS-LLM) of an executable file into a library as an L element.


closing bracket missing

The closing bracket is missing in the element specification (An opening bracket was found).


Copy from DMS file to DMS file not supported - use command /COPY-FILE f1 , f2

Copying a BS2000 file to a BS2000 file is not supported. The /COPY-FILE command must be used for this purpose.


Copy from UFS file to UFS file not supported - use command cp f1 f2
Copying a POSIX file to a POSIX file is not supported. The POSIX command cp must be used for this purpose.


Copy of UFS directories is not supported

. or .. was specified as file.


DMS FSTAT error D xxx
The system function FSTAT for a BS2000 file returns the error code D xxx.


element name elem too long
The element name (format 2, 3 or 4) specified as the source is longer than 64 characters.


FILE command for " filename " returned error
The FILE command for the BS2000 output file returned an error. A message of the FILE command was output immediately beforehand. (The message is connected to a bs2file or ftyp command which was issued by the user beforehand).


file filename not found
The BS2000 input file was not found.


Invalid BS2000 filename: file
The specified file name ends with a . (period).


invalid character in elem
The specified element name contains illegal characters.


invalid element name elem
The element name elem starts or ends with . or - .


LMS error - LMS nnnn [, PLA mmmm ][, DMS or macro RC xxxx ]
(fct= fct , lib= lib , elem= elem , type= type , ver= vers , file= filename )
When a library element is accessed, LMSUP reports an error with the error code LMSnnnn, possibly supplemented by the PLAM error code and/or the DMS or macro error code (the meaning of the error codes can be inquired using bs2cmd help LMS nnnn etc.).The second line is output only if the -l or -x option was specified. fct is ADD, SEL or TOC. When fct=TOC, the filename specification remains empty.


LMS end errorcode xx
LMSUP, which is needed to copy library elements, could not be terminated properly.


LMS init errorcode xx
LMSUP, which is needed to copy library elements, could not be initialized.


LMS toc errorcode xx
The library’s directory could not be read any futher.


LMS tocprim errorcode xx
The library’s directory could not be read.


No POSIX file involved - use utility LMS

A library element and a BS2000 file were specified as the source and the destination or vice versa.


No write of file . OV is set to value
The specified BS2000 file was not overwritten because the -f option was not specified and the environment variable OV is set and not equal to "Y".


No write of lib ( elem , type , vers ). OV is set to value
The specified element was not overwritten because the -f option was not specified and the environment variable OV is set and not equal to "Y".


opening bracket missing

The opening bracket is missing in the element specification (A closing bracket was found).


PLAM element elem , type type , version vers not accessible
The input element which is specified as the source cannot be accessed. You either have no read authorization for the library or the element, or lib is not a PLAM library.


PLAM element elem , type type , version vers not found
The input element specified as the source was not found.


PLAM element name longer than 64

The specified element name is longer than 64 characters.


PLAM element name missing

The element name is missing in the element specification for format 1.


PLAM element version longer than 24

The specified element version is longer than 24 characters.


PLAM element version vers invalid
The version specification vers contains illegal or wildcard characters.


PLAM element type not supported

The specified type is not S, M, J, P, D, X or L.


PLAM error - PLA mmmm [, DMS or macro RC xxxx ]

(fct= fct , lib= lib , elem= elem , type= type , ver= vers , file= filename )
When a library element is accessed, PLAM reports an error with the error code PLA mmmm, possibly supplemented by the DMS or macro error code (the meaning of the error code can be inquired using bs2cmd help PLA mmmm etc.).
The second line is output only if the -l or -x option was specified. fct is ADD or SEL.


PLAM library name missing

The library name is missing in the element specification.


PLAM library name longer than 54

The library name is longer than 54 characters.


PLAM library lib not found
The specified PLAM library does not exist.


PLAM names must end with single closing bracket

The element name ends with more than one closing bracket.


too many opening brackets

The element specification contains more than one opening bracket.


too many tokens within brackets

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).

$ bs2cp -k bs2: techdoc /usr/fl/ techdoc

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).

$ bs2cp techdoc bs2:flcopy

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.

$ bs2cp 'bs2:product(documentation,D)' /usr/product/documentation

Example 4

$ bs2cp -x -p posix. -s .sich /home/do/sich/dat* bs2:
bs2cp: overwrite FILE1 ? [y=yes/n=no/a=all/q=quit] a
$ ls /home/do/sich
file1 file2 file3

$ bs2cmd fstat posix.
       12  :ABCD:$USER.POSIX.FILE1.SICH
        9  :ABCD:$USER.POSIX.FILE2.SICH
       18  :ABCD:$USER.POSIX.FILE3.SICH

Example 5

$ ls
genpos.c   hrcv.c      hrcv.s     hrmgt.c   hrupos.c   hsdax.c
$ bs2cp -x -l -p p hr*.c 'bs2:clib(,s,300)'
bs2cp:     copy from hrcv.c to CLIB(PHRCV.C,S,300) done
bs2cp:     copy from hrmgt.c to CLIB(PHRMGT.C,S,300) done
bs2cp:     copy from hrupos.c to CLIB(PHRUPOS.C,S,300) done


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

$ bs2cmd fstat '$user2.*kvh*'
        9  :ABCD:$USER2.AKVH7
       12  :ABCD:$USER2.KVHMEM
       12  :ABCD:$USER2.ZKVH
$ bs2cp -x -s .c 'bs2:$user2.*kvh*'
/home/tag/kvh
$ ls -l /home/tag/kvh
total 12
-rw-r--r--  1 kvh       prod5       2321 May 27 13:56 akvh7.c
-rw-r--r--  1 kvh       prod5      18549 May 27 13:56 kvhmem.c
-rw-r--r--  1 kvh       prod5        971 May 27 13:56 zkvh.c

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.

$ bs2cp -xl -p doc. 'bs2:$user2.doclib(kvh*,d,300)' /home/usr/doc
bs2cp: copy from $USER2.DOCLIB(KVHGEN,D,300) to /home/usr/doc/doc.kvhgen done
bs2cp: copy from $USER2.DOCLIB(KVHPROD,D,300) to /home/usr/doc/doc.kvhprod
done
bs2cp: copy from $USER2.DOCLIB(KVHZ,D,300) to /home/usr/doc/doc.kvhz done
$ ls -l /home/usr/doc
total  12
-rw-r--r--   1 kvh      prod5      21738 May 31 06:21 doc.kvhgen
-rw-r--r--   1 kvh      prod5       7461 May 31 06:21 doc.kvhprod
-rw-r--r--   1 kvh      prod5      11729 May 31 06:21 doc.kvhz

See also

bs2file, ftyp