Presettings in the user environment
When you have successfully accessed the POSIX subsystem, the POSIX shell is started. Before the POSIX shell reports that it is ready for operation, the following presettings are made in the user environment:
The POSIX shell initializes the standard shell variables. It allocates default values to the following variables: HOME, LANG, LOGNAME, MAIL, PATH, SHELL, TTY, TERM, TZ and USER.
If a variable has already been predefined by the SDF-P variable SYSPOSIX then this value is adopted. However, the shell variables USER, TERM, TYP, LOGNAME, HZ, HOME and MAIL may not be set by the user.The file /etc/profile is executed.
If you have created it, the file $HOME/.profile is executed.
Terminal support
POSIX supports the block-mode terminals which are used in BS2000 as well as the character-mode terminals employed in Unix systems. The latter are connected to Unix multiuser systems and are operated by POSIX via networks. If you access POSIX via a workstation then a character-mode terminal is emulated.
Block-mode and character-mode terminals operate differently:
In the case of character-mode terminals each character that is input is immediately transferred to the Unix system where it is transferred to the screen as a response to the input and displayed. Control functions such as cursor movement, uppercase/lowercase notation or the buffering of transfers are performed by the computer to which the terminal is connected. Screen-oriented applications are only permitted at character-mode terminals.
In contrast, block-mode terminals transfer all the text entered at the screen to the computer in the form of a data block. Control functions are performed at the unit itself.
Block-mode terminals are directly connected to the BS2000 and POSIX. Both BS2000 and POSIX commands can be entered at this terminal type.
For BS2000 security reasons it is only allowed to write via block-mode terminals to terminals of the own process group. E.g. a cp <file> /dev/term/xxx
processed for a block-mode terminal of another LOGON-Task will be rejected with permission denied
.
Many inputs are terminal-dependent, i.e. they are different for block and character-mode terminals:
Block-mode terminal | Character-mode terminal |
@@d | CTRL+D |
@@c | CTRL+C |
EM DUE | Enter |
@@z | CTRL+Z |
- | CTRL+S / CTRL+Q ... |
Special functions (P keys, Ctrl keys)
You can call the command bs2pkey to make the following settings for the P3, P4 and P5 keys:
P3 | @@c (CTRL+C) |
P4 | @@d (CTRL+D) |
P5 | @@z (CTRL+Z) |
You may either call the program in the POSIX shell (without options) or enter it in the file /etc/profile. In the latter case the program is called each time the shell is activated.
File transfer
POSIX files contain no records. Instead, they are byte-oriented. In contrast, BS2000 files contain record-oriented and/or PAM block-oriented data.
By default, POSIX handles files in EBCDIC format, whereas Unix systems and Windows handle files in ASCII format. ASCII files stored in the POSIX file system can only be processed in the POSIX shell if they have first been converted.
Routines for the conversion of data between POSIX and BS2000 formats are available in order to permit the exchange of POSIX and BS2000 files. Files are converted from the EBCDIC DF 03 character set to ASCII ISO 7-bit code, and vice versa (see also chapter “Tables and directories”). Only pure text files can be converted.
Automatic conversion
The environment variable IO_CONVERSION determines whether files accessed with POSIX commands (e.g. awk, cat, grep...) on mounted ASCII file systems are converted automatically. IO_CONVERSION is set to the value "NO" by default, which means that no automatic conversion occurs. If desired, automatic conversion can be enabled with the following
command:
export IO_CONVERSION=YES
If you want to set automatic conversion for a POSIX user as the default value directly on starting the POSIX shell, this export command must be entered in the .profile file in the HOME directory of that user.
Note that automatic conversion must not be enabled when using the following tools, since the tools themselves also perform the same conversion:
dd, iconv and bs2cp with the -k option.
Handling of archives/libraries:
ar does not convert automatically, since ar libraries often contain binary data.
pax and tar convert automatically. However, a pax or tar archive must not be copied with cp if automatic conversion is enabled.
Transferring files from POSIX to BS2000 (as seen by the POSIX shell):
You use the POSIX command bs2cp to transfer files from POSIX to BS2000. You do not need to specify the -k option if the files use the EBCDIC character set in the two file systems.
In addition, you may define file attributes for the BS2000 file. To do this you must use the POSIX command bs2file to define the BS2000 file attributes before issuing the "copy" command bs2cp. bs2file is mapped to the BS2000 command SET-FILE-ATTRIBUTES.
Transferring files from BS2000 to POSIX (as seen by the POSIX shell):
You use the POSIX command bs2cp to transfer files from BS2000 to POSIX. You do not need to specify the -k option if the files use the EBCDIC character set in the two file systems.
Depending on the BS2000 file type (SAM, ISAM or PAM) the following applies:
PAM files are always stored as binary files.
ISAM files are generally stored as text files in the POSIX file system.
In the case of SAM files and LMS elements (type S, J, X ,D), you can choose whether the file/element should be placed in the POSIX file system as a text file, binary file or binary text file. To do this, you must use the POSIX command ftype to specify the file processing mode before issuing the "copy" command bs2cp.
Use the POSIX command iconv to perform file conversion within the POSIX file system. The file contents are converted.