|
View previous topic :: View next topic
|
| Author |
Message |
Steynek
New User
Joined: 02 Jan 2008 Posts: 4 Location: PHX, AZ
|
|
|
|
Hi,
I want to match records across to data files using a key from a "master" file. This is something SPLICE can do??
Example:
IFILE1
20081012
IFILE2
005CLIENTACCESS0015020081012012333
006CLIENTACCESS0015020081012012333
007CLIENTACCESS0015020081012012333
....
So, reading IFILE1 matching all records on the date value with IFILE2 and writing them to my output file.
Thanks!!!
Erik |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Well, yes you could do it with SPLICE. But if you only have one record in file1, it would be easier to do it with DFSORT symbols like this:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file1
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
* Generate a DFSORT Symbol as follows:
* TARG,'yyyymmdd'
* where yyyymmdd is from input file1
INREC BUILD=(C'TARG,''',1,8,C'''',80:X)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file2
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
* Use TARG symbol in INCLUDE statement
INCLUDE COND=(21,8,CH,EQ,TARG)
/*
|
If your situation is actually more complicated than that, then show a better example of the records in each input file and what you expect for output. Also, give the RECFM and LRECL of each input file. |
|
| Back to top |
|
 |
Steynek
New User
Joined: 02 Jan 2008 Posts: 4 Location: PHX, AZ
|
|
|
|
Thanks for the quick response Frank.
Actually our example is a little more convoluted than the example that was included in the original posting.
Input File 1 is FB 80 and contains several records that are prefixed with a date value:
20000101Adam Ant’
20000102Mary Sue
20010101John Allen
Input File 2 is also FB 80 and contains multiple records that have the same date values, but multiples, and in different position:
Manager120000101salarycap100,000
Manager220000101salarycap110,000
…..etc…
The date values in file 1 is distinct, whilst the records in file 2 can occur multiple times for each date. So our results should look something like this:
20000101Adam Ant’ Manager1salarycap100,000
20000101Adam Ant’ Manager2salarycap110,000
Etc.
Hope this makes sense!!
Regards
Erik |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
It's not completely clear to me what you want. I'd like a better example so I don't waste time on something that doesn't give you what you want.
It appears the output records should contain the date, the field after the date from file1 and the fields before and after the date from file2. Is that right?
You said you wanted matching records, but you only show matching records for file2 in your example so I'm not sure that's what you actually want.
Please show a better example (all variations - relevant fields only) of the records in each input file and what you want for output. Show matching records and non-matching records. Show all of the output records you expect.
Also, please indicate the starting position, length and format of all relevant fields in the input records and output records. |
|
| Back to top |
|
 |
sundarmohan
New User
Joined: 12 Feb 2008 Posts: 1 Location: bangalore
|
|
|
|
hi Frank Yaeger,
my input file datatype is comp 3. it is not working.
above jcl is not working
can please guide me? |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello sanmoh and welcome to the forum,
You need to post the actual jcl and control statements you submitted as well as the diagnostic information provided by the execution.
Showing some sample input and the expected output will also help. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If your yyyymmdd value is comp-3 it's a 5-byte PD field. For that you need to use a +yyyymmdd constant rather than a 'yyyymmdd' constant. Here's a DFSORT job that will generate a +yyyymmdd constant. I assumed your PD field starts at position 21. Adjust as needed.
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file1
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
* Generate a DFSORT Symbol as follows:
* TARG,+yyyymmdd
* where yyyymmdd is from input file1
INREC BUILD=(C'TARG,+',1,8,80:X)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file2
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
* Use TARG symbol in INCLUDE statement
INCLUDE COND=(21,5,PD,EQ,TARG)
/*
|
|
|
| Back to top |
|
 |
pravinj
New User

Joined: 10 Jun 2008 Posts: 24 Location: india
|
|
|
|
I have a slightly different requirement here.
Control file will be having a single record with 6 values at defined positions. I need to split the input file into 6 files based on the control file record values. Share some thoughts on this?
Example:
| Code: |
Control file:
0----5----0----5----0
F A B C DE
|
|
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
What should the output be when that control file is input?
Mention the lrecl and dsorg of the files.
Explain the "rules" for processing. |
|
| Back to top |
|
 |
pravinj
New User

Joined: 10 Jun 2008 Posts: 24 Location: india
|
|
|
|
My requirement is to split an input file into 3 files where the value for the split will be coming from an input file.
DSORG: FB
LRECL : 080
Say INPUT FILE
1
2
2
3
3
4
//multiple records//
Say control file
124
//the above values will be in a single record //
So the output file #1 should have:
1
#2:
2
2
#3:
4 |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT/ICETOOL job like the following to do what I think you're asking for.
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
1
2
2
3
3
4
//CT DD *
124
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//OUT3 DD SYSOUT=*
//TOOLIN DD *
COPY FROM(CT) USING(CTL1)
COPY JKFROM USING(CTL2)
//CTL1CNTL DD *
OUTFIL FNAMES=T1,
BUILD=(1,1,C'1',/,2,1,C'2',/,3,1,C'3')
//CTL2CNTL DD *
JOINKEYS F1=IN,FIELDS=(1,1,A)
JOINKEYS F2=T1,FIELDS=(1,1,A)
REFORMAT FIELDS=(F1:1,80,F2:2,1)
OPTION COPY
OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,80)
OUTFIL FNAMES=OUT3,INCLUDE=(81,1,CH,EQ,C'3'),BUILD=(1,80)
/*
|
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|