Hi,
I have input file of variable record length and i have to extract 2 bytes record from the file.
My sort card looks something like this
Code:
SORT FIELDS=COPY
INCLUDE COND=(27,1,CH,EQ,C'1',OR,
148,2,CH,NE,C' ')
OUTREC FIELDS=(2:148,2)
The Following error message displayed in the spool.
Code:
ICE201I E RECORD TYPE IS V - DATA STARTS IN POSITION 5
ICE150I 0 VLSHRT NOT USED FOR SORT, MERGE, INCLUDE, OMIT OR SUM STATEMENT FIELDS
ICE126A 0 INCONSISTENT *OUTREC IFTHEN 0 REFORMATTING FIELD FOUND
ICE751I 0 C5-K24705 C6-K90007 C7-K90000 C8-K90007 E9-K90007 E7-K24705
The Output should should not contain duplicates.
I tried using the OPTION VLSHRT in the Sort Card but still the message exits.The 2 Byte field starts at the position 148 which is not unique.
The File contains two records types '1' and '2' respectively. The record type '1' is only included.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
How do i eliminate the duplicates?
In order to eliminate duplicates, you must remove the COPY operand and specify a SORT statement with a key or keys on which the records will be matched, and a SUM FIELDS=NONE statement. Remember to add 4 to the starting position for each sort key. For example, if you want to eliminate duplicates on positions 152-153, you could use:
Code:
OPTION VLSHRT
INCLUDE COND=(31,1,CH,EQ,C'1',OR,
152,2,CH,NE,C' ')
SORT FIELDS=(152,2,CH,A)
SUM FIELDS=NONE
OUTFIL BUILD=(2:152,2),VTOF
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
If the record type is in col 27+4=31 and he wants record type 1 only then
shouldn't INCLUDE COND=(31,1,CH,EQ,C'1',OR,152,2,CH,NE,C' ') be changed to INCLUDE COND=(31,1,CH,EQ,C'1',AND,152,2,CH,NE,C' ')
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
As written with OR, the INCLUDE statement would include records with '1' in 31 or with nonblank in 152-153. If the OR wants to include records with '1' in 31 and with nonblank in 152-153, then AND would be correct. You may be right that AND is needed, but only the OP knows for sure what he wants.