IF Enable THEN
IF LDP(TRUE,ContentStart) THEN
SortEnd:=FALSE;
ZRST(TRUE,DataOut1[0],DataOut1[29]);
ZRST(TRUE,DataOut2[0],DataOut2[29]);
ZRST(TRUE,DataContent_Min[0],DataContent_Min[29]);
ZRST(TRUE,DataContent_Max[0],DataContent_Max[29]);
Data_i:=0;
MoveEnd:=TRUE;
END_IF;
IF MoveEnd THEN
FOR Data_i:=0 TO DataNumber-1 BY 1 DO
DataContent_Min[Data_i]:=DataContent[Data_i];
DataContent_Max[Data_i]:=DataContent[Data_i];
END_FOR;
SortStart:=TRUE;
MoveEnd:=FALSE;
END_IF;
IF SortStart THEN
DataNumber_i:=0;
FOR DataNumber_i:=0 TO DataNumber-2 BY 1 DO
DataSort:=DataNumber-(DataNumber_i+1);
FOR DataSort_i:=0 TO DataSort-1 BY 1 DO
IF DataContent_Min[DataNumber_i+DataSort_i+1]<=DataContent_Min[DataNumber_i] THEN
DataContent_N_E_Min:=DataContent_Min[DataNumber_i];
DataContent_S_E_Min:=DataContent_Min[DataNumber_i+DataSort_i+1];
DataContent_Min[DataNumber_i]:=DataContent_S_E_Min;
DataContent_Min[DataNumber_i+DataSort_i+1]:=DataContent_N_E_Min;
DataOut2[DataNumber_i]:=DataContent_S_E_Min;
DataOut2[DataNumber-1]:=DataContent_N_E_Min;
END_IF;
IF DataContent_Max[DataNumber_i+DataSort_i+1]>=DataContent_Max[DataNumber_i] THEN
DataContent_N_E_Max:=DataContent_Max[DataNumber_i];
DataContent_S_E_Max:=DataContent_Max[DataNumber_i+DataSort_i+1];
DataContent_Max[DataNumber_i]:=DataContent_S_E_Max;
DataContent_Max[DataNumber_i+DataSort_i+1]:=DataContent_N_E_Max;
DataOut1[DataNumber_i]:=DataContent_S_E_Max;
DataOut1[DataNumber-1]:=DataContent_N_E_Max;
END_IF;
END_FOR;
END_FOR;
SortStart:=FALSE;
SortEnd:=TRUE;
END_IF;
END_IF;