Page 1 of 1

DFSORT - Omit records

PostPosted: Fri Aug 17, 2007 2:05 pm
by Synthetis
Hi,

What I try to achieve is to omit some record numbers. I have a list of records to remove from a dataset (Ex: 5,9,38,..).
5 mean the fifth record in the dataset, etc..

I found that there is the STARTREC and ENDREC that can be used in a OUTFIL group, but this cannot achieve what I wan to do.
With this we can put records from 1..4 to one file, omit rec 5, put 6..8 to another file, omit 9, put 10..37 to another file, etc
But of course, I would like 1..4,6..8,10..37 to be in the same file !

I found a solution, but I don't like it, as I have to refer to the LRECL of the dataset. And as I will use this to process different LRECLs, I don't want to hardcode them in the JCL.
But, here it is for you information, and in case you have an idea on it:
with SEQNUM, I generate a sequence number which I add as the first field of the input data set.
For this, I do : INREC BUILD=(SEQNUM,8,ZD,1,247) --> where 1,247 means append the input dataset (247 is its LRECL, that what I don't want to refer to).
Then, I can use the OMIT command to as OMIT=(1,8,EQ,ZD,5,OR,1,8,EQ,ZD,9,OR,1,8,EQ,ZD,38,...).
After that, OUTREC BUILD=(9,247) so I can remove the sequence number from the output (again I reference the LRECL of the input file)

So..any idea?

Thanks.

Synthetis.

Re: DFSORT - Omit records

PostPosted: Fri Aug 17, 2007 3:03 pm
by CICS Guy
If I recall correctly, if you leave off that "247", sort will assume that you mean "to the end of the record"....
And, I see in the manual, it looks like you can loop on the constant, you should only need the seqnum once in the omit.....

Re: DFSORT - Omit records

PostPosted: Fri Aug 17, 2007 3:30 pm
by Synthetis
Hi CICS guy,

I will try what you say, but I think that leaving off the 247 works only for variable-length records but not fixed (V and not F).
By looping do you mean something like:
OMIT=(1,8,EQ,ZD,5,OR,9,OR,38,...) ?

Thanks.

Synthetis.

Re: DFSORT - Omit records

PostPosted: Fri Aug 17, 2007 3:56 pm
by Synthetis
So, I tried, and it gives an error. So for fixed length records, you can leave off the length (247).

Any other idea?

Thanks.

p.s: the job I submitted for thest and the error message.

//SORTITEM EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=JLO.TEST.FILES.TEST,DISP=SHR
//SORTOUT DD DSN=JLO.TEST.FILES.RES,DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(1,1))
//SYSIN DD *
INREC BUILD=(1) <-- take from pos 1 to end of record..
SORT FIELDS=COPY
//*

The error msg:
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EX
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 12:24 O
INREC BUILD=(1)
SORT FIELDS=COPY
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE126A 0 INCONSISTENT *INREC IFTHEN 0 REFORMATTING FIELD FOUND
ICE751I 0 C5-K90007 C6-K90007 C7-K90000 C8-K90007 E9-K90007 E7-K11698
ICE052I 3 END OF DFSORT

Re: DFSORT - Omit records

PostPosted: Fri Aug 17, 2007 4:17 pm
by CICS Guy
Since you have a way o test it, try:
INREC BUILD=(SEQNUM,8,ZD,1)
OUTREC BUILD=(9)

Re: DFSORT - Omit records

PostPosted: Fri Aug 17, 2007 6:10 pm
by Synthetis
hi again,

nor the first line, nor the second one works. Both on error, because you don't specify a length.
As I said, what you try to should only work with variable-length records

Hmmm..I don't see any solution..

Thanks

Synthetis

Re: DFSORT - Omit records

PostPosted: Fri Aug 17, 2007 9:12 pm
by Frank Yaeger
Synthetis,

Specifying a position without a length is only valid for variable-length records - not for fixed length records.

The sequence number trick is the most efficient way to accomplish what you want to do. But if you don't know the LRECL, then you could do it this way:

//S1   EXEC PGM=SORT                       
//SYSOUT  DD SYSOUT=*                         
//SORTIN  DD DSN=... input file
//OUT1 DD DSN=&&O1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)   
//OUT2 DD DSN=&&O2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)             
//OUT3 DD DSN=&&O3,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS) 
...                       
//SYSIN DD *                                   
    OPTION COPY                               
    OUTFIL FNAMES=OUT1,STARTREC=5,ENDREC=5 
    OUTFIL FNAMES=OUT2,STARTREC=9,ENDREC=9 
    OUTFIL FNAMES=OUT3,STARTREC=38,ENDREC=38 
    ...
/* 
//S2   EXEC PGM=SORT                       
//SYSOUT  DD SYSOUT=*                         
//SORTIN  DD DSN=&&O1,DISP=(OLD,PASS)
//  DD DSN=&&O2,DISP=(OLD,PASS)
//  DD DSN=&&O3,DISP=(OLD,PASS)
...
//***> SORTOUT MUST BE A MOD DATA SET
//SORTOUT DD DISP=(MOD,CATLG),DSN=...  output file   
//SYSIN DD *                                   
    OPTION COPY           
/*

Re: DFSORT - Omit records

PostPosted: Sat Aug 18, 2007 1:03 am
by CICS Guy
Frank Yaeger wrote:Specifying a position without a length is only valid for variable-length records - not for fixed length records.
Frank,

DFSORT Application Programming Guide wrote:p
specifies that the unedited part of the input record (that part beyond the minimum record length), is to appear in the reformatted input record, as the last field.
Attention: If the reformatted input record includes only the RDW and the variable part of the input record, "null" records containing only an RDW may result.
A value must be specified for p that is less than or equal to the minimum record length (RECORD statement L4 value) plus 1 byte.
I know, there is a lot of RDW mentioned, but I took that as a "when working with variable length records" warning...
Am I just dense or did I miss a specific limitation?

Bill

Re: DFSORT - Omit records

PostPosted: Sat Aug 18, 2007 1:11 am
by Frank Yaeger
Bill,

No, you're right - it's a bit ambigous. The description under OUTFIL is a bit better in that it mentions "variable", though it still could be clearer:

p
specifies the unedited variable part of the OUTFIL input record (that part beyond the minimum record length) is to appear in the reformatted OUTFIL output record as the last field.


Thanks for letting me know. I'll update the DFSORT book to be more explicit about p without m only being allowed for variable-length records.

Re: DFSORT - Omit records

PostPosted: Sat Aug 18, 2007 1:24 am
by CICS Guy
Thanks, I won't need that information any more, but other dense/stubborn people following might.... ;)