*process source xref attributes; KNAPSACK_CONTINUOUS: Proc Options(main); /*-------------------------------------------------------------------- * 19.09.2014 Walter Pachl translated from FORTRAN *-------------------------------------------------------------------*/ Dcl (divide,float,hbound,repeat) Builtin; Dcl SYSPRINT Print; Dcl maxweight Dec Fixed(15,3); maxweight = 15.0; Dcl (total_weight,total_value) Dec Fixed(15,3) Init(0); Dcl vpu Dec Float(15); Dcl (i,j) Bin Fixed(31); Dcl 1 item(9), 2 name Char(7), 2 weight Dec Fixed(15,3), 2 value Dec Fixed(15,3); Dcl temp Like item; Call init_item(1,'beef', 3.8, 36.0); Call init_item(2,'pork', 5.4, 43.0); Call init_item(3,'ham', 3.6, 90.0); Call init_item(4,'greaves', 2.4, 45.0); Call init_item(5,'flitch', 4.0, 30.0); Call init_item(6,'brawn', 2.5, 56.0); Call init_item(7,'welt', 3.7, 67.0); Call init_item(8,'salami', 3.0, 95.0); Call init_item(9,'sausage', 5.9, 98.0); /* sort item in descending order of their value per unit weight */ do i = 2 To hbound(item); j = i - 1; temp = item(i); do while(j>=1&item(j).value/item(j).weight