Joined: 14 Jun 2006 Posts: 331 Location: Jacksonville, FL
I need to SPLICE the following. Input and output are FB,50,27950.
Code:
----+----1----+----2----+----3----+----4----+----5
DFLTGRP1 XX4567 JOHN ADAMS W
DFLTGRP1 XX9876 JEREMY BENDER A
DFLTGRP1 XX9876 JEREMY BENDER B
DFLTGRP1 XX9876 JEREMY BENDER C
DFLTGRP1 XX9876 JEREMY BENDER F
DFLTGRP1 XX9876 JEREMY BENDER L
DFLTGRP1 XX9876 JEREMY BENDER N
DFLTGRP1 XX9876 JEREMY BENDER R
DFLTGRP1 XX9876 JEREMY BENDER T
DFLTGRP1 XX9876 JEREMY BENDER U
DFLTGRP1 XX9876 JEREMY BENDER W
DFLTGRP2 XX1234 JED CLAMPETT A
DFLTGRP2 XX1234 JED CLAMPETT B
DFLTGRP2 XX1234 JED CLAMPETT F
DFLTGRP2 XX1234 JED CLAMPETT L
DFLTGRP2 XX1234 JED CLAMPETT R
DFLTGRP2 XX1234 JED CLAMPETT T
DFLTGRP2 XX1234 JED CLAMPETT U
The output should look like:
Code:
----+----1----+----2----+----3----+----4----+----5
DFLTGRP1 XX4567 JOHN ADAMS W
DFLTGRP1 XX9876 JEREMY BENDER ABCFLNRTUW
DFLTGRP2 XX1234 JED CLAMPETT AB FL RTU
Positions 1 through 40 are fixed. Positions 41 through 50 have at least one letter and the rest are blank. You can have individual records that do not match any other records in positions 1 - 40 and they should be kept.
I have tried many combinations using WITHALL and NOKEEPDUPS, but my attempts have not produce the desired results (all records matching positions 1 through 40 rolling up to a single record with positions 41-50 left intact.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Cpuhawg,
Here is a DFSORT JCL which would give you the desired results. We can use the traditional Binary sum trick to get the desired results.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
DFLTGRP1 XX4567 JOHN ADAMS W
DFLTGRP1 XX9876 JEREMY BENDER A
DFLTGRP1 XX9876 JEREMY BENDER B
DFLTGRP1 XX9876 JEREMY BENDER C
DFLTGRP1 XX9876 JEREMY BENDER F
DFLTGRP1 XX9876 JEREMY BENDER L
DFLTGRP1 XX9876 JEREMY BENDER N
DFLTGRP1 XX9876 JEREMY BENDER R
DFLTGRP1 XX9876 JEREMY BENDER T
DFLTGRP1 XX9876 JEREMY BENDER U
DFLTGRP1 XX9876 JEREMY BENDER W
DFLTGRP2 XX1234 JED CLAMPETT A
DFLTGRP2 XX1234 JED CLAMPETT B
DFLTGRP2 XX1234 JED CLAMPETT F
DFLTGRP2 XX1234 JED CLAMPETT L
DFLTGRP2 XX1234 JED CLAMPETT R
DFLTGRP2 XX1234 JED CLAMPETT T
DFLTGRP2 XX1234 JED CLAMPETT U
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=(41,1,CH,EQ,C' '),
OVERLAY=(41:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(42,1,CH,EQ,C' '),
OVERLAY=(42:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(43,1,CH,EQ,C' '),
OVERLAY=(43:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(44,1,CH,EQ,C' '),
OVERLAY=(44:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(45,1,CH,EQ,C' '),
OVERLAY=(45:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(46,1,CH,EQ,C' '),
OVERLAY=(46:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(47,1,CH,EQ,C' '),
OVERLAY=(47:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(48,1,CH,EQ,C' '),
OVERLAY=(48:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(49,1,CH,EQ,C' '),
OVERLAY=(49:X'00'),HIT=NEXT),
IFTHEN=(WHEN=(50,1,CH,EQ,C' '),
OVERLAY=(50:X'00'))
SORT FIELDS=(01,15,CH,A)
SUM FIELDS=(41,8,BI,49,2,BI)
Joined: 14 Jun 2006 Posts: 331 Location: Jacksonville, FL
Thank you very much. The code is much more straight forward than the previous solution. I had a similiar task of combining fields that were one position separated by a delimiter (X'05') and although it worked, I had to clean up the delimited fields (using ISPF edit) after all the records were combined. They had been overlayed by characters other than X'05'.
The new option will make combining records by a key field much easier.
I appreciate the update. I am finding the ICETOOL program invaluable and much easier than writing a REXX program to do these types of tasks.