View previous topic :: View next topic
|
Author |
Message |
varalakshmi.G
New User
Joined: 04 Jun 2007 Posts: 55 Location: Hyderabad
|
|
|
|
I have one requirement. I want to extract only specific fields based on some criteria from VB file to another VB file.
Thanks and Regards
Lakshmi |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
I want to extract only specific fields based on some criteria from VB file to another VB file. |
You need to supply more information. What is the criteria exactly? What fields do you want to extract?
Show an example of the records in your input file (relevant fields only) and the records you expect for output. Give the starting position, length and format of each relevant field. Use the example to explain what you want to do. Remember that VB records have an RDW in positions 1-4, so the first data byte starts in position 5. |
|
Back to top |
|
|
varalakshmi.G
New User
Joined: 04 Jun 2007 Posts: 55 Location: Hyderabad
|
|
|
|
Hi
I have Employee details file as input which is having fields like
Field name Length Type Starting Positions
Empno 7 Numeric 1
Ename 20 Character 10
Salary 7 Float(9(5)v99) 32
Designation 20 Character 41
I want to extract the records which are having salary greter than 15000 or Designation as Software Engineer to Variable block file.
Regards
Lakshmi |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Varalakshmi,
Code a SORT card using an INCLUDE condition after taking into account the RDW. |
|
Back to top |
|
|
varalakshmi.G
New User
Joined: 04 Jun 2007 Posts: 55 Location: Hyderabad
|
|
|
|
Hi
I have coded SORT card like
Code: |
SORT FIELDS=(45,20,CH,A)
INCLUDE COND=((36,7,PD,GE,15000),OR,
(45,20,CH,EQ,C'SOFTWARE ENGINEER'))
|
BUT IT IS WRITING ALL RECORDS TO OUTPUT FILE.
Please tell me what is the wrong in it.
Regards,
Lakshmi |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
It appears that your record layout does not match your INCLUDE CONDs. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
varalakshmi.G wrote: |
Field name Length Type Starting Positions
Empno 7 Numeric 1
Ename 20 Character 10
Salary 7 Float(9(5)v99) 32
Designation 20 Character 41
Code: |
SORT FIELDS=(45,20,CH,A)
INCLUDE COND=((36,7,PD,GE,15000),OR,
(45,20,CH,EQ,C'SOFTWARE ENGINEER'))
|
BUT IT IS WRITING ALL RECORDS TO OUTPUT FILE.
Please tell me what is the wrong in it.
Regards,
Lakshmi |
Is SALARY packed decimal or float or zoned decimal? Your sort card has packed decimal, but you layout is unclear. If it is float then the 9(5)v99 is meaningless, if it is 7 bytes long and the 9(5)v99 is correct then it is not packed or float. Is 15000 suppose to represent 150.00 or 15000.00? If you are looking for a salary greater than 15000.00 then you need to use 1500000. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Lakshmi,
I suspect
Salary 7 Float(9(5)v99)
is a 7-byte ZD field representing ddddd.dd - if you want to compare this to 15000.00, then you can use:
36,5,ZD,GE,15000
or
36,7,ZD,GE,1500000 |
|
Back to top |
|
|
varalakshmi.G
New User
Joined: 04 Jun 2007 Posts: 55 Location: Hyderabad
|
|
|
|
Hi
Thanks a lot for your help.
Regards
Lakshmi |
|
Back to top |
|
|
|