I'm working on a E15 exit routine that is intended as an utility, and I'd like to be able to use it in SORT operations on FB records with different length.
What I've done is to declare a IN-RECORD long enough to accommodate the maximum possible record length, but I'd like to know if it could cause problems when the exit routine is being used with smaller record's lengths. I've done some tests and it seems to work but I'd like to be sure it wont cause me any problems.
The exit routine is used to delete some records.
On a side note, if I know that on average the routine is going to delete about 75% of the records, is it possible to tell DFSORT to allocate less workspace (I'm using DYNALLOC)?. I know I can specify the number of records or bytes to be processed (FILSZ option), but I was looking for something like "so you think you need X word space? just make it X*0.25"
This is the actual code I'm using right now:
LINKAGE SECTION.
01 RECORD-FLAGS PIC 9(8) BINARY.
88 FIRST-REC VALUE 00.
88 MIDDLE-REC VALUE 04.
88 END-REC VALUE 08.
01 IN-RECORD.
05 TB-IN-RECORD OCCURS 15000 TIMES.
10 IN-RECORD-X PIC X(01).
PROCEDURE DIVISION USING RECORD-FLAGS, IN-RECORD.
01 RECORD-FLAGS PIC 9(8) BINARY.
88 FIRST-REC VALUE 00.
88 MIDDLE-REC VALUE 04.
88 END-REC VALUE 08.
01 IN-RECORD.
05 TB-IN-RECORD OCCURS 15000 TIMES.
10 IN-RECORD-X PIC X(01).
PROCEDURE DIVISION USING RECORD-FLAGS, IN-RECORD.