Tom Longfellow wrote:
> I originally wrote a REXX exec to perform this function, but I am hoping
> that some combination of all of the new SORT verbs will help me improve
the
> performance of my original solution.   I have tried working out something
> by reading the manuals, but I just can not put it together.  Either the
> function is not there, or I am not seeing it.
>
> What I have is one input file with two record types.   RECT1 may appear
> alone or with one or more RECT2.  For each RECT2, I want to output a
record
> that contains all of RECT2 with some of the characters from RECT1.
RECT1
> and RECT2 have a 'key' type value but the 'relationship' between the
> records is solely positional.
>
> Here is the example
>
> (input)
> RECT1-somestuff-VAL1
> RECT1-somestuff-VAL2
> RECT2-otherstuff1
> RECT1-somestuff-VAL3
> RECT2-otherstuff2
> RECT2-otherstuff3
> RECT1-somestuff-VAL4
> RECT2-otherstuff4
> RECT1-somestuff-VAL5
>
> (output)
> RECT2-otherstuff1-VAL2
> RECT2-otherstuff2-VAL3
> RECT2-otherstuff3-VAL3
> RECT2-otherstuff4-VAL4
>
> I looked at OVERLAY, but the location of the data in RECT1 would destroy
> data in RECT2.
> Right now I am stuck in a logcially dilemma where I want to 'remember' a
> value across records but can find no utility to do it.
> Even a multipass SORT solution would be faster than my REXX solution.
>
> Any Ideas?

Tom,

Here's a DFSORT/ICETOOL job that will do what you asked for.

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/40)
//OUT DD DSN=...  output file (FB/40)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(41,8,ZD) -
  WITHALL WITH(1,17) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(41:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,5,CH,EQ,C'RECT1'),
                BUILD=(1,5,18:16,5,41:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(49:SEQNUM,8,ZD,
                         41:41,8,ZD,SUB,49,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=OUT,BUILD=(1,40)
/*

I used the "group" trick discussed in the "Include or omit groups of
records" and "Sort groups of records" Smart DFSORT Tricks at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/

Note:  Although you posted last Friday, I didn't see your post until today
and only found it through google groups search.  I guess you posted it to
the newsgroup rather than the mailing list, but I don't even see it on the
newsgroup when I use google groups for bit.listserv.ibm-main.  In the
future, it would be better to post to the mailing list rather than to the
newsgroup.  Mailing list posts go to the newsgroup, but not vice versa.

Frank Yaeger - DFSORT Team (IBM) - [EMAIL PROTECTED]
Specialties: PARSE, JFY, SQZ, ICETOOL, IFTHEN, OVERLAY, 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: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to