|
View previous topic :: View next topic
|
| Author |
Message |
scorp_rahul23
New User

Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
I want to use SORT function to do the following function.
Input FILE
| Code: |
1,2,3,4 EMC6RAH1 ndqlndlqndlqnldnql
2,3,4 EMC6RAH2 ndqlndlqndlqnldnql
1,3,4 EMC6RAH3 ndqlndlqndlqnldnql
3,4 EMC6RAH1 ndqlndlqndlqnldnql
|
Output File
| Code: |
EMC6RAH1
EMC6RAH2
EMC6RAH3
|
Input file is of RECLENGTH = 80
Basically I want to remove duplicates from the Input files taking in consideration the fields starting from position 16 and 8 length.
And output file should only have unique rows and only the data which start from position 16 and 8 length.
Can anyone please guide me some initial steps which I can use to acheive this. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Have a look in the manual at how the different parts of the SORT hang together.
You need to SORT your data. SUM FIELDS=NONE can get rid of the duplicates.
To get the minimum amount of data into SORT, use INREC to prepare only the data you need. You can use BUILD on INREC.
| Code: |
INREC BUILD=(for you to determine)
SORT FIELDS=(again straightforward)
SUM FIELDS=(NONE) |
|
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Your INPUT and OUTPUT does not match.
Position 16 for 8 bytes has the following
| Code: |
----+----1----+----2----+----3----+----4----+
1,2,3,4 EMC6RAH1 NDQLNDLQNDLQNLDNQL
2,3,4 EMC6RAH2 NDQLNDLQNDLQNLDNQL
1,3,4 EMC6RAH3 NDQLNDLQNDLQNLDNQL
3,4 EMC6RAH1 NDQLNDLQNDLQNLDNQL
H1 NDQLN
H2 NDQLN
H3 NDQLN
H1 NDQLN |
Your Output shows the contents from position 10. is your Input a VB file? or FB file?
As Bill points out it is an elementary task.
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:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080 |
|
| Back to top |
|
 |
scorp_rahul23
New User

Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
I have used below conditions
| Code: |
//SYSIN DD *
INREC BUILD=(1:16,8)
SORT FIELDS=(16,8,CH,A)
SUM FIELDS=NONE
*/
|
And Input file is like
| Code: |
----+----1----+----2----+----3----+----4----+
1,2,3,4 EMC6RAH1 NDQLNDLQNDLQNLDNQL
2,3,4 EMC6RAH2 NDQLNDLQNDLQNLDNQL
1,3,4 EMC6RAH3 NDQLNDLQNDLQNLDNQL
3,4 EMC6RAH1 NDQLNDLQNDLQNLDNQL
|
I am getting below error
| Code: |
3 INVALID DATA SET ATTRIBUTES: SORTOUT RECFM - REASON CODE IS 08
0 VLSHRT NOT USED FOR SORT, MERGE, INCLUDE, OMIT OR SUM STATEMENT FIELD
|
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Can you post the messages including the message numbers, please? |
|
| Back to top |
|
 |
scorp_rahul23
New User

Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
| Code: |
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 06:47 ON THU A
INREC BUILD=(1:16,8)
SORT FIELDS=(16,8,CH,A)
SUM FIELDS=NONE
*/
ICE043A 3 INVALID DATA SET ATTRIBUTES: SORTOUT RECFM - REASON CODE IS 08
ICE150I 0 VLSHRT NOT USED FOR SORT, MERGE, INCLUDE, OMIT OR SUM STATEMENT FIELD
|
|
|
| Back to top |
|
 |
scorp_rahul23
New User

Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
I got it write finally
//SYSIN DD *
SORT FIELDS=(16,8,CH,A)
SUM FIELDS=NONE
OUTREC FIELDS=(1:16,8)
*/ |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| Why do you have '*/' in your sort control cards? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Is your input variable (as Kolusu guessed already?)
Try:
| Code: |
//SYSIN DD *
INREC BUILD=(1,4,16,8)
SORT FIELDS=(5,8,CH,A)
SUM FIELDS=NONE
|
If you input is variable and you want your output fixed, look at OUTFIL and VTOF. |
|
| Back to top |
|
 |
chandan.inst
Active User

Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
| scorp_rahul23 wrote: |
I have used below conditions
| Code: |
//SYSIN DD *
INREC BUILD=(1:16,8)
SORT FIELDS=(16,8,CH,A)
SUM FIELDS=NONE
*/
|
|
For this change the code as below and it will work
| Code: |
//SYSIN DD *
INREC BUILD=(1:16,8)
SORT FIELDS=(1,8,CH,A)
SUM FIELDS=NONE |
I am not sure but I guess Inrec will be more efficient than Outrec..
May be Bill or Skolusu can confirm on this
Regards,
Chandan |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
The less data which goes into the actual SORT, the better. Unless dependent on the sorted order (like the need to use WHEN=GROUP, or similar), "cutting down" a record should be done with INREC.
BUILD would never need "1:", as this is the default. Columns in BUILD can lead to spaces in between fields, which may be the design, or not. Can also lead to "overlapping" fields, which is not allowed on BUILD.
I thing the problem is that the input is variable, requiring the input RDW (position one for length of four) to be included in the INREC record.
scorp_rahul23,
I avoid using FIELDS= in such situations. It is equivalent to BUILD, and is there for "backwards compatibility" for Sort Control Decks written many years ago. FIELDS is very "overloaded" (the same word meaning different things in different contexts, like SUM, SORT, INCLUDE/OMIT), so just because you can, doesn't mean it is a good idea to do so.
If you can clear up the variable/fixed question for your input and output, we can finish this off. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|