View previous topic :: View next topic
|
Author |
Message |
Tyler
New User
Joined: 25 Nov 2006 Posts: 2 Location: Toronto
|
|
|
|
I have a VB file with 2 pieces of data that I am trying to sort. The records are formatted like this:
001aaabbbcccLLLLvvvvvparam1vvvvvparam2vvvv
LLLL=length of variable record to param2 (value in HEX) in a fixed position
vvvv=variable length data
param1=first parameter I need to sort on. These fields are within a few bytes depending on the record and are unique enough that I can sort them based on a range of positions (ie. 98-109)
param2=second parameter I need to sort. The location is LLLL bytes from the end of LLLL (start of the variable length) and is 3 digits which looks like other data nearby.
The results that I am looking for should indicate the following:
count, param1, param2
##,zzz,aaa
##,zzz,bbb
##,zzz,ccc
##,yyy,aaa
##,yyy,bbb
Can I sort the file and count records based on the length LLLL to find param2?
I fully expect the answer No. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
I'm not really clear on your problem, but I'm thinking that this is not a "utility" solution. Me thinks that this will need a progam..... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
What values can appear in LLLL? Are we talking 5 different values or 100 different values or what? Can you narrow it down to a range like 0005-0010?. I'm thinking that if it's a "reasonable" number, we could use DFSORT's IFTHEN clauses to extract the sort fields differently for the different LLLL values so we can operate on param2.
What is the LRECL of the input file?
It would really help if you would show an example of the input records with actual values and the expected output records with actual values.
I assume these values aren't delimited in some way from each other (e.g. commas between them or some other pattern)? If they were, we could use DFSORT's PARSE function. |
|
Back to top |
|
|
Tyler
New User
Joined: 25 Nov 2006 Posts: 2 Location: Toronto
|
|
|
|
The LRECL is 5917 and the data is not delimited.
The values assigned to the length of the variable record (0000005B below) varies from x'50' to x'300' and varies based on an input string captured from the user.
The data in positions 1-162 are fixed but irrelevant. This starts at pos 163:
Code: |
...$000 X=(98223168,v750_
0005FFF4E74FFFFFFFF6AFFF6
000B00007ED98223168B5750D |
v750 is param1 that I need.
The variable length portion starts with the 000 at position 167 and continues for a length of x'5b' (d'91') bytes. At position 258 (167+91) is
Code: |
020E009
FFFCFFF
0205009 |
The 020 is the param2 that I am after.
The more I look at this, the more I realize that I will have to write a program to extract the data from each record and tally the records based on the param2. I had hoped to run the utility against the file to be able to knock out the report but there ya go.
Thanx for your input and letting me talk through it... |
|
Back to top |
|
|
|