Page 1 of 1

Help in Sorting this

PostPosted: Sun Jul 11, 2010 4:45 am
by Melvin_vt
I want to get data from a file which has a record length of VBM 8230.

 BROWSE    Input File Line 000
 Command ===>
********************************* Top of Data ****************
     1         2         3         4         
5....0....5....0....5....0....5....0....5
<RESOURCES>>XXXX   !..AAA.A.......
<RESOURCES>>XXXX   !..AAA.AAB.... .......
AAAAAAAAAAAAAFFFF
AAAAAAAAAAAAAFFFF


We can receive different combinations and the sort should be able to check the no AAAAAAAAAAAAA and the char 'FFFF'.
And also all the time we need to have the Resources. The Resources are always fixed. The AAAAAAAAAAAAA and FFFF can keep on varying.

So this what I did

SORT FIELDS=COPY
OUTFIL FNAMES=FFFF,
      INCLUDE=(((5,13,CH,EQ,C'AAAAAAAAAAAAA'),
              OR,(5,13,CH,EQ,C'TTTTTTTTTTTTT')),AND,
              ((18,4,CH,EQ,C'FFFF')),OR,
              ((18,4,CH,EQ,C'XXXX')))
/*


But with the above sort I can manage to get resources (ie <Resources>>XXXX) no AAAAAAAAAAAAAFFFF in the output file.

And when I use the sort below I get only AAAAAAAAAAAAAFFFF in the output no <RESOURCES>>XXXX.
//SYSIN    DD *
 SORT FIELDS=COPY
 OUTFIL FNAMES=FFFF,
        INCLUDE=(((5,13,CH,EQ,C'AAAAAAAAAAAAA'),
               OR,(5,13,CH,EQ,C'TTTTTTTTTTTTT'),
               OR,(7,9,CH,EQ,C'RESOURCES')),AND,
             ((18,4,CH,EQ,C'FFFF')),OR,
         ((18,4,CH,EQ,C'XXXX')))
/*


Please let me know how to get both of them in the same file.

Re: Help in Sorting this

PostPosted: Sun Jul 11, 2010 8:29 am
by dick scherrer
Hello and welcome to the forum,

Suggest you become familiar/comfortable with the "Code" tag which will preserve alignment and make the post more readable (your data and code have been "Code'd").

Also, when posting data, it is helpful (both for you and for us) to add "ruler" to show data positions.

It appears that the code expects RESOURCES in the wrong positions. It also appears that there may be problems with the parenthetical expressions - so the expected result does not happen.

Re: Help in Sorting this

PostPosted: Mon Jul 12, 2010 8:34 pm
by Frank Yaeger
Melvin,

Note that a VBM record looks like this:

rrrrmdata...

where rrrr is the RDW in positions 1-4.
m is the machine control character in position 5.
data starts in position 6.

So you need to reevaluate your starting positions given that the data starts in position 6, not position 5.

As to what control statements you actually need, that depends on what exactly you're trying to do which you haven't explained well.
Show an example of the records in your input files and what you expect for output. Explain the "rules" for getting from input to output.