View previous topic :: View next topic
|
Author |
Message |
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
Hi All,
My requirement is to replace the 15 characters from position 20 to 35 in dataset A , using the first 15 characters from dataset B.
I want to do it in Eazytrieve.Could you please help me out with this.
Thanks,
manish |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
1. Positions 20 to 35 include 16 characters, not 15.
2. Is this a one-to-one replacement? If so, what happens if the record counts in the two files are not the same?
3. If it is not a one-to-one replacement, what are the rules governing the replacement?
4. How many records are you wanting to update in dataset A? |
|
Back to top |
|
|
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
Hi Robert,
Sorry for that.It is from position 20 to 34.and it is simple replacement that is suppose the file A has Account number that is of 15 digit with the account numbers from the file B.It has total 3500 records. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
So file A has 3500 records and file B has 3500 records? If not, you need to specify how the replacement is supposed to work. |
|
Back to top |
|
|
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
yes Robert.both the files has 3500 records.and there is no selection criteria while coying the data. |
|
Back to top |
|
|
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
Hi Robert,
I even tried using BOUNDS command.It is setting the boundries in dataset A but while copying the data from dataset B , the boundries are not working and the data is getting pasted from column first only. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You do realize that if you use Easytrieve, you will create a 3rd file. . .
You will not change the content of the existing file. You might rename later, but the process will not change the existing data on-the-fly. |
|
Back to top |
|
|
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
Thnx Dick.I got your point.I will try to create a 3rd file then and if at i am able to create it will update all. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome - good luck
Someone will be here if there are questions,
d |
|
Back to top |
|
|
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
Hi All,
I am still trying to do it using Easytrieve.
But in the meanwhile i learnt using OVERLAY in File aid and successfully copied according to my requirement.I will still be trying it using eazytrieve.
Thanks All |
|
Back to top |
|
|
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
HI All,
I tried doing the above task using Eztrieve.Though its replacing the data in output but not the way i want.
There are 3439 records in File A.I appended these into the file B.So now file B is having 6478 records in total.After this i used the below Eztrieve code :
Code: |
FILE INPFILE1 VB(255 0)
IN-REC1 1 255 A
CASLOG1 1 15 A
FILE OUTFILE FB(250 0)
REC2 1 250 A
OUT-REC 1 1 A
OUT1 1 6 A
CASLOG01 22 227 A
CASLOG02 7 15 A
FILE OUTFILE1 FB(250 0)
REC3 1 250 A
OUT-REC3 1 1 A
OUT2 1 6 A
CASLOG04 22 227 A
CASLOG03 7 15 A
CM1 W 250 A VARYING
CM2 W 250 A VARYING
CM3 W 250 A VARYING
=======================================*
JOB INPUT OUTFILE
DO WHILE NOT EOF OUTFILE
IF OUT-REC = 'C'
MOVE OUT1 TO CM2
MOVE CASLOG01 TO CM3
END-IF
IF OUT-REC = ' '
MOVE CM2 TO OUT2
MOVE CASLOG02 TO CASLOG03
MOVE CM3 TO CASLOG04
PUT OUTFILE1
END-IF |
After running this my OUTFILE1 is having 3439 recrods which are blank and next 3439 records with the replaced data but repeating the last recrod from OUTFILE.
Please let me know if my query is clear to you or not.
Thanks |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Looks like that is exactly what you coded. . .
What is the purpose of cm1, cm2, and cm3?
Suggest you adopt better naming methods. . . One does not usually read outfile. . . One does not usually name an INFILE that is not used either. . .
You need to post some sample input records and the output you want from these input records. Use short records that demonstrate what you want to do. |
|
Back to top |
|
|
|