I did something like this a while back in order to convert a SAP database that was downloaded to z/OS. The SAP record was very wide with a repeating occurence of a known value. I wanted to convert this to a fixed block sequential disk dataset.
What I did was parse left to right looking for (in the case below, the string 'USR') a value, which when found, was written to a separate output file. I ended up with a series of SORTOUTs, one for each occurrence of 'USR' (for example). The second pass was to merge the outputs. Not very elegant but the price was right. -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Frank Yaeger Sent: Tuesday, January 31, 2012 12:52 PM To: [email protected] Subject: Re: Split records using SORT Ken MacKenzie at IBM Mainframe Discussion List <[email protected]> wrote on 01/31/2012 05:56:43 AM: > I wonder if anyone knows if I can achieve the following in SORT. I've > already done it in REXX but I think SORT may be more efficient since my > input file has 92 records resulting in more than 30,000 records. > > Each record is fixed (lrecl=8906) and is built as follows: > > 1-2 2-byte binary length > 3-4 2-byte filler contains '00'x > 5-11 Userid > 12 Space > 13-? Username > > This is then repeated across the record until we encounter a length of > zero. > > So a record containing 3 names (in reality they contain hundreds) would > look like this: > ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+ > USR0001 FRED.SMITHY USR0002 JEFFREY.SNOTRAG USR0003 JOE.SCHMO > 0100EEDFFFF4CDCC4EDCECE0100EEDFFFF4DCCCDCE4EDDEDCC0100EEDFFFF4DDC4ECCDD0000 > 0700429000106954B2493880B00429000201566958B2563917050042900030165B238460000 > > > I want to split the above into 3 records (presumably using RECM=VB): > ----+----1----+---- > USR0001 FRED.SMITHY > EEDFFFF4CDCC4EDCECE > 429000106954B249388 > > ----+----1----+----2--- > USR0002 JEFFREY.SNOTRAG > EEDFFFF4DCCCDCE4EDDEDCC > 429000201566958B2563917 > > ----+----1----+-- > USR0003 JOE.SCHMO > EEDFFFF4DDC4ECCDD > 42900030165B23846 SORT doesn't have any built-in functions to handle individual length/field information. Of course, you could write an E15 or E35 exit with the appropriate logic to do what you want and it might be more efficient than the REXX solution. Frank Yaeger - DFSORT Development Team (IBM) - [email protected] Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN

