View previous topic :: View next topic |
Author |
Message |
videlord Beginner
Joined: 09 Dec 2004 Posts: 147 Topics: 19
|
Posted: Fri Apr 04, 2008 4:51 pm Post subject: include value in different offset |
|
|
requirement:
in certain byte, contain the offset, check the value in the offset, if it contain the value, copy to output
e.g.:
5th byte is the offset, the record will be included if the value in the offset is x'0F'
Is it possible in DFSORT?
input
Code: |
----+----+----+----+----+----+----+----+
0000200000000000000000000000000000000000
0100000000000000000F00000000000000000000
0000100000000000000000000000000000000000
020000000E000000000000000000000000000000
0000100000000000000000000000000000000000
03005000000000F0000000000000000000000000
0000300000000000000000000000000000000000
04000000000000000000000000000E0000000000
...
|
the output will be
Code: |
0000200000000000000000000000000000000000
0100000000000000000F00000000000000000000
0000100000000000000000000000000000000000
03005000000000F0000000000000000000000000
|
|
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Apr 04, 2008 5:05 pm Post subject: |
|
|
videlord,
Do you array of offsets you need to check or is it a fixed position? From your sample data it looks like it is an array
so try this
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(15,1,CH,EQ,X'0F',OR,
20,1,CH,EQ,X'0F',OR,
25,1,CH,EQ,X'0F')
|
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
videlord Beginner
Joined: 09 Dec 2004 Posts: 147 Topics: 19
|
Posted: Fri Apr 04, 2008 5:16 pm Post subject: |
|
|
thanks, kolusu.
The offsets are not fixed positions.
the record is VB format, record lenght can be more than 30k.
And in the sample input, all other bytes are ingored (simply code x'00'), they can be anything in real data, the "OR" doesn't work. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Apr 04, 2008 5:33 pm Post subject: |
|
|
videlord wrote: | thanks, kolusu.
The offsets are not fixed positions.
the record is VB format, record lenght can be more than 30k.
And in the sample input, all other bytes are ingored (simply code x'00'), they can be anything in real data, the "OR" doesn't work. |
Since it is a VB file you need to add 4 bytes for the RDW. Another Alternative is to use Substring format on the entire length of x'05'. So if x'05' found any where in the record it wud be included.
Can you post the cobol layout of the file? _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Fri Apr 04, 2008 10:41 pm Post subject: |
|
|
What format is the offset is a 1 byte binary or what? |
|
Back to top |
|
 |
videlord Beginner
Joined: 09 Dec 2004 Posts: 147 Topics: 19
|
Posted: Mon Apr 07, 2008 8:46 am Post subject: |
|
|
SMF data is one of the example.
The offset can be n bytes binary, it doen't matter how many bytes. (usually it's 2 bytes) |
|
Back to top |
|
 |
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Mon Apr 07, 2008 9:10 am Post subject: |
|
|
Quote: | What format is the offset is it 1 byte binary or what? |
In the examples you show the offset as being x'20' and x'15' but the 'oF' is in positions 20 and 15. x'20' = 64 decimal and x'15' = 21 decimal. |
|
Back to top |
|
 |
videlord Beginner
Joined: 09 Dec 2004 Posts: 147 Topics: 19
|
Posted: Mon Apr 07, 2008 10:16 am Post subject: |
|
|
CraigG wrote: |
In the examples you show the offset as being x'20' and x'15' but the 'oF' is in positions 20 and 15. x'20' = 64 decimal and x'15' = 21 decimal. |
the sample is not good, i should change it to binary format. |
|
Back to top |
|
 |
|
|