With the %SET command you transfer the memory contents or AID literals to memory positions in the program which has been loaded. Before transfer, the storage types sender and receiver are checked for compatibility. The contents of sender are matched to the storage type of receiver, with the result that the %SET statement works in the same way as the COBOL MOVE statement, apart from exceptions mentioned later.
With sender you designate a data item, a length, an address, an execution counter, an AID register, a COBOL special register, a figurative constant or an AID literal. sender may be either within the virtual memory of the loaded program or in a dump file.
With receiver you designate a data item, an execution counter, an AID register or a COBOL special register to be overwritten. receiver may only be located within the virtual memory of the program which has been loaded.
Command | Operand |
%S[ET] | sender INTO receiver |
In contrast to the %MOVE command, AID checks for the %SET command (prior to transfer) whether the storage type of receiver is compatible with that of sender and whether the contents of sender match its storage type. In the event of incompatibility, AID rejects the transfer and outputs an error message.
If sender is longer than receiver, it is truncated on the left or right, depending on its storage type, and AID issues a warning message. sender and receiver may overlap. In the case of numeric transfer, sender is converted to the storage type of receiver if required, and the contents of sender are stored in receiver with the value being retained. If the value does not fully fit into receiver, a warning is issued.
sender and receiver may also be defined in the FILE SECTION or SUB-SCHEMA SECTION. If they are located in the LINKAGE SECTION, the latter must be contained in the current call hierarchy.
Which storage types are compatible and how transfer takes place is shown in the table at the end of the description of the %SET command.
Entry of the command immediately after loading the program is not advisable as not all entries in the DATA DIVISION will have been initialized (e.g. record definitions and special registers).
In addition to the operand values described here, you can also use those described in the manual for debugging on machine code level (see manual AID - Debugging on Machine Code Level (Related publications) [2]).
With %AID CHECK=ALL you can activate an update dialog; this dialog shows you the old and new contents of receiver prior to transfer and offers the option of aborting the %SET command.
The %SET command does not alter the program state.
|
|
|
For sender or receiver you may specify data items, COBOL special registers, execution counters, registers or a complex memory reference. Statement names, source references, figurative constants, AID literals and addresses and lengths of data items can only be used as sender.
sender may be located either in the virtual memory area of the loaded program (E=VM) or in a dump file; receiver, on the other hand, may only be located in the virtual memory area of the loaded program.
If program areas are transferred or overwritten with instruction code, there may be undesirable results if addresses are affected which belong to a control-area or trace-area or for which a test point has been set with %INSERT (see AID Core Manual (Related publications) [1]).
|
|
| INTO [•][qua•] { C=segmentname |
|
•
If the period is in the leading position it denotes a prequalification, which must have been defined with a preceding %QUALIFY command.
Consecutive qualifications must be separated by a period. In addition, there must be a period between the final qualification and the following operand part.
qua
Qualifications need only be specified if an address operand does not apply to the current AID work area or if the intention is to reference an address that is not within the current compilation unit or the current program.
E={VM | Dn} for sender
E=VM for receiver
is to be specified only if the current base qualification (see %BASE command) is not to apply to sender or receiver.
sender can be located either in virtual memory or in a dump file, whereas receiver must be located in virtual memory.
S=srcname
is to be specified only if sender or receiver is not contained in the current compilation unit.
PROC=program-id
is to be specified only if you address a file name, data name or statement name that is not in the current program or is not unique in the current compilation unit (see chapter “COBOL-specific addressing”). It is also necessary for a global data name that is locally hidden.
If srcname in the S qualification is the same as program-id, only the PROG qualification need be written.
NESTLEV= level-number
level-number
A level number in the current call hierarchy
level-nummer has to be followed by dataname.
Specify NESTLEV= level-number when you want to address a data name on a certain level in the current call hierarchy. This qualification can only be combined with E=, and not with any other qualification.
Only the base qualification or the CTX qualification can be placed before the C qualifications listed below. The C qualification takes the user away from the symbolic level. No symbolic operands can be written directly afterwards (see section “Symbolic memory references” (Symbolic memory references)), only a compl-memref.
C=segmentname
Without a length modification, specify the entire segment as the sender or receiver.
C=sharename
Without a length modification, specify the entire object module as the sender or receiver.
dataname
is the name of a group item or data element defined in the source program or the name of a COBOL special register. Figurative constants can only be used as sender.dataname is an alphanumeric string with up to 30 characters.
AID transfers data elements in accordance with the rules for COBOL MOVE, taking into consideration the definitions from the source program.
Data items can only be processed with %SET if both sender and receiver have been defined as data items. AID executes an alphanumeric transfer, taking neither the format nor the data type definition into account.
Numeric and alphanumeric receive items with print editing can only be modified with an AID character literal (C’...’, X’...’ or B’...’) whose contents have already been correspondingly edited for printing.
dataname [identifier][...][(index[,...])]
identifier
If dataname is not unambiguous within a program unit, it can be identified by being assigned to a particular data item with IN or OF. dataname must be assigned as many identifiers as are required to designate it unambiguously.
If it is not identified, AID only outputs data for dataname if a data definition is provided for it at level 01 or 77. If this is not the case, an error message is issued.
index
If dataname is the name of an element in a table, it can be indexed and subscripted as in a COBOL statement. The notation differs from COBOL only in that multiple indexes must be separated by a comma. If you specify the name of a table element without an index or with an incomplete index, AID aborts transfer.
index can be specified as follows:{ n | index-name | dataname | TALLY | arithmetic-expression }
COBOL special registers
LINAGE-COUNTER
RETURN-CODE
SORT-CCSN
SORT-CORE-SIZE
SORT-EOW
SORT-FILE-SIZE
SORT-MODE-SIZE
SORT-RETURN
TALLY
Figurative constants
can only be specified as sender; the address selector cannot be used on them.
The figurative constants HIGH-VALUE and LOW-VALUE always represent the alphanumeric value assigned to them by default or in the declarations made with the PROGRAM COLLATING SEQUENCE clause. In contrast to the COBOL MOVE statement, only one character is transferred in the AID command %SET when a figurative constant is used.
ZEROSPACE
HIGH-VALUE
LOW-VALUE
QUOTE
symbolic character
statement-name
designates the address of the first instruction in a section or paragraph in the PROCEDURE DIVISION.{ L'section' | L'paragraph' [IN L'section'] }
If a paragraph name is not unambiguous within a program, it must be identified by the section name of the section in which it was defined: L'paragraph' IN
L'section'
Statement names are address constants and can only be specified for sender. The address thus designated is then transferred.
With the subsequent pointer operator (statement-name ->) you designate 4 bytes of the program code generated for the statement. For 2-byte or 6-byte instructions you must specify a corresponding length modification. statement-name -> can be used both as sender and receiver. See examples 6 and 7.
source-reference
designates the address of the first instruction generated for a statement in the PROCEDURE DIVISION and must be specified in one of the following formats:
S’n’
for lines with paragraph or section names in which no COBOL verb occurs. This specification is not possible for programs which have been compiled with STMT-
REFERENCE=COLUMN1-TO-6
.
S’nverb[m]’ | S’xverb[m]’
for lines containing a COBOL verb. m is specified only if the same COBOL verb appears more than once in a line.
Source references are address constants and can only be specified for sender. The address thus designated is then transferred.
With the subsequent pointer operator (source-reference ->) you designate 4 bytes of the program code generated for the statement. For 2-byte or 6-byte instructions you must specify a corresponding length modification. source-reference -> can be used both as sender and receiver. See examples 6 and 7.
keyword
is an execution counter, the program counter or a register. Only a base qualification can be specified before keyword.
The AID Core Manual (Related publications) [1], lists the implicit storage types of the keywords.
%•subcmdname Execution counter %• Execution counter of the current subcommand %PC Program counter %n General register, 0 <= n <= 15 %nD|E Floating-point register, n = 0,2,4,6 %nQ Floating-point register, n = 0,4 %nG AID general register, 0 <= n <= 15 %nDG AID floating-point register, n = 0,2,4,6
compl-memref
The following operations may occur in compl-memref (see AID Core Manual (Related publications) [1]):
byte offset (•)
indirect addressing (->)
type modification (%T(dataname), %X, %C, %E, %D, %P, %F, %A, %S, %SX, %UTF16)
length modification (%L(...), %L=(expression), %Ln)
address selection (%@(...))
character conversion functions %C() and %UTF16()
With an explicit type or length modification you can match the storage type for sender to that of receiver. A type modification with a storage type that is incompatible with the memory contents will be rejected by AID.
If a compl-memref begins with statement-name or source-reference, it must be followed by a pointer operator ( -> ). In this case statement-name must be specified with L’...’. Without the pointer operator ( -> ), statement-name and source-reference can be used anywhere where hexadecimal numbers can be written.
Following a byte offset (•) or pointer operation (->), the implicit storage type and original address length are lost. At the calculated address, storage type %X with a length of 4 applies unless the user has made an explicit specification for type and length. Nevertheless, the area boundaries of a start address (CSECT, dataname, keyword etc.) remain in effect.
They must not be exceeded for any operand in a complex memory reference by a byte offset or length modification, otherwise AID will reject the command and issue an error message. Only by combining the address selector (%@) with the pointer operator (->) can you switch to machine code level, on which the area comprises the area of virtual memory occupied by the loaded program.
Example: %SET CITEM.3%L5 INTO CITEM1
The area of CITEM is five bytes long. After the byte offset, the area of CITEM would be exceeded by three bytes as a result of length modification %L5. This is not allowed. If it is intended to use the %SET command to transfer a further three bytes to CITEM1 after CITEM, the %SET must be written as follows:
%SET %@(CITEM)->.3%L5 INTO CITEM
%@(...)
With the address selector you can output the start address of a data entry, a data item, a special register or a complex memory reference. The result supplied by the address selector is an address constant (see AID Core Manual (Related publications) [1]).
The address selector cannot be used for symbolic constants (including the statement names, the source references and the figurative constants).
%L(...)
The length selector can be used to specify the length of a data entry, data item or special register as sender. The length selector produces an integer as a result (see AID Core Manual (Related publications) [1]).
Example: %SET %L(ARRAY1) INTO %0G
The length of ARRAY1 will be transferred.
%L=(expression)
With the length function you, as sender, can have a value calculated.
expression is formed from memory references, constants, integers and arithmetic operators. Only memory reference contents that are integers (type %F or %A) are permitted. The length function produces an integer as a result. (see AID Core Manual (Related publications) [1]).
Example: %SET %L=(ARRAY1) INTO %0G
The content of ARRAY1 is transferred if it is an integer (type %F). Otherwise AID issues an error message.
%C(...) or %UTF16(...)
This function converts strings from 1-byte EBCDIC encoding to UTF16 encoding and vice versa.
For further information, see the AID Core Manual (Related publications) [1].
AID literal
All AID literals described in the AID Core Manual (Related publications) [1], may be specified. Note well the conversion options for matching AID literals to the respective receivers as described in that chapter:
{C'x...x' | 'x...x' | U'x...x' } Character literal {X'f...f'} Hexadecimal literal {B'b...b'} Binary literal [{+|-}]n Integer #'f...f' Hexadecimalnumber [{+|-}]n.m Fixed-point number [{+|-}]mantisseE[{+|-}]exponent Floating-point number
%SET table
The following table provides an overview on permissible combinations of the sender and receiver types in conjunction with the %SET command.
sender | receiver | ||||||||
Fixed-pt., | int. | Index1 | alpha- | alpha- %C | edited | %X | %UTF16, | strongly | |
Fixed-pt., ext.float.-pt.no, | num | num | num | − | − | −* | − | − | − |
internal float.-pt.no, | num | num | num | − | − | −* | bin | − | − |
[{±}]n.m | num | num | − | − | − | −* | − | − | − |
edited (alphabetic, | − | − | − | chara | char | −* | − | chare | − |
alphanumeric, | numn | numn | numn | chara | char | −* | bin | chare | − |
numeric edited. | − | − | − | − | char | − | − | chare∗∗ | − |
symbolic character | numn | numn | numn | chara | char | −* | − | chare | − |
C' x...x' | numn | numn | numn | chara | char | char | bin | chare | − |
X' f...f' , B' b...b' | bin | bin | − | bin | bin | bin | bin | bin | bin |
%X | − | bin | − | − | bin | − | bin | bin | − |
%UTF16/U’x...x’, | numn | numn | numn | charae | chare∗∗∗ | −* | bin | charg | − |
strongly typed | −* | −* | − | −* | −* | −* | − | − | chart |
* | Unlike COLBOL, AID does not execute this transfer. |
** | When HIGH-VALUE/LOW-VALUE is transferred, conversion to NATIONAL takes place; this is not COBOL-compliant. |
*** | The transfer is forbidden in COBOL. |
bin | Binary transfer; left-justified sender < receiver padding with binary zeros on the right sender > receiver truncation on the right For transfer to %X, integral numeric literals correspond to a signed integer value | ||||||||
char | Character transfer; left-justified or right-justified if the JUSTIFIED RIGHT clause of sender < receiver padding with blanks ’(...)’ on the side which is specified in sender > receiver truncation on the side which is specified in JUSTIFIED clause
| ||||||||
num | Numeric transfer; value is retained If required, sender is converted to the storage type of receiver.
| ||||||||
- | No transfer AID indicates the incompatibility of the storage types. |
Examples
The following items and tables are defined in a COBOL program:
01 NUMB-TAB. 02 QNTY PIC S9(6) OCCURS 50 INDEXED BY J. 01 NUMB-SUM PIC S9(6). 01 PROC-SUM PIC S999V99. 01 CHAR PIC X(10). 01 NATIONAL-CHAR PIC N(10)
For the following examples the update dialog was activated via %AID CHECK=ALL
. This displays the contents of the receive field before and after the execution of %SET.
%SET #'061' INTO NUMB-SUM
OLD CONTENT:
1
NEW CONTENT:
97
% AID9274 Change desired? (Y=YES; N=NO)?
Y
The following command produces the same result:
%SET 97 INTO ANZ-SUMME
%QUALIFY PROG=UPRONUM
%SET .NUMB-SUM INTO .NUMB(16)OLD CONTENT:
0
NEW CONTENT:
10
% AID9274 Change desired? (Y=YES; N=NO)?
Y
%SET 'ABCDEFG' INTO CHAR
OLD CONTENT:
1234567890
NEW CONTENT:
ABCDEFG
% AID9274 Change desired? (Y=YES; N=NO)?
Y
%SET 123.45 INTO PROC-SUM
OLD CONTENT:
+0.00
NEW CONTENT:
+123.45
% AID9274 Change desired? (Y=YES; N=NO)?
Y
%SET 123.45 INTO QNTY(5)
I390 WARNING: SOURCE TRUNCATED
OLD CONTENT:
0
NEW CONTENT:
123
% AID9274 Change desired? (Y=YES; N=NO)?
Y
%SET L'OUTPUT' INTO %0G
The address of the first instruction starting at paragraph PUTOUT is written into AID register %0G.%DA 5 FROM L'PUTOUT'->
With DISASSEMBLE you disassemble the instruction code located at the address allocated to the paragraph PUTOUT. The first instruction is a 2-byte instruction.
%SET L'PUTOUT'->%L2 INTO %1G
This first instruction is written to AID register %1G with the %SET command.%SET CHAR INTO NATIONAL-CHAR
%SET '{ä}' INTO NATIONAL-CHAR
In the first case the EBCDIC string from theZEICHEN
field is converted to UTF16
encoding (corresponds to the COBOL data type NATIONAL). The converted string is transferred to theNATIONAL-ZEICHEN
field. The EBCDIC character set forCHAR
from the COBOL program is used. This ensures that AID and the COBOL program perform the same conversions.
In the second case the literal ’{ä}’ is transferred to theNATIONAL-CHAR
field following UTF16 conversion. The literal ’{ä}’ can be input only if the terminal emulation supports the coded character set UTFE.%SET %UTF16(V'00' %CL3) INTO NATIONAL-CHAR
%SET CHAR INTO NATIONAL-CHAR
The function %UTF16() can only be applied to EBCDIC strings. Type modification with %C ensures that the memory address V’00’ is also interpreted as such.Both %SET commands convert an EBCDIC string contained in the memory to a UTF16 string. This is always stored inNATIONAL-CHAR
.
In the case of the %UTF16(V’00’ %CL3) operand, AID uses the character set selected by %AID EBCDIC . In the case of theCHAR
operand, AID uses the character set specified by COBOL2000.
You must consequently check the characters selected using %SHOW %AID. The EBCDIC character set currently selected is displayed.
%D _EBCDIC_CCSN shows the character set that applies for the COBOL program.%SET NATIONAL-CHAR INTO CHAR
%SET %C(V'00'%UTF16L6) INTO CHAR
Both %SET commands convert a UTF16 string contained in the memory to an EBCDIC string and store it inCHAR
.
In the first case the COBOL2000 object determines the EBCDIC character set of the destination field. In the second case the %AID command determines the EBCDIC character set of the destination field.