図 41. PLISRTD-入力処理ルーチンから出力処理ルーチンへのソート
ex110: proc options(main);
/*****************************************************************/
/* */
/* PLISRTD: sorting from an input-handling rtn to an */
/* output-handling routine. Records are varying-length. */
/* */
/*****************************************************************/
dcl rc fixed bin(31,0);
call plisrtd(' SORT FIELDS=(7,4,CH,A) ',
' RECORD TYPE=V,LENGTH=(80) ',
256000,
rc,
e15x,
e35x );
select( rc );
when(0) put skip edit
('Sort complete return code = 0') (a);
when(16) put skip edit
('Sort failed return code = 16') (a);
other put skip edit
('Invalid return code = ', rc) (a,f(2));
end;
call pliretc(rc);
e15x: proc returns( char(80) varying );
dcl infield char(80) var;
on endfile(sysin) begin;
put skip(3) edit('End of sort program input. ',
'Sortout output should follow') (a);
call pliretc(8);
goto ende15;
end;
get file(sysin) edit(infield) (l);
put skip edit( infield ) (a);
call pliretc(12);
return(infield);
ende15:
end e15x;
e35x: proc ( inrec );
dcl inrec char(*);
put skip edit(inrec) (a);
call pliretc(4);
end e35x;
end ex110;