VERIFIED SOLUTION i

How to use Generailized Selection Plus and Merge/Purge Plus to generate a string for shipping purchases

various platforms
A user had a file that he first brings into Merge/Purge Plus (MPP).  The file has one or more records for each customer, and the records all have a code in the same position to indicate what book the customer ordered.  We'll say position 61 of the records.   The code was the letters A, B, C, D, E, F, or G.  Each letter was for a different book title the customer purchased. 

So for example, in the input file a certain customer may have only one record, because they ordered only one book.  Say book C.
Another customer may have 4 records because they ordered books A, C, D, and G.  Each of the four records for this customer had one of the letters in position 61.
  
The initial step in the process was to use MPP to separate the records into two output files.  One output file had all the records where there was only one record for a customer (because they had only ordered one book.)
The second output file contained all the records for customers that ordered more than one book.

The above step was done using MPP and a SUROPT parameter with an E in position 8, which tells MPP to write all records to one of two output files, based on whether they are part of a dup group or not. 

Then, the user wanted to do something special with the file containing records for people that ordered more than one book.
He wanted to combine the multiple records for each customer into one record that would indicate by letter and position what each customer had ordered.
If a customer had ordered four books (A, C, D, and G) there would be four records as mentioned above.  The user wanted a string 
"A CD  G" in the output record
Or if a customer had wanted all of the books except E, the string would be      
"ABCD FG".

This had to be done in two steps, one a Generalized Selection Plus job to move the values to the correct output location, and the second step a second MPP job to merge the separate records into one record.

This is an example input file to GSP in the test (the Dup Groups output from your first MPP job, with the codes in position 61)
CU1       12345     123 main st                             A
CU1       12345     123 main st                             C
CU1       12345     123 main st                             D
CU1       12345     123 main st                             G
CU2       12345     123 main st                             E
CU2       12345     123 main st                             F
CU3       12345     123 main st                             B
CU3       12345     123 main st                             F
CU3       12345     123 main st                             A

The first three bytes are the duplicate group ID codes for the customer, so the four CU1 records were to customer 1 who ordered books A, C, D, and G.   CU2 wants E and F.  CU3 wants B, F, and A.
(The 12345 in 011 is just for a ZIP Code, and a fake address starting in 021.)

Below are the important parms in the GSP job.  In fact, except for a MATCHI 001 03, SEQERR C, and ZIPIN  011 C, they are *all* the parms needed in the test GSP job.  But an actual GSP job may have additional parms.
The parms move the values from 061 into 071 thru 077 based on whether 061 has an A, B, etc, thru G.  071 thru 077 will have the final 'string' of purchases made by a customer.
(You have to use a separate location for the final string, it cannot start in 061.  If 061 were used as the start for the final string, it would result in records getting values in 061 when they should not have one.)

JOBBGN
MOVEIT 01                     AN                  Move book codes
MOVEIT 02                    (EQ N0061001-A                    AND
MOVEIT 02                     MV N0071001-A                   )OR
MOVEIT 02                    (EQ N0061001-B                    AND
MOVEIT 02                     MV N0072001-B                   )OR
MOVEIT 02                    (EQ N0061001-C                    AND
MOVEIT 02                     MV N0073001-C                   )OR
MOVEIT 02                    (EQ N0061001-D                    AND
MOVEIT 02                     MV N0074001-D                   )OR
MOVEIT 02                    (EQ N0061001-E                    AND
MOVEIT 02                     MV N0075001-E                   )OR
MOVEIT 02                    (EQ N0061001-F                    AND
MOVEIT 02                     MV N0076001-F                   )OR
MOVEIT 02                    (EQ N0061001-G                    AND
MOVEIT 02                     MV N0077001-G                   )
JOBEND


This is the output file from GSP
AAA       12345     123 main st                             A         A
AAA       12345     123 main st                             C           C
AAA       12345     123 main st                             D            D
AAA       12345     123 main st                             G               G
BBB       12345     123 main st                             E             E
BBB       12345     123 main st                             F              F
CCC       12345     123 main st                             B          B
CCC       12345     123 main st                             F              F
CCC       12345     123 main st                             A         A


Now that file has to go into a second MPP job to merge the records together for each customer dup group.  Here are the important POSTs that copy the codes into the surviving record for each group. 
 
POST01 M               071 01                 071 01
POST02 M               072 01                 072 01
POST03 M               073 01                 073 01
POST04 M               074 01                 074 01
POST05 M               075 01                 075 01
POST06 M               076 01                 076 01
POST07 M               077 01                 077 01


Other parameters will be needed as in any normal MPP job.  Here is the full parameters in the MPP test job, but they'll vary based on a user's particular job.
ADDRDF M 021 20                                    X
ALGSEL ADDR M
*BRKLEN test id codes are 3 bytes in 1 to 3
BRKLEN 3
KEYLEN 0
BRKFLD 01
DUPCTL 080 082 084
FILEDF MPPINA   L 0200
FILEDF MPPDUPS  L 0200
FILEDF MPPEXTRA L 0200
FILEDF MPPMAIL  L 0200
FLC100 A
FLC200 B
FLC200 C
FLC200 D
FLC200 E
FLC200 F
FLC200 G
FLCODE C 061 1
*test id codes are 3 bytes in 1 to 3
MERGES 001 03
NAMEDF 001 20
PRIORT
SEQERR E
SUROPT N
*test job POST parms below
POST01 M               071 01                 071 01
POST02 M               072 01                 072 01
POST03 M               073 01                 073 01
POST04 M               074 01                 074 01
POST05 M               075 01                 075 01
POST06 M               076 01                 076 01
POST07 M               077 01                 077 01
ULRECL 200
*test job ZIP Codes are in 011
ZPCODE M 011 05


The final output file from the second MPP job looked like this.  Ignore the value in 061, the resulting string to be used is in 071-077
CU1       12345     123 main st                             A         A CD  G
CU2       12345     123 main st                             E             EF
CU3       12345     123 main st                             A         AB   F
UPDATED:  December 22, 2017