View previous topic :: View next topic
|
Author |
Message |
arnab
New User
Joined: 13 Mar 2006 Posts: 59 Location: UK
|
|
|
|
Hi,
I want to update the field of a file (I know the field positions) with the values from another field in another file using JCL . I dont want to use a program.
I know how to update in a static manner..i.e using OUTREC and CHANGE but how to do it dynamically.
Please let me know .
Thanks , |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You need to post some sample input data and what you want for output from the sample input data. You also need to post whether the input is fixed or variable and the lrecl(s). You know the "field positions" but no one here does. . . They need to be posted as well. |
|
Back to top |
|
|
arnab
New User
Joined: 13 Mar 2006 Posts: 59 Location: UK
|
|
|
|
hi,
The file is Fixed and of LRECL 80.
Sample data:
1st file:
1192873 CMS
1123849 EXP
1132456 EXP
1143240 HRS
2nd file:
1192873 ALB
1123849 EXP
1132456 FIL
Expected o/p:
1192873 ALB
1123849 EXP
1132456 FIL
1143240 HRS
The remaining data in the files are different and the o/p should contain data that of FILE1 and not of FILE2.
Let me know if this explains the problem and if you need something more.
Thanks.. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Your example leaves a lot of questions unanswered. It would help if you'd explain the "rules" for getting from input to output so we don't have to guess.
Do you want to update the fields based on the key in positions 1-7 (1192873 in file1 and 1192873 in file2) or based on the relative record number (record 1 in file1 and record1 in file2)?
Do you want the output records in the original order of the file1 records, or can the output records be in key order?
Can there be records in file2 that are not in file1? If so, what do you want to do with those records? |
|
Back to top |
|
|
arnab
New User
Joined: 13 Mar 2006 Posts: 59 Location: UK
|
|
|
|
I want to update based on the key positions..and there can be records in the second file which are not in the first file. In that case we have to omiy those in the final o/p.
the order of the o/p ecords is of no concern to me. |
|
Back to top |
|
|
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:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/80)
//IN2 DD DSN=... input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/80)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,7,CH) KEEPNODUPS -
WITH(81,1) USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'BB')
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'VV')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,OMIT=(81,2,CH,EQ,C'BB'),
BUILD=(1,80)
/*
|
|
|
Back to top |
|
|
arnab
New User
Joined: 13 Mar 2006 Posts: 59 Location: UK
|
|
|
|
Thanks a lot Frank. I got the expected result using the code. |
|
Back to top |
|
|
|