InterviewSolution
| 1. |
Explain About Data Arrays, Structures, And Unions In Pl/1? |
|
Answer» In PL/I, DATA items can be single data elements or they can be grouped together to form data aggregates that can be REFERRED to either collectively or individually. Data aggregates can be ARRAYS, structures, unions, arrays of structures or unions, structures or unions of arrays, and combinations thereof, providing a very rich foundation for the description and manipulation of any CONCEIVABLE data. For example : if an array of structures were used to hold meteorological data for each month of the 20th and the 21st centuries, it might be declared as follows: Declare 1 Year(1901:2100), 3 Month(12), 5 Temperature, 7 High decimal fixed(4,1), 7 Low decimal fixed(4,1), 5 Wind&us.velocity, 7 High decimal fixed(3), 7 Low decimal fixed(3), 5 Precipitation, 7 Total decimal fixed(3,1), 7 Average decimal fixed(3,1), 3 * char(0); The weather data for July 1991 is contained in the element Year(1991,7) of the array of structures Year. Portions of this data can be referred to by Temperature(1991,7) or Precipitation(1991,7). In PL/I, data items can be single data elements or they can be grouped together to form data aggregates that can be referred to either collectively or individually. Data aggregates can be arrays, structures, unions, arrays of structures or unions, structures or unions of arrays, and combinations thereof, providing a very rich foundation for the description and manipulation of any conceivable data. For example : if an array of structures were used to hold meteorological data for each month of the 20th and the 21st centuries, it might be declared as follows: Declare 1 Year(1901:2100), 3 Month(12), 5 Temperature, 7 High decimal fixed(4,1), 7 Low decimal fixed(4,1), 5 Wind&us.velocity, 7 High decimal fixed(3), 7 Low decimal fixed(3), 5 Precipitation, 7 Total decimal fixed(3,1), 7 Average decimal fixed(3,1), 3 * char(0); The weather data for July 1991 is contained in the element Year(1991,7) of the array of structures Year. Portions of this data can be referred to by Temperature(1991,7) or Precipitation(1991,7). |
|