Sonys Currently Banned New User
Joined: 16 Nov 2006 Posts: 3
|
|
|
|
Hi all,
I have a flat file with following attributes. My requirement is to repeat a particular field (CODE - for layout refer below) available in one of the record basing on key value.
Lrecl = 80; recfm=FB
File Layout:
Key pic x(12)
filler pic x
alpha pic x(03)
filler pic x
date pic 9(6) in yymmdd format
filler pic x
total pic 9(11)V99
filler pic x
code pic x(7)
IP Sample data:
Code: |
123705849CMT CMB 021016 000000136.93
123705849CMT CMB 021016 000000136.93
123705849CMT CMB 021016 000000136.93 JE3 4D
123747225CMT CMW 030306 000000123.75
123747225CMT CMW 030306 000000123.75
123747225CMT CMW 030306 000000123.75
123747225CMT CMW 030306 000000123.75
123747225CMT CMW 030306 000000123.75 JE2 3L
123779237CCI CEL 030615 000000401.85 GY1 1Q
|
Out file should look like
123705849CMT CMB 021016 000000136.93 JE3 4D
123705849CMT CMB 021016 000000136.93 JE3 4D
123705849CMT CMB 021016 000000136.93 JE3 4D
--------------- end of key 1 -------------
123747225CMT CMW 030306 000000123.75 JE2 3L
123747225CMT CMW 030306 000000123.75 JE2 3L
123747225CMT CMW 030306 000000123.75 JE2 3L
123747225CMT CMW 030306 000000123.75 JE2 3L
123747225CMT CMW 030306 000000123.75 JE2 3L
-------- end of key 2----------------
123779237CCI CEL 030615 000000401.85 GY1 1Q
---------- end of key 3----------
and so on so forth
Note: As of now, filelds marked in red colour of output file was getting printed and blue colour is the one which I want to repeat basing on a key.
Regards,
Latha |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed the "code" value you want to propagate is in the last record with each key as shown in your example.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/44)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
// DD DSN=*.IN,VOL=REF=*.IN,DISP=(OLD,PASS)
//OUT DD DSN=... output file (FB/44)
//TOOLIN DD *
SELECT FROM(IN) TO(T1) ON(1,12,CH) LAST
SPLICE FROM(CON) TO(OUT) ON(1,12,CH) -
WITHALL WITH(1,37)
/*
|
|
|