Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Populate a filed in other records basing on key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Populate a filed in other records basing on key
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 Moderator


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

PostPosted: Thu Feb 01, 2007 10:06 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us