Operation [ Micro Focus COBOL System Reference, Volume 1 ] MPE/iX 5.0 Documentation
Micro Focus COBOL System Reference, Volume 1
Operation
Call-by-number routines are accessed using a CALL statement of the form:
call x"hh" using parameter-list
where:
hh is a two-digit hexadecimal code that identifies the
library routine.
parameter-list is a list of the data items in your programs that are
to be passed as parameters. The number and type of
parameters is dependent upon the particular
subprogram you are calling.
Descriptions of Routines
Descriptionsfor all of the call-by-number routines appear in numerical
order according to their hex numbers. Each routine is shown in a CALL
statement that you could use to call it. The parameters it needs are
shown in the USING clause.
Put a Character to the Screen .
call x"82" using character
where:
character is a PIC X COMP-X field containing the character to
be displayed at the current cursor position.
Call x"82" displays a character on the screen.
Interprogram Function Calls.
call x"91" using result function-num file
where:
result is a PIC 9(2) COMP-X field that contains zero if the
call is successful, or non-zero if not successful.
The number returned for non-successful calls varies
according to function-num.
function-num is a PIC X COMP-X field that contains one of the
values listed below, depending on which function you
want.
file depends upon the function
Call x"91" imposes heavy size penalties as it needs a large number of
support routines.
function-num can contain one of the following values:
Value Summary
-------------------------------------------------------
46 Enable insertion of null characters.
47 Disable insertion of null characters.
48 Enable tab insertion.
49 Disable tab insertion.
52 Use two-byte record terminators for line
sequential and relative files
53 Use one-byte record terminators for line
sequential and relative files
Function 46
Enables insertion of a null character x"00" before data characters whose
value is less than x"1B" in line sequential files. If you wish to
include non-ASCII data in a file then you must enable null insertion.
This function enables you to enable null insertion for individual files
regardless of the setting of the run-time switch N. file is the
file-identifier specified in the File Description (FD), and must refer to
a line sequential file which is currently open. For example:
fd payroll-file
...
call x"91" using result
func-num
payroll-file
Function 47
Disables insertion of a null character x"00" before data characters whose
value is less than x"1B" in line sequential files. This function enables
you to disable null insertion for individual files regardless of the
setting of the run-time switch N. file is the file-identifier specified
in the File Description (FD) and must refer to a line sequential file
which is currently open (see Function 46 above for an example). This
function cannot be used if the file is declared as EXTERNAL.
Function 48
Enables insertion of tab characters in line sequential files. On input
all tab characters are expanded to the correct number of spaces, while on
output to disk, multiple spaces before a tab stop position are contracted
to a tab character. This function enables you to enable tab insertion
for individual files regardless of the setting of the run-time switch T.
file is the file-identifier specified in the File Description (FD) and
must refer to a line sequential file which is currently open. See
Function 46 above for an example.
Function 49
Disables insertion of tab characters in line sequential files. On input
all tab characters are expanded to the correct number of spaces; on
output to disk, spaces are output as spaces. This function enables you
to disable tab insertion for individual files regardless of the setting
of the run-time switch T. file is the file-identifier specified in the
File Description (FD) and must refer to a line sequential file which is
currently open. See Function 46 above for an example.
Function 52
Causes a two-byte record terminator to be used for particular files when
your program writes records to a line sequential or relative file. The
record terminator has the value x"0D0A" (carriage return - line feed).
file is the file-name used in the SELECT statement.
Function 53
Restores the default of one-byte record terminators used when your
program writes records to a line sequential or relative file. The
one-byte record terminator has the value x"0A" (line feed). File is the
file-name used in the SELECT statement.
Control the Screen.
call x"A7" using function-num parameter
where:
function-num is a PIC X COMP-X field which contains a value
indicating the function required:
6 reads the current User attribute contained in
parameter
7 sets the current User attribute, which is held in
parameter
16 turns the User attribute on. parameter contains
zero.
You should note that although it is not possible to
turn off the attribute byte, you can instead set the
attribute type to normal by calling the x"A7" routine
function 7 to set the user attribute to normal and
then calling x"A7" function 16 with a value of 0 in
parameter. This results in the same effect as
turning off the attribute byte.
You can also use x"A7" function 3 to change the user
attribute dynamically. You should use the same
caution when using this library routine as when using
any other, using only regular COBOL syntax wherever
possible.
parameter is a PIC X COMP-X field containing:
for functions 6 and 7: the User attribute
for function 16: 0 to turn the User attribute on
The User attribute is initially off for each program. Once it is
enabled, some of the various methods which you can use to display text
upon the screen; for example, DISPLAY...UPON CRT, screen I/O subprograms
and the Adis module all use this attribute. The ANSI form of the DISPLAY
statement (DISPLAY...UPON CONSOLE) uses the User attribute only if one of
the other DISPLAY methods has been used previously. DISPLAY SPACE UPON
CRT clears the screen to the User attribute for each screen position.
The User attribute affects the results of Adis DISPLAY operations only
once Adis has been requested to set up the attribute. Such a request can
be made by asking Adis to perform and ACCEPT or DISPLAY using an
attribute. For example:
display spaces upon crt with highlight
The User attribute, if turned on, is used when displaying text upon the
screen and supersedes any Screen attribute set for the character
positions being used in the display.
See the appendix Display Attributes for details on the User attribute
byte.
NOTE Use of the x"A7" routine results in code that is not portable to
other environments. If you are using an add-on product you can
provide generic color support by using the generic attribute
routines described in the appendix Additional Library Routines in
your Toolbox Reference.
Modify ACCEPT/DISPLAY Behavior.
call x"AF" using function parameter
where:
function is the name of a PIC 9(2) COMP-X field whose value
indicates which of the subprograms controlled by this
call code is to be called.
parameter is the name of a data item whose size and type
depends on the value of function.
function can take any of the following values:
1 enable or disable user function keys at run time
3 control data keys
18 display a character to the screen at the current cursor position
22 sound the terminal alarm
27 get a character from the keyboard
Function 1
Enables individual user function keys, or a series of consecutive user
function keys, to be enabled or disabled at run-time. You must have
already set up the actual key codes for the user functions with the
Keybcf utility. See the chapter Keyboard Configuration Utility (Keybcf)
for details.
parameter is a group item defining user key control consisting of four
data items:
user-key-setting PIC 9(2) COMP-X field that contains 0 to disable user
function keys, or 1 to enable them.
filler a PIC X field whose value must be "1".
first-user-key a PIC 9(2) COMP-X field that contains the number of
the first function key to be enabled or disabled.
This number is as defined with the Keybcf utility.
See the chapter Keyboard Configuration Utility for
details.
number-of-keys a PIC 9(2) COMP-X field that specifies the number of
consecutive function keys that are to be enabled or
disabled. These numbers are as defined with the
Keybcf utility.
Function keys are enabled or disabled until explicitly changed by another
call to x"AF" or until the application terminates. Calls to enable or
disable functions keys are additive. For example, if you call x"AF" to
enable function key F1 and then make a second call to enable F10, both
keys are enabled.
Example.
If you want to enable the Escape key and function keys F1 and F10, but
you want to ensure that all other user function keys are disabled, the
following code will do this:
* Enable Escape key
move 1 to User-Key-Setting
move 0 to First-User-Key
move 1 to Number-Of-Keys
call x"AF" using Set-Bit-Pairs
User-Key-Control
* Disable 126 keys starting from key 1
move 0 to User-Key-Setting
move 1 to First-User-Key
move 126 to Number-Of-Keys
call x"AF" using Set-Bit-Pairs
User-Key-Control.
* Enable F1 and F10.
move 1 to User-Key-Setting
* Enable F1.
move 1 to First-User-Key
move 1 to Number-Of-Keys
call x"AF" using Set-Bit-Pairs
User-Key-Control
* Enable F10
move 10 to First-User-Key
call x"AF" using Set-Bit-Pairs User-Key-Control
Function 3
Disable data keys or make them act like function keys; that is, they
terminate an ACCEPT operation.
parameter is a group item defining data-key-control containing four data
items:
data-key-setting a PIC 9(2) COMP-X field which defines the
action of the keys affected, as follows:
0 The key is disabled. If it is pressed
during an ACCEPT, the terminal alarm
sounds and the key rejected.
1 The key will act as a function key (see
below). It will terminate the ACCEPT.
2 (The default). The character will simply be
entered into the field.
filler'' a PIC X field whose value must be "3".
first-data-key a PIC X defining the first character to be
affected.
number-of-data-keys a PIC 9(2) COMP-X field containing the number
of characters to be affected.
Function 18
Displays a character to the screen at the current cursor position.
parameter is the name of a PIC X item containing the character to be
displayed.
Function 22
Sounds the terminal alarm. parameter is the name of a PIC X item that
can contain any value.
Function 27
Gets a character from the keyboard. parameter is the name of a
three-byte group item declared in the form of a CRT status data item (see
your Language Reference).
A keystroke is read from the keyboard and parameter is updated as
follows:
Byte 1 Meaning
----------------------------------------------------
1 The second byte contains the number of a
user-defined function key, in binary (in
the range 0 to 127). See the chapter Adis
Configuration Utility (Adiscf) for more
details on function keys.
2 The second byte contains the number of an
Adis function key, in binary (in the range
0 to 39). See the chapter Adis
Configuration Utility (Adiscf) for more
details on function keys.
3 The second byte contains the ASCII code of
the keyed character.
9 The second byte contains one of the
following error codes:
8 A disabled character has been keyed, and
byte 3 contains the character.
9 An invalid keystroke (more than one
byte) has occurred.
This routine also causes the COBOL screen handling system to be invoked.
See the chapter Comparison of Screen Handling Methods in your COBOL User
Guide for details.
Call x"AF" gives access to a number of subprograms that affect the
behavior of ACCEPT and DISPLAY statements in a program. ACCEPT and
DISPLAY statements are handled by a part of the RTS called Adis (see the
chapter Adis for details).
Disable Interrupt Key.
call x"B0" using function-code parameter
where:
function-code is a PIC X COMP-X VALUE 4 data item
parameter is a PIC X COMP-X VALUE 1 data item
Call x"B0" disables the interrupt keys for the rest of the application.
Therefore, it should be called before any subprograms are called.
This routine also disables the Suspend interrupt key for systems that
support Job Control.
Call x"B0" has the same effect as the -i run-time switch (see the
appendix Descriptions of Run-time Switches for details).
Sound the Beep.
call x"E5"
This routine causes a beep.
Pack Byte.
call x"F4" using byte
array
where:
byte is a PIC X COMP-X field that contains the new byte.
array is a PIC X COMP-X OCCURS 8 field that contains the
eight bytes to be packed.
The routine takes the eight fields from array and uses the least
significant bit of each byte to form byte. The first occurrence in array
becomes the most significant bit of byte (bit 7).
Unpack Byte.
call x"F5" using byte, array
where:
byte is a PIC X COMP-X field that contains the byte to be
unpacked.
array is a PIC X COMP-X OCCURS 8 field that contains the
unpacked bits.
The routine takes the eight bits of byte and moves them to the
corresponding occurrence in array.
MPE/iX 5.0 Documentation