|
|
| Author |
Message |
Hima1985
New User
Joined: 17 Apr 2009 Posts: 49 Location: India
|
|
|
|
Hi All,
please suggest my rewuirement is as below
i have a VB file of length 3504. and a FB file of length 80.
FB file: data is like this
| Code: |
Column A Column B << just for reference
1234567890 1234567899
1234567891 1234567898
1234567892 1234567897
1234567893 1234567896
1234567894 1234567895 |
VBfile date is like this: Key position is 18.
| Code: |
XXXXXXXXXXXXXXXXX1234567890XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567893XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567894XXXXXXXXXXXXXXXXXXX |
I need to replace Keys of VB file with the corresponding Coulmn B value of FB file, My output should be
| Code: |
XXXXXXXXXXXXXXXXX1234567899XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567898XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567897XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567896XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567895XXXXXXXXXXXXXXXXXXX |
can you please suggest if we can achive this with a SORT |
|
| Back to top |
|
 |
References
|
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 5998 Location: San Jose, CA
|
|
|
|
Assuming there's a one-to-one correspondence between the keys in input file1 and the keys in input file2 as shown in your example, 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 (VB/3504)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (VB/3504)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(5,10,CH) WITH(32,10) USING(CTL3)
//CTL1CNTL DD *
INREC BUILD=(1,4,5:22,10,15:5)
/*
//CTL2CNTL DD *
OUTFIL FNAMES=T1,FTOV,BUILD=(1,10,28:12,10)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(1,4,5:15)
/*
|
If there isn't a one-to-one correspondence of keys (e.g. there are keys in file1 that are not in file2, and/or vice versa and/or there are duplicate keys within one of the files), then show a better example of input and output covering all of the possible cases. |
|
| Back to top |
|
 |
Hima1985
New User
Joined: 17 Apr 2009 Posts: 49 Location: India
|
|
|
|
Frank,
Thanks for the reply.....there is only one to one creespondence in FB input file, i mean CoulmnA will contain only one correspondence columnB
Sorry for this i forgot to mention this, Inputfile2 which is VB file can contain duplicate keys
FB file: data is like this
| Code: |
Column A Column B << just for reference
1234567890 1234567899
1234567891 1234567898
1234567892 1234567897
1234567893 1234567896
1234567894 1234567895 |
VBfile date is like this: Key position is 18.
| Code: |
XXXXXXXXXXXXXXXXX1234567890XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567890XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567890XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567890XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567890XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567893XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567893XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567894XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567894XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567894XXXXXXXXXXXXXXXXXXX |
I need to replace Keys of VB file with the corresponding Coulmn B value of FB file, My output should be
| Code: |
XXXXXXXXXXXXXXXXX1234567899XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567899XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567899XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567899XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567899XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567898XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567898XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567898XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567898XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567898XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567897XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567897XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567897XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567897XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567897XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567896XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567896XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567895XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567895XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567895XXXXXXXXXXXXXXXXXXX |
|
|
| Back to top |
|
 |
Hima1985
New User
Joined: 17 Apr 2009 Posts: 49 Location: India
|
|
|
|
Frank,
Here is the final requirement,
FB file: data is like this
| Code: |
Column A Column B << just for reference
1234567890 1234567899
1234567891 1234567898
1234567892 1234567897
1234567893 1234567896
1234567894 1234567895 |
VBfile date is like this: column A of FB file can be any where in VB file, which needs to be replaced by corresponding columnB of FB file.
| Code: |
XXXXXXXXXXXXXXXXX1234567890XXX1234567890XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567890XXX1234567890XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567890XXX1234567890XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXX1234567891XXXXXXX1234567891
XXXXXXXXXXXXXXXXX1234567891XXX1234567891XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXX1234567891XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXX1234567892XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXX1234567892XXXXXXX1234567892
|
I need to replace Keys of VB file with the corresponding Coulmn B value of FB file, My output should be
| Code: |
XXXXXXXXXXXXXXXXX1234567899XXX1234567899XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567899XXX1234567899XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567899XXX1234567899XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567898XXX1234567898XXXXXXX1234567898
XXXXXXXXXXXXXXXXX1234567898XXX1234567898XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567898XXX1234567898XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567897XXX1234567897XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567897XXX1234567897XXXXXXX1234567897
|
|
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 961 Location: San Jose
|
|
|
|
hima1985,
The following DFSORT/ICETOOL JCL will give you the desired results
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+----7-
1234567890 1234567899
1234567891 1234567898
1234567892 1234567897
1234567893 1234567896
1234567894 1234567895
//IN2 DD DSN=Your input vb 3504 file,DISP=SHR
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SORT FROM(T1) USING(CTL3)
//CTL1CNTL DD *
OUTFIL FNAMES=T1,FTOV,BUILD=(12,10,8X,C'$',37:1,10,3519:X)
//CTL2CNTL DD *
OUTFIL FNAMES=T1,BUILD=(1,4,19X,5)
//CTL3CNTL DD *
SORT FIELDS=(41,10,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(15:SEQNUM,8,ZD,RESTART=(41,10))),
IFTHEN=(WHEN=GROUP,BEGIN=(15,8,ZD,EQ,1),PUSH=(5:5,10)),
IFTHEN=(WHEN=(5,10,CH,GT,C' '),OVERLAY=(54:5,10))
OUTFIL FNAMES=OUT,OMIT=(23,1,CH,EQ,C'$'),BUILD=(1,4,24)
/* |
|
|
| Back to top |
|
 |
Hima1985
New User
Joined: 17 Apr 2009 Posts: 49 Location: India
|
|
|
|
kolusu,
Its not working, Its simply replacing the column A with Column B at a particular position in record when i have only one record in FB file.
Input file1
| Code: |
Column A Column B << just for reference
1234567890 1234567899 |
Input file2
| Code: |
XXXXXXXXXXXXXXXXX1234567891XXX0000000000XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXX1234567891XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXX9999999999XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXX1234567892XXXXXXX1234567892
XXXXXXXXXXXXXXXXX1234567892XXX1234567892XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXX1234567892XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567893XXX1234567893XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567893XXX1234567893XXXXXXX1234567893 |
And your job giving me output, its replacing 00000000 as well 999999999 also with the mapping coulmn
| Code: |
XXXXXXXXXXXXXXXXX1234567891XXX1234567899XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXX1234567899XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXX1234567899XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXX1234567892XXXXXXX1234567892
XXXXXXXXXXXXXXXXX1234567892XXX1234567892XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXX1234567892XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567893XXX1234567893XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567893XXX1234567893XXXXXXX1234567893 |
and when i have two records in file1, its not working at all...its giving output as it is in file2.
Please help |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 961 Location: San Jose
|
|
|
|
| hima1985 wrote: |
| kolusu, Its not working, Its simply replacing the column A with Column B at a particular position in record when i have only one record in FB file. |
Hima1985,
If you had copied my code as is you WILL GET the desired results. When you say something does NOT work you need to show me the sysout and the control cards used. I have no idea as to why it wouldn't work as my job does produce the desired results.
You never mentioned the positions of the key and replaceable data. I assumed the positions based on the example data you provided. If your real data is different then you need to change your job accordingly instead of complaining that it doesn't work. |
|
| Back to top |
|
 |
Hima1985
New User
Joined: 17 Apr 2009 Posts: 49 Location: India
|
|
|
|
Kolusu,
I have copied your code as it is, and file formats are as it is in the example i gave you...Not sure why its not working for me :-( and working for you....
| Quote: |
| You never mentioned the positions of the key and replaceable data. I assumed the positions based on the example data you provided. If your real data is different then you need to change your job accordingly instead of complaining that it doesn't work |
I really mentioned these things in my first post and 3rd post. i my 1st post i said
| Quote: |
VBfile date is like this: Key position is 18.
I need to replace Keys of VB file with the corresponding Coulmn B value of FB file, My output should be |
for this post frank replied, after that i had two more posts with correction on requirements....
after franks reply in post1 i said
| Quote: |
| Sorry for this i forgot to mention this, Inputfile2 which is VB file can contain duplicate keys |
in post2 i said
| Code: |
Column A Column B << just for reference
1234567890 1234567899
1234567891 1234567898
1234567892 1234567897
1234567893 1234567896
1234567894 1234567895 |
VBfile date is like this: column A of FB file can be any where in VB file, which needs to be replaced by corresponding columnB of FB file.
| Code: |
XXXXXXXXXXXXXXXXX1234567890XXX1234567890XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567890XXX1234567890XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567890XXX1234567890XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXX1234567891XXXXXXX1234567891
XXXXXXXXXXXXXXXXX1234567891XXX1234567891XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567891XXX1234567891XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXX1234567892XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567892XXX1234567892XXXXXXX1234567892 |
I need to replace Keys of VB file with the corresponding Coulmn B value of FB file, My output should be
| Code: |
XXXXXXXXXXXXXXXXX1234567899XXX1234567899XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567899XXX1234567899XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567899XXX1234567899XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567898XXX1234567898XXXXXXX1234567898
XXXXXXXXXXXXXXXXX1234567898XXX1234567898XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567898XXX1234567898XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567897XXX1234567897XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX1234567897XXX1234567897XXXXXXX1234567897 |
Please let me know if any thing i am missing here and help me out. |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 961 Location: San Jose
|
|
|
|
| hima1985 wrote: |
| VBfile date is like this: column A of FB file can be any where in VB file, which needs to be replaced by corresponding columnB of FB file. |
Hima1985,
You first started with replacing 1 column and now it is multiple values?
Show me the complete DFSMSG Sysout from the job. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 5998 Location: San Jose, CA
|
|
|
|
Hima1985,
It's difficult to hit a "moving target". We are trying to help, but it would save everyone time if you described your requirement clearly in your first post in the future. Like Kolusu, I did not get from your first two posts that you were trying to replace multiple occurrences. |
|
| Back to top |
|
 |
Hima1985
New User
Joined: 17 Apr 2009 Posts: 49 Location: India
|
|
|
|
Ok Frank,
Sorry about that, i will keep this in mind from now onwards and will try to post my requirement in first post only.
Please suggest me the solution. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 5998 Location: San Jose, CA
|
|
|
|
Please provide Kolusu with the information he requested so he can help you.
| Quote: |
| Show me the complete DFSMSG Sysout from the job. |
|
|
| Back to top |
|
 |
Hima1985
New User
Joined: 17 Apr 2009 Posts: 49 Location: India
|
|
|
|
Kolusu,
Sorry, I can not paste you from my job as i do not have access to paste the things to post these questions i need to move to Kiosk.
I am using the TOOLIN as it is u suggested, but it seems it updates one perticualr position....I hope now i cleared your question and you come to know my exact requiremnt.
Can you please help me |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 961 Location: San Jose
|
|
|
|
| Hima1985 wrote: |
Kolusu,
Sorry, I can not paste you from my job as i do not have access to paste the things to post these questions i need to move to Kiosk.
I am using the TOOLIN as it is u suggested, but it seems it updates one perticualr position....I hope now i cleared your question and you come to know my exact requiremnt.
Can you please help me |
Hima1985,
I canNOT help you without seeing the messages. |
|
| Back to top |
|
 |
Hima1985
New User
Joined: 17 Apr 2009 Posts: 49 Location: India
|
|
|
|
hmm...
I have pasted you my requirement and the toolin i used...i think you have suggested me toolin for replacing at one position.....Can you please suggest me toolin for finding string in record and replace it with other string. |
|
| Back to top |
|
 |
|
|
|