|
View previous topic :: View next topic
|
| Author |
Message |
Ramanan-R
New User

Joined: 21 Mar 2007 Posts: 66 Location: Chennai, Tamilnadu, India
|
|
|
|
Hi All,
I have two files of LRECL=80 with records as below,
Stucture of both the files:
Columns 1 to 9 - Constant literals (Wild card & All value)
Column 10 - Blank
Columns 11 to 18 - Value 1
Column 19 - Blank
Column 20 to 21 - Value 2
Column 22 - Blank
Column 23 to 80 - Value 3
| Code: |
File 1 records:
Wild card AAAA**** M 19960801
Wild card MMMMM*** X 19960707
File 2 records:
All value AAAA123 L1 19980203
All value AAAA222 K1 19980203
All value KKKK555 M2 19990105
|
The output file should contain records as below,
| Code: |
Wild card AAAA123 M 19960801
Wild card AAAA222 M 19960801
Wild card MMMMM*** X 19960707
Wild card KKKK555 M2 19990105
|
The following are the possible cases,
Case 1:
If expanded value of wildcard is found in File 2 then the output file should have all possible values of Value 1( E.g., for AAAA*** possible values are AAAA123 and AAAA222) with constant literal, Value 2 & Value 3 from file 1.
Case 2:
If no expanded value of wildcard is found in File 2 then write that File 2 record to output (E.g, Pls see output record 3)
Case 3:
If Value 1 of File 2 doesn't match with any of the Value 1 of File 1 then write the record of File 2 to output with first 10 bytes constant literal from File 1 (E.g, Pls see output record 4)
Can we achieve above result using DFSORT/ICETOOL?
Thanks,
Ramanan R |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You haven't given enough information about the possible "wildcard" (*)variations.
Can only value1 have *s?
Are the *s always the last three characters of value1 or can they be the last n characters, e.g. A*******, AA******, etc, or anywhere, e.g. A*B*C*D*? Can a value1 not have any wildcards, e.g. AAAAAAAA? Can a value1 have blanks?
It would help if you'd give a more extensive example with more of the possible variations. |
|
| Back to top |
|
 |
Ramanan-R
New User

Joined: 21 Mar 2007 Posts: 66 Location: Chennai, Tamilnadu, India
|
|
|
|
Frank,
1. Can only value1 have *s?
Yes, only Value1 can have *s.
2. Are the *s always the last three characters of value1?
In my file, the last three characters of all Value1 are *s but it would be better to take all characters of Value1 before *s and check against File2.
i.e like A*******, AA******.
3. Can *s be found anywhere, e.g. A*B*C*D*?
No *s can only be found at the end of wildcard i.e cannot be like A*B*C*D*
4. Can a value1 not have any wildcards?
Ya, Value1 can also be without wildcards like AAAAAAAA. In that case this record needs to be written in outfile.
5. Can a value1 have blanks?
No Value1 cannot have blanks
Please find the below example with all possible cases.
File 1:
Wild card AAAA**** M 19960801
Wild card MMM***** X 19960707
Wild card LL****** X 19960909
Wild card PPPPPPPP Q 19960405
File 2 records:
All value AAAA123 L1 19980203
All value AAAA222 K1 19980203
All value LLAA222 P1 19970506
All value KKKK555 M2 19990105
Then the outfile should have
Wild card AAAA123 M 19960801
Wild card AAAA222 M 19960801
Wild card MMM***** X 19960707
Wild card LLAA222 X 19960909
Wild card PPPPPPPP Q 19960405
Wild card KKKK555 M2 19990105
Please let me know, if you need more explanation,
Thanks,
Ramanan R |
|
| 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 give the output records you asked for (it's not clear to me what order you want the output records in - it seems to be some strange combination of the order of the records in fileA and the records in fileB).
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
Wild card AAAA**** M 19960801
Wild card MMM***** X 19960707
Wild card LL****** X 19960909
Wild card PPPPPPPP Q 19960405
/*
//IN2 DD *
All value AAAA123 L1 19980203
All value AAAA222 K1 19980203
All value LLAA222 P1 19970506
All value KKKK555 M2 19990105
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T3 DD DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (FB/80)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(81,8,CH) KEEPNODUPS -
WITHALL WITH(11,8) WITH(98,9)
SELECT FROM(T2) TO(OUT) ON(99,8,ZD) FIRST USING(CTL3)
/*
//CTL1CNTL DD *
INREC PARSE=(%01=(ABSPOS=11,ENDBEFR=C'*',FIXLEN=8)),
OVERLAY=(81:%01,89:SEQNUM,8,ZD,97:C'BB',99:C'1',SEQNUM,7,ZD)
/*
//CTL2CNTL DD *
INREC OVERLAY=(97:C'VV',99:SEQNUM,8,ZD)
OUTFIL FNAMES=T1,
BUILD=(1,80,81:11,1,97:97,10,/,
1,80,81:11,2,97:97,10,/,
1,80,81:11,3,97:97,10,/,
1,80,81:11,4,97:97,10,/,
1,80,81:11,5,97:97,10,/,
1,80,81:11,6,97:97,10,/,
1,80,81:11,7,97:97,10,/,
1,80,81:11,8,97:97,10)
/*
//CTL3CNTL DD *
SORT FIELDS=(99,8,ZD,A,97,2,CH,A)
OUTFIL FNAMES=OUT,BUILD=(1,80)
/*
|
OUT will have:
| Code: |
Wild card AAAA123 M 19960801
Wild card AAAA222 M 19960801
Wild card LLAA222 X 19960909
All value KKKK555 M2 19990105
Wild card MMM***** X 19960707
Wild card PPPPPPPP Q 19960405
|
|
|
| Back to top |
|
 |
Ramanan-R
New User

Joined: 21 Mar 2007 Posts: 66 Location: Chennai, Tamilnadu, India
|
|
|
|
Fantastic Frank ,
The output is fine except , the order of output records is from FileA (Input1) then from FileB(Input2) and all output records should have first 10 characters with constant literal 'Wild Card'.
Once again, thanks a lot Frank,
Regards,
Ramanan R |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
| the order of output records is from FileA (Input1) then from FileB(Input2) and all output records should have first 10 characters with constant literal 'Wild Card'. |
Do you need me to show you how to do that or can you figure it out yourself? |
|
| Back to top |
|
 |
Ramanan-R
New User

Joined: 21 Mar 2007 Posts: 66 Location: Chennai, Tamilnadu, India
|
|
|
|
Frank,
Thanks for your help, i will do it myself.
Regards,
Ramanan R |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
That's what I like to hear.  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|