chinnielr
New User
Joined: 11 Jul 2005 Posts: 87
|
|
|
|
I have two files A and B
FileA Contains ID X(5), DEPT X(20) as field names.
FileB Contains ID X(5), Name X(20) and Revenue S9(7)V9(2) comp-3 as filed names
Lets say
FileA
======
Code: |
ID DEPT
12345 Marketing
23415 Finance
|
File B
=====
Code: |
ID Name Revenue
12345 Rohan 12345.50
111345 Rakesh 24567.70
23415 Frank 123956.60
|
I want my output file FIleC as belows:
Code: |
DEPT Revenue
Marketing 12345.50
Finance 123956.60
|
Can this be done using DFSORT?
Thanks in advance,
Chinni. |
|
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. However, I suspect the example you showed does not fully describe what you want.
You only show one ID associated with Marketing and one ID associated with Finance. Are there really multiple IDs associated with each and if so, do you want totals or what? I also assumed that you wanted the output Revenue field as a PD value rather than as a displayable value. Is that the case?
If there is more to what you want, please show me a more complete example of the input and output records and explain more clearly what you want.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/25)
//IN2 DD DSN=... input file2 (FB/30)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/25)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(26,5,CH) -
WITH(21,5) USING(CTL3)
/*
//CTL1CNTL DD *
INREC BUILD=(1:6,20,26:1,5)
/*
//CTL2CNTL DD *
INREC BUILD=(21:26,5,26:1,5)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(1,25)
/*
|
|
|