









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An in-depth exploration of character data and zoned decimal data processing in ibm mainframe computers. It covers the ebcdic character set, character constants, moving and comparing character data, zoned decimal format, and the mvc instruction. It also discusses the differences between literals and immediate operands.
Typology: Study notes
1 / 16
This page cannot be seen from the preview
Don't miss anything!










We now discuss the definitions and uses of character data in an IBM Mainframe computer. By extension, we shall also be discussing zoned decimal data. Character data and zoned decimal data are stored as eight–bit bytes. These eight–bit bytes are seen by IBM as being organized into two parts. This division is shown in the following table. Portion Zone Numeric Bit 0 1 2 3 4 5 6 7 Note again the bit numbering scheme used by IBM. Character constants have a few constraints.
Here is the set of important EBCDIC codes. Character EBCDIC blank 40 A – I C1 – C J – R D1 – D S – Z E2 – E 0 – 9 F0 – F Note that the EBCDIC codes for the digits ‘0’ through ‘9’ are exactly the zoned decimal representation of those digits. (But see below). The DS declarative is used to reserve storage for character data. The DC declarative is used to reserve initialized storage for character data. We now cover a few topics:
The MVC (Move Character) instruction is designed to move character data, but it can be used to move data in any format, one byte at a time. The instruction may be written as MVC DESTINATION,SOURCE The format of the instruction is MVC D1(L,B1),D2(B2) An example of the instruction is MVC F1,F Here are a few comments on MVC.
The form is MVC D1(L,B1),D2(B2). The object code format is as follows: Type Bytes Form 1 2 3 4 5 6 SS(1) 6 D1(L,B1),D2(B2) OP L B 1 D 1 D 1 D 1 B 2 D 2 D 2 D 2 Consider the example assembly language statement, which moves the string of characters at label CONAME to the location associated with the label TITLE. MVC TITLE,CONAME Suppose that: 1. There are fourteen bytes associated with TITLE , say that it was declared as TITLE DS CL14. Decimal 14 is hexadecimal E.
Consider again the example: MVC 32(5,7) , NAME. Suppose that the label NAME corresponds to an address given by offset X‘250’ (592 in decimal) from general–purpose register 10 (denoted in object code by X‘A’ ). When the instruction is written in the form MVC D1(L,B1),D2(B2) , we see that it has the form MVC 32(5,7),592(10). ALL NUMBERS ARE DECIMAL. In the object code format, the value stored for the length attribute is one less than the actual length. The length is 5, so the stored value is 4, or X‘04’. The object code format is D2 04 70 20 A2 50. Again, recall the object code format for this instruction. Op Code Length Base Displacement Base Displacement D 2 0 4 7 0 2 0 A 2 5 0
The number of bytes (characters) to move may be explicitly stated. If the number is not explicitly stated, the number is taken as the length (in bytes or characters) of the destination field. Consider the following program fragment. MVC F1,F F1 DC CL4‘JUNE’ F2 DC CL5‘APRIL’ What happens is shown in the next figure. The assembler recognizes F1 as a four–byte field from its declaration by the DC statement. This implicitly sets the number of characters to be moved. The ‘L’ is not moved, as it is the fifth character in F2. It is at address F2+.
We may use relative addressing as well as an explicit length declaration. Consider the following program fragment. MVC F1+1(2),F2+ F1 DC CL4‘JUNE’ F2 DC CL5‘APRIL’ This calls for moving two characters from address F2+2 to address F1+. What two characters are at address F2+2? Answer: “RI”. What two characters are at address F1+1? Answer: “UN”. What happens is shown in the next figure. The other two characters in F1, at addresses F1 and F1+3 , are not changed.
We now consider the explicit use of base registers. Recall the form of the instruction: MVC D1(L,B1),D2(B2). In the following three examples, we suppose that PRINT is a label associated with an output field of length 80 bytes. In reality, it only must be “big enough”. FRAG01 MVC PRINT+60(2),=C‘’ FRAG02 LA R8,PRINT+60 LOAD THE ADDRESS. MVC 0(2,8),=C‘’ DEST ADDRESS IS PRINT+ FRAG03 LA R8,PRINT LOAD THE ADDRESS. MVC 60(2,8),=C‘’ NOTE OFFSET IS 60** Suppose that the address of PRINT is given by base register 12 and displacement X‘200’. Suppose register 12 contains a value of X‘1000’. The label PRINT references address X‘1200’. The value of PRINT+60 is then X‘1200’ + X‘60’ = X‘1260’. We shall repeat this example and discuss similar examples in a future lecture on accessing arrays and tables.
The character comparison operators, CLC and CLI, set the condition codes. These codes are used by the branching instructions in their non–numeric form. Here are the standard comparisons. BE Branch Equal Condition Code = 0 BNE Branch Not Equal Condition Code 0 BL Branch Low Condition Code = 1 BNL Branch Not Low Condition Code 1 BH Branch High Condition Code = 2 BNH Branch Not High Condition Code 2. Here are two equivalent examples. CLC X, Y CLC X, Y BL J20LOEQ BNH J20LOEQ BE J20LOEQ
Consider the following code fragment. Note that the comparison value is given as the seven EBCDIC characters ‘0200000’. Presumably, this would be converted into seven Packed Decimal digits and held to represent the fixed point number 2000.00, presumably $2,000.00. **C20 CLC SALPR,=C‘0200000’ COMPARE TO 2,000. BNH C30 NOT ABOVE 2,000. BL C40 LESS THAN 2,000.
The main characteristics of an immediate operation is that the operand, called the “immediate operand” is contained within the instruction. The main characteristic of a literal operand is that it is stored separately from the operand, in a literal pool generated by the assembler. Here are two equivalent instructions to set the currency sign. Use of a literal: MVC DOLLAR,=C’$’ Use of immediate operand MVI DOLLAR,C’$’ Note the “=” in front of the literal. It is not present in the immediate operand.