HP 3000 Manuals

Application ##2 [ HP RPG/XL Utilities-Part 1 XSORT ] MPE/iX 5.0 Documentation


HP RPG/XL Utilities-Part 1 XSORT

Application #2 

This application shows how multiple sections and sets may be applied in a
sort.  Again, the comments are used to earmark the records and the
specifications for the results of the sort.

To help you understand the way Record Types, Sections, and Sets are
related refer to Figure 8-1.

	       Click here to view figure.
          Figure 8-1.  Relating Record Types, Sections, and Sets 

The specifications for the sort are supplied by the file designated
TSTSPECB.

     HSORTR    13A         OX   80       EXAMPLE USING MIXED SECTIONS & SETS.
     S Y      75                           OVERLAY EXISTING OUTPUT; 75 RECS MAX
     I*
     I C       6EQCX                     SECTION-A, TYPE 1
     IAC  23  24LEC50                      (INCLUDE X'S BELOW 50)
     IOC       6EQCY                     SECTION-A, TYPE 2
     IAC  23  24LEC50                      (INCLUDE Y'S BELOW 50)
     IOC       6EQCM                     SECTION-A, TYPE 4
     IAC  23  24LEC50                      (INCLUDE M'S BELOW 50,
     IAC  55  58GTF  51  54                 AND ABOVE LIMIT)
     F*                                  SECTION-A FIELD DESCRIPTIONS:
     FNC   2   5                           SORT BY ITEM#, AND
     FNC       1                             CLASS
     FDV                                   OUTPUT BLANK IN POSITION 1
     FDC   1  71                           OUTPUT DATA (FROM INPUT 1-71)
     O*
     O C       6EQCZ                     SECTION-B, TYPE 3
     OAC  12  13NECCA                      (OMIT Z'S NOT IN CALIFORNIA)
     I                                   SECTION-B, INCLUDE ALL OTHER RECORDS
     F*                                  SECTION-B FIELD DESCRIPTIONS:
     FNC   2   5                           SORT BY ITEM#,
     FNC       1                             CLASS, AND
     FNC  73  80                             LINE#
     FDV         *                         OUTPUT ASTERISK IN POSITION 1
     FDC   1  71                           OUTPUT DATA (FROM INPUT 1-71)
     FDC  73  80                           OUTPUT ORIGINAL LINE#'S

Because this is a multiple file sort, the S Option is used.  The Y
entered in column 8 indicates that you are willing to have the output
file overlay an already existing file.

There are two sections, A and B, set off by the specifications.  Section
A is comprised of three Include Sets, plus control fields and data
fields.  A blank forced in position 1 of the output will "flag" Section
A.

Section B is comprised of an Omit Set, an Include-all Set, and the
control and data fields.  An asterisk forced into position 1 of the
output record "flags" Section B.

This is the input file, designated TSTINB, for the sort.

         Item               #Size Code
          |                     |
     Class|Group  State         |    Description     Limit Cost              Line #
       |  | |      |            |         |              |                       |
       /\/-\/\     /\           /\ /---------------\ /-------\               /------\
       A0001X      CA           01 SECTION-A, TYPE-1  05001021  00001000
       A0113Z      TX           21 SECTION-B, TYPE-3  09000899  00002000
       A9059Z      CA           57 SECTION-B, OTHER   05002001  00003000
       B0001X      TX           60 SECTION-B, OTHER   09000112  00004000
       B0113M      FL           20 SECTION-A, TYPE-4  08000860  00005000
       B9001M      CA           51 SECTION-B, OTHER   05000525  00006000
       B9001M      CA           72 SECTION-B, OTHER             05000501       00007000
       09059Z      FL           01 SECTION-B, TYPE-3            08000801       00008000
       C0001Y      CA           99 SECTION-B, OTHER             05000602       00009000
       C0113Z      NY           20 SECTION-B, TYPE-3            02503000       00010000
       C9001M      CA           99 SECTION-B, OTHER             05009999       00011000
       C9001Y      OR           17 SECTION-A, TYPE-2            06000250       00012000
       C9059Z      CA           10 SECTION-B, OTHER             05000980       00013000
       C9059z      CA           35 SECTION-B, OTHER             05000500       00014000
       C9059Z      CA           87 SECTION-B, OTHER             05000970       00015000
       D0001Y      FL           02 SECTION-A, TYPE-3            08000700       00016000
       D0113M      TX           09 SECTION-B, OTHER             09000850       00017000
       D9059Y      NY           50 SECTION-A, TYPE-2            02502140       00018000
       W9001X      FL           13 SECTION-A, TYPE-1            08000750       00019000
       1-6             12                23  26                                       51      58           73      80 
        Positions 

The record portion designated "description" is used to highlight the
purpose of the sort.  Both sections will be sorted by item and class, and
in Section B line numbers will also be used.

Here is the output file produced by the sort.

         A0001X     CA      01 SECTION-A, TYPE-1        05001021
       * B0001X     TX      60 SECTION-B, OTHER         09000112           00004000
       * C0001Y     CA      99 SECTION-B, OTHER         05000602           00009000
         D0001Y     FL      02 SECTION-A, TYPE-3        08000700
         B0113M     FL      20 SECTION-A, TYPE-4        08000860
       * D0113M     TX      09 SECTION-B, OTHER         09000850           00017000
       * B9001M     CA      51 SECTION-B, OTHER         05000525           00006000
       * B9001M     CA      72 SECTION-B, OTHER         05000501           00007000
         C9001Y     OR      17 SECTION-A, TYPE-2        06000250
       * C9001M     CA      99 SECTION-B, OTHER         05009999           00011000
         W9001X     FL      13 SECTION-A, TYPE-1        08000750
       * A9059Z     CA      57 SECTION-B, OTHER         05002001           00003000
       * C9059Z     CA      10 SECTION-B, OTHER         05000980           00013000
       * C9059Z     CA      35 SECTION-B, OTHER         05000500           00014000
       * C9059Z     CA      87 SECTION-B, OTHER         05000970           00015000
         D9059Y     NY      50 SECTION-A, TYPE-2        02502140


NOTE The file is in order first by item# (output positions 3-6), then by class number (output position 2), and then by line# (positions 73-80) for records in Section B. In addition, Section B records are "flagged" by an asterisk in output position 1 and by the input line# in position 73-80.


MPE/iX 5.0 Documentation