Page 1 of 2

Hex search in a VBA file?

PostPosted: Tue Mar 18, 2008 6:21 am
by BSvihraJr
I can clarify the requirements if needed.

Basically, I have a variable block file. I need to run through it with a utility that will create a second file with a tally of the number of records that fit a criteria. The criteria is a hex value at a specific position in the record.

Doable?

Thanks!

Re: Hex search in a VBA file?

PostPosted: Tue Mar 18, 2008 9:04 pm
by Frank Yaeger
Please show an example of your input records and what you expect for output. Give the LRECL of the input file. Give the value of the hex character you want to search for (e.g. X'01'). If there can be more than one such hex character in a record, describe how you want to handle that.

Re: Hex search in a VBA file?

PostPosted: Wed Mar 19, 2008 4:33 am
by BSvihraJr
I will update tomorrow morning. Thanks.

Re: Hex search in a VBA file?

PostPosted: Wed Mar 19, 2008 7:59 am
by BSvihraJr
Can we start with... tallying the number of records in a VB file, 13004 LRCL, and displaying that number in another file?

I tried a few things already, and can't even get past whether to use VTOF or not. When using that, it seemed like I couldn't do anything but the convertion. I read some documentation that said you can't really use it with anything else (overlay, etc).

Re: Hex search in a VBA file?

PostPosted: Wed Mar 19, 2008 8:38 am
by dick scherrer
Hello,

If you want to use DFSORT to get the count, you can use the technique discussed in the "Display the number of input or output records" Smart DFSORT Trick at:

http://www.ibm.com/servers/storage/supp ... vs/tricks/

Re: Hex search in a VBA file?

PostPosted: Wed Mar 19, 2008 6:12 pm
by BSvihraJr
//SYSIN    DD   *
   OPTION COPY
   OUTFIL NODETAIL,REMOVECC,TRAILER1=(COUNT=(M11,LENGTH=8))
/*


Results in a SYSOUT containing all input records and no trailer record.

Input file:

LRECL = 13004
TYPE = VBA

Re: Hex search in a VBA file?

PostPosted: Wed Mar 19, 2008 6:18 pm
by BSvihraJr
This is what I tried for the ultimate scenario.

VBA file in, FB out. Tally in one counter the number of "S" records, and the number of "I" records in another. Omit "S" records with 9999's in a position.

Gives me a RC=16
21 BYTE VARIABLE RECORD IS SHORTER THAN 29 BYTE MINIMUM FOR FIELDS

//SYSIN    DD   *
   OPTION COPY
   OMIT COND=(14,2,CH,EQ,C'S',AND,25,5,CH,EQ,C'99999')
   OUTREC IFTHEN=(WHEN=(14,2,CH,EQ,C'S'),OVERLAY=(13005:C'1')),
          IFTHEN=(WHEN=(14,2,CH,EQ,C'I'),OVERLAY=(13006:C'1'))
   OUTFIL NODETAIL,
          TRAILER1=(TOTAL=(13005,1,ZD,TO=ZD,LENGTH=8),
                    /,
                    TOTAL=(13006,1,ZD,TO=ZD,LENGTH=8))
/*

Re: Hex search in a VBA file?

PostPosted: Wed Mar 19, 2008 9:24 pm
by Frank Yaeger
You can get past the "short record" error by using:

   OPTION COPY,VLSCMP


I don't know if this will actually give you the output you want and I suspect there's a better way to do what you want to do, but I can't help you since you seem to have a problem with actually describing what you want to do.

Since you didn't specify VTOF and BUILD, your output will be VB, not FB. I could show you how to get an FB output file if I knew what you were trying to do, but again ...

Re: Hex search in a VBA file?

PostPosted: Wed Mar 19, 2008 11:19 pm
by BSvihraJr
I can't release a sample record, as it's confidential.

This is as specific as I can get:

1 input file, 13004 LRECL, VBA

I need one FB ouput file that has a two counts, on two different lines, ex:

00000007
00000003

The first count is of records where a character "S" appears on the 14th position of the record.
However, on the S records, don't include in the count where character "T" also appears in the 19th position.
The second count is of records where a character "I" appears on the 14th position of the record.

That should be sufficient.

Re: Hex search in a VBA file?

PostPosted: Thu Mar 20, 2008 12:15 am
by dick scherrer
Hello,

You can post sample data as long as you change the "confidential" values to something that doesn't give anything sacred away. We respect protecting controlled data, but we do not appreciate laziness.

When you ask for solutions, you should not try to dictate what is sufficient. If you want help, you should provide the requested info. You could post smaller (say 80 byte) sample data and not 13k and use content that meets your requirement.