IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Populate a filed in other records basing on key


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sonys
Currently Banned

New User


Joined: 16 Nov 2006
Posts: 3

PostPosted: Thu Feb 01, 2007 6:12 pm
Reply with quote

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
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Feb 01, 2007 10:06 pm
Reply with quote

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)
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top