View previous topic :: View next topic |
Author |
Message |
preetham Beginner

Joined: 03 May 2005 Posts: 2 Topics: 1
|
Posted: Tue May 03, 2005 1:20 am Post subject: Finding a String in File1 occuring in File 2 in any place. |
|
|
I'm new member in the user group....u guys great i learnt great deal reading ur faq's I'm looking for a way to write rexx or easytrieve CODE for the following issue.
In FILE 2 THE STRING FROM FILE 1 CAN OCCUR IN ANY PLACE
File 2 cannot be sorted on any String.
File 1
KKU15510
WWU15601
PKU14411
.
.
.
FILE 2
******** FSTRUC,JOB=AQU15501 (leadjob)
001 AQU15501 (Triggered jobs)
** 002 AAU15502
*********** 003 AAU15503
************ 004 AAU15504
.
.
.
************* 003 AAU15506
.
.
*********************** 006 KKU15510
******** FSTRUC,JOB=APU11101
001 APU1101 (Triggered jobs)
** 002 APU11102
************ 003 BAU1103
.
.
.
.
.
******************************************012 PKU14411
******** FSTRUC,JOB=BEU11101
001 WWU15601 (Triggered jobs)
.
.
.
.
OUTPUT NEEDED:
TRIGRED JOB ************* LEAD JOB
KKU15510 ++++++++++ AQU15501
WWU15601 ++++++++++ BEU11101
PKU14411 ++++++++++ APU11101 |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed May 04, 2005 7:52 am Post subject: |
|
|
preetham,
what is the max: no of records in file1? If it is not that many then load the file as a table and read the file2 and search the table for the string.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
preetham Beginner

Joined: 03 May 2005 Posts: 2 Topics: 1
|
Posted: Wed May 04, 2005 11:11 am Post subject: Both File1 and File2 records keeps changing |
|
|
Thanx for response kolusu,no of recds in Both File1 and File2 keeps changing.
recds in file 1 can vary from 1 to 10,000 recds, and File 2 also acorodingly
The whole excercise is to find leadjob for a job which is currently waiting in Ca-7 queues and create report which can tell what jobs are currently waiting and from what lead job. i hope i'm clear this time ........Thanx once again |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Tue May 10, 2005 7:38 am Post subject: |
|
|
kolusu gave you pretty much what you need. You will need two loops: one for each record in file1, and then one for every record of file2. The program logic would look like this:
Read 1 record from file1.
Store the value as "trigger-job".
Open file2.
Initialize the value for "lead-job" to nulls.
Read file2 and search for the value "FSTRUC,JOB=xxxxxxxx". Store the
value of xxxxxxxx as "lead-job".
Now, search for the occurence of "trigger-job" in file2.
If "lead-job" is not null, and "trigger-job" is found, then you have your match and you can write the output.
Close file2.
Go back to the beginning and read the next record from file1 and continue the process until EOF of file1. |
|
Back to top |
|
 |
|
|