Initialization (computing)
Appearance
Initialization in computing, is the setting (or "formatting") of a variable to some initial value, either by statically embedding the value at compile time, or else by assignment at run time. Setting the memory to hexadecimal zeroes is also sometimes known as "clearing" or sometimes coloquially, for IBM/360 programmers, "zapping" the variable to zero - probably originating in the "ZERO ADD PACKED" - ZAP assembler instruction )
Examples
IBM/360 and Z/Architecture Assembler language
* static definitions (values embedded in object code/binary file)
VAR1 DC CL11'Hello world" defines (a constant) - an 11 byte EBCDIC character string containing "Hello world"
VAR2 DC PL6'0' defines (a constant) - a six byte packed decimal (binary coded decimal) numeric field of zer0
DC C' ' * (keep defines a one-byte blank for propagating to next field in memory (PRT)
PRT DC CL132' ' * together) defines a 132 field to contain a line of print (initialized by byte defined before it)
..
* (possibly) dynamic definitions - no initial value at assembly time
VAR3 DS PL6 defines a variable six byte decimal field with no initial value
VAR4 DS XL256 defines a field 256 bytes long for containing any data type
VAR5 DS F defines a 4 byte binary value (fullword)
VAR6 DS A defines a 32 bit hexadecimal field for an address constant ("pointer")
..
* examples of some initializing instructions
ZAP VAR3,=P'0' initializes the six byte packed field to (packed) 0 (using a one-byte literal =packed 0)
XC VAR4,VAR4 initializes the 256 byte field to nulls (hexadeciomal zeroes)
XC VAR5,VAR5 initializes the 4 byte signed or unsigned binary value to nulls (zero)
MVC VAR6,=A(PRT) initializes the address constant to point to the variable called "PRT"
MVC PRT,PRT-1 initializes entire 132 byte field to blanks by propagation from preceding blank
..
/* ------------ static definitions ---------------------------------------*/
static char prt[] = {'h','e','l','l','o',' ','w','o','r','l','d','0'}; /* this */
static char prt[] = "hello world"; /* or this */
static short month_days[] = {31,28,31,30,31,30,31,31,30,31,30,31};
static char *month_names[] ={
"January", "February",
"March", "April",
"May", "June",
"July", "August",
"September", "October",
"November", "December"
};
/* ------------ local definitions -----------------------------------------*/