|
View previous topic :: View next topic
|
| Author |
Message |
passion_sujesh
New User
.jpg)
Joined: 14 Mar 2008 Posts: 74 Location: India,Chennai
|
|
|
|
Hi,
I am trying to extract records from a VB file which has different record type. I need to extract the reference number, if the product code is 'xxxx'. The product code is in different position for each record type.
The file has three record types.
If record type is 'A', the reference number starts from 26 and is 5 byte long. The product code starts from 31 and is 4 bytes.
If record type is 'B', the reference number starts from 40 and is 5 byte long. The product code starts from 45 and is 4 bytes.
I need not reffer other record types.
the record type is in position 25 and is 1 byte.
The output should be a FB file and record length should be 9 bytes.
I tried the following sort card, but the include condition does not work properly. If i remove the include condition, i get the formated records for all the records in file. If i have the include condition i get empty file.
| Code: |
//SYSIN DD *
INREC IFTHEN=(WHEN=(29,1,CH,EQ,C'A'),
OVERLAY=(5:30,9)),
IFTHEN=(WHEN=(29,1,CH,EQ,C'B'),
OVERLAY=(5:44,9)),
IFTHEN=(WHEN=NONE,
OVERLAY=(5:9C' '))
SORT FIELDS=(5,9,CH,A)
INCLUDE COND=(10,4,CH,EQ,C'xxxx')
OUTFIL FNAMES=SORTOUT,VTOF,OUTREC=(5,9)
/* |
I get the following O/P if i remove the Include condition statement:
(Lrecl=9,Recfm=FB,Dsorg=ps)
refr1xxxx
refr2xxxx
refr3yyyy
refr4zzzz
refr5cccc
If i retain the include condition, i get empty output.
Can anyone let me know what is wrong in the above sort card.
Thanks in advance. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Did you remember to increase the positions by 4 to allow for the RDW? |
|
| Back to top |
|
 |
passion_sujesh
New User
.jpg)
Joined: 14 Mar 2008 Posts: 74 Location: India,Chennai
|
|
|
|
| Yes. I had added +4 bytes, for all the positions. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you post a few of the records using HEX ON. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
passion_sujesh,
Have a look at this, which describes DFSort order of processing.
It does not matter where you locate your INCLUDE statement, DFSort will process it where it always does.
So, at the time your INCLUDE was processed, the position/length you are using contained completely different data.
Try with INCLUDE= on OUTFIL instead. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Bill,
Good catch
After checking the data, i was going to work thru the code
d |
|
| Back to top |
|
 |
passion_sujesh
New User
.jpg)
Joined: 14 Mar 2008 Posts: 74 Location: India,Chennai
|
|
|
|
Thanks bill.
I shall try this and will let you know if it works. |
|
| Back to top |
|
 |
passion_sujesh
New User
.jpg)
Joined: 14 Mar 2008 Posts: 74 Location: India,Chennai
|
|
|
|
Thanks Bill.
I used include in OUTFIL, and it works fine. :-) |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for letting us know
d |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
A better approach would be to filter the records with an INCLUDE cond and build only required fields.
| Code: |
//SYSIN DD *
OPTION VLSCMP,VLSHRT
INCLUDE COND=((29,1,CH,EQ,C'A',AND,35,4,CH,EQ,C'XXXX'),OR,
(29,1,CH,EQ,C'B',AND,49,4,CH,EQ,C'XXXX'))
INREC IFTHEN=(WHEN=(29,1,CH,EQ,C'A'),BUILD=(1,4,30,9)),
IFTHEN=(WHEN=(29,1,CH,EQ,C'B'),BUILD=(1,4,44,9))
SORT FIELDS=(5,9,CH,A)
OUTFIL VTOF,BUILD=(5,9)
//* |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|