Re: Combining Fields From Files Without COBOL Pgm?

docdwarf_at_panix.com
Date: 07/15/04


Date: 14 Jul 2004 19:57:21 -0400

In article <40F58E3D.70309@us.ibm.com>,
Frank Yaeger <yaeger@us.ibm.com> wrote:
>docdwarf@panix.com wrote:

[snip]

>> Given the situation and tools outlined - no SAS, no REXX or CLIST
>> (knowledge of those tools on this site is minimal and their use is
>> actively discouraged) - might anyone have an idea how to go about this or
>> am I doomed to putting into Prod a program which consists, at its heart,
>> of something akin to
>>
>> READ FILE1 INTO WK-FILE1-REC.
>> READ FILE2 INTO WK-FILE2-REC.
>> IF WK-FILE1-SSN = WK-FILE2-SSN
>> MOVE WK-FILE1-REC TO WK-FILE3-MAIN-CHUNK
>> MOVE WK-FILE2-POS-349 TO WK-FILE3-POS-241
>> WRITE FILE3-REC FROM WK-FILE3-REC
>> END-IF.
>>
>> ... ?
>
>DD,
>
>You said you have DFSORT, so here's a DFSORT/ICETOOL job that will do
>what you want using the SPLICE operator. For complete information on
>SPLICE, see:
>
>http://www.storage.ibm.com/software/sort/mvs/uq90053/online/srtmutol.html#spl
>
>//S1 EXEC PGM=ICETOOL
>//TOOLMSG DD SYSOUT=*
>//DFSMSG DD SYSOUT=*
>//IN1 DD DSN=... FB/240 input file
>//IN2 DD DSN=... FB/480 input file
>//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
>//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
>//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
>// DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)
>//OUT DD DSN=... FB/241 output file
>//TOOLIN DD *
>* IN1->T1: copy records and add blank in position 241
> COPY FROM(IN1) TO(T1) USING(CTL1)
>* IN2->T2: copy key and add byte from 349 in position 241
> COPY FROM(IN2) TO(T2) USING(CTL2)
>* T1/T2->OUT: Splice on key to add byte from 349 at
>* position 241
> SPLICE FROM(CON) TO(OUT) ON(2,9,CH) WITH(241,1)
>/*
>//CTL1CNTL DD *
> OUTREC FIELDS=(1,240,241:X)
>/*
>//CTL2CNTL DD *
> OUTREC FIELDS=(2:2,9,241:349,1)
>/*
>

Reproduced in its entirety, Mr Yaeger, because... well, because it
deserves to be. An exquisite and elegant solution for which I am both
thankful and grateful.

DD



Relevant Pages