I've got a new requirement in a development process and I'm stuck with below.
1. A VB file is to be filtered based on two conditions.
2. The first condition is supplied as below
Code:
INCLUDE COND=((21,4,CH,EQ,C'ABCD'),AND,
((37,6,CH,EQ,C'111111'),OR,
(37,6,CH,EQ,C'222222'))
3. When a record matches the above COND , I need to strip a value from that record (Pos = 10, Length = 11)
4. I need to frame a second condition, to copy all the records with the striped value in Pos 10.
My question is,
1. Should I apply the condition 1 in a step and write the stripped value to a intermediate file and then use a second step to copy the records from the original input by matching the stripped value to output file?
2. Is there a possibility to do this in a single step. (I prefer this to reduce CPU and EXCP)
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
karthickpearl wrote:
Hi Guys,
I've got a new requirement in a development process and I'm stuck with below.
1. A VB file is to be filtered based on two conditions.
4. I need to frame a second condition, to copy all the records with the striped value in Pos 10.
My question is,
1. Should I apply the condition 1 in a step and write the stripped value to a intermediate file and then use a second step to copy the records from the original input by matching the stripped value to output file?
2. Is there a possibility to do this in a single step. (I prefer this to reduce CPU and EXCP)
Karthikpearl,
Before you ask if it can be done , you need to explain what the second condition is?
Assuming it can be done , did you think thru all the possible scenarios?
Lets say your input file has 10 million records and your 1st INCLUDE condition has it filtered to 6 million records. Now if you take the value at position 10 for 2 bytes you have 6 million INCLUDE conditions which I am sure none of the sort products handle. Even if you eliminate duplicate values you still might end up with a number that is impossible to handle via INCLUDE/OMIT
And second question is Do you apply the second condition to original 10 million file or the filtered 6 million file?
Please don't waste your time as other people's time with limited description of what you really want.
Before you ask if it can be done , you need to explain what the second condition is?
In file-1(Input) i have say 5 Million records.
Cond1:
Get the value of a field (Pos=10, Len=11) based on an include condition(=> as given in my first post)
Cond2:
part1: Copy the record(to the output VB file) that matches the cond1.
part2: There will be few other records after the copied record(varies between 10-30 records max), that will have the same value at (Pos=10,Len=11), which are also to be copied to the output VB file.
My current solution is,
Step1: Read the input file and write the 11 byte matching value to a FB file.
Step2: Read the FB file and and extract all the records from the input file based on the entries in the FB file. (This is done thru COBOL)
The issue in this solution is I need to read the input file(with 5 million recs approx.) twice and hence more EXCP.
Woodger,
Quote:
We need sample data and expected output.
I couldn't post my code due to a regulatory restriction. I have explained as far as I can. If you guys feel some info is missing let me know.
Quote:
Can you supply a new title, which I will edit in to your original post, please?
Since I wanted to do cond2 based on cond1 in a single go, I thought the title was apt. May be suggest me a better title.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Your explanation is still unclear.
Do you mean:
Select some records from a file;
Take a particular value from each record selected;
Select, from the original file, all the records which contain any of the particular values, irrespective of their meeting the first selection criteria?
If not, make it clear, all in one post, with a sample of input and expected output.
If you are unable to post actual data (we wouldn't expect you to be able to, so don't go thinking your site is so special and important) then make some up.
Without sample data (which reflects all relevant conditions) and expected output it is not likely that someone will post a tested solution for you, is it?
At the moment it sounds like a simple JOINKEYS, with the same file as both inputs, and an INCLUDE with a SUM FIELDS=NONE on the JNF2CNTL, but can only guess.
Select some records from a file;
Take a particular value from each record selected;
Select, from the original file, all the records which contain any of the particular values, irrespective of their meeting the first selection criteria?
Yes. Youv'e got my point.
Note:Both cond 1 and cond 2 are applied to the same input file.
dbz,
Quote:
compound condition???
Ok. But I tried to change the title but in vain. Please can you help.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
It still sounds like a simple JOINKEYS, with the same file as both inputs, and an INCLUDE with a SUM FIELDS=NONE on the JNF2CNTL. Did you try that?
To set it out a bit more. For each of the two input files for the JOINKEYS, specify the same dataset name.
The JNF1 file will be the file you are extracting your final output from.
The JNF2 file will the file of keys for the extract. Here, you have your INCLUDE (first condition). You just BUILD a fixed-length record for the key values. SUM FIELDS=NONE to make them unique. JOINKEYS will be sorting this by default, so no real extra pain with the SUM.
The the JOINKEYS will be matching on the keys. You don't need to specify a JOIN, as you only want matched records. You can specify a REFORMAT record which just copies the F1 record.