Page 1 of 1

How to bypass register, and maintain it on output

PostPosted: Thu Dec 15, 2011 7:09 pm
by ficks
Here is the problem:

The file I want to sort has 3 types of records.
If the first byte has value 0, it means a header record.
If the first byte has value 1, it means a value record.
If the first byte has value 3, it means a trailler record.

I need to sort the file, without taking into account header and trailler records.
However, these records should figure in output file, at the first position and last position respectively.

I'll always have a header and a trailler record, and the number of records is variable.

My key is:
OPTION MAINSIZE=32M
SORT FIELDS=(83,8,A),FORMAT=BI

What should I add to the key, to have this behavior?


Thanks!

Re: How to bypass register, and maintain it on output

PostPosted: Fri Dec 16, 2011 12:16 am
by NicC
What 'register'?

How about sorting on your record type ascending as the first sort key and then on your 'real' sort key as the minor sort key?

Re: How to bypass register, and maintain it on output

PostPosted: Fri Dec 16, 2011 12:44 am
by BillyBoyo
NicC is absolutely right. If your file has been designed correctly, the header/data/trailer indicators will all be in the same place, and will have values in ascending order. Yours fits the bill.

//SYMNAMES DD dsn=hlq.hlq.symnames(memname),disp=shr

where the above member contains:

FILE-RECORD-INDICATOR,1,1,BI  /* Contains 0,1,3
FILE-RECORD-KEY,83,8,BI /* position, length and type of key

//SORTIN DD *
  SORT FIELDS=(FILE-RECORD-INDICATOR,A,
               FILE-RECORD-KEY,A),
               FORMAT=BI


When you run the SORT, the SYMNAMES will be translated into the usual-looking sort cards.

SYMNAMES have a number of advantages. One, for instance, is that you can use the same "datanames" as the programs which might use the file.

Re: How to bypass register, and maintain it on output

PostPosted: Fri Dec 16, 2011 1:29 am
by ficks
Oh, by register I mean record.
I wasn't able to use two sort keys, but now I talked to the adm and it will function.
Thanks!