Rational Developer for System z
PL/I for Windows, Version 8.0, Programming Guide

Calling PLISRTC

Figure 39. PLISRTC--Sorting from input data set to output-handling routine
/*******************************************************************/
/*                                                                 */
/*  DESCRIPTION                                                    */
/*    Sorting from an input data set to an output-handling routine */
/*                                                                 */
/*  Use the following statement:                                   */
/*                                                                 */
/*    set dd:sortin=ex108.dat,type(crlf),lrecl(80)                 */
/*                                                                 */
/*******************************************************************/

 ex108:  proc options(main);

     dcl Return_code fixed bin(31,0);

     call plisrtc (' SORT FIELDS=(7,74,CH,A) ',
                  ' RECORD TYPE=F,LENGTH=(80) ',
                  0,
                  Return_code,
                  e35x);
        select(Return_code);
          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 = ', Return_code) (a,f(2));
        end /* Select */;
      /* Set pl/i return code to reflect success of sort       */
     call pliretc (return_code);

 e35x:   /* Output-handling routine prints sorted records      */
       proc (Inrec);
          dcl inrec char(*);
          put skip edit (inrec) (a);
          call pliretc(4); /* Request next record from sort    */
       end e35x;
 end ex108;

Content of EX108.DAT to be used with Figure 39

003329HOOKER S.W. RIVERDALE, SATCHWELL LANE, BACONSFIELD
002886BOOKER R.R. ROTORUA, LINKEDGE LANE, TOBLEY
003077ROOKER & SON, LITTLETON NURSERIES, SHOLTSPAR
059334HOOK E.H. 109 ELMTREE ROAD, GANNET PARK, NORTHAMPTON
073872HOME TAVERN, WESTLEIGH
000931FOREST, IVER, BUCKS

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)