Posted: Wed May 16, 2007 2:32 pm Post subject: 'internal' sort in block of data
Hi. I wonder if this complex (seems) sort is even possible with z/OS DFSORT v1r5 we have in our shop...
Input DS:
Code:
-> 01 some data record sort yes
| 01 associated line
block | 02 some data record
| 02 associated line
#1 | 04 sorted record#1 A
| 04 associated data for record #1
| 04 sorted record#2 C
| 04 associated data for record #2
| 04 sorted record#3 B
-> 04 associated data for record #3
-> 01 some data record sort no
| 01 associated line
block | 02 some data record
| 02 associated line
#2 | 04 sorted record#1 C
| 04 associated data for record #1
| 04 sorted record#2 A
| 04 associated data for record #2
| 04 sorted record#3 B
-> 04 associated data for record #3
Output DS:
Code:
-> 01 some data record sort yes
| 01 associated line
block | 02 some data record
| 02 associated line
#1 | 04 sorted record#1 A
| 04 associated data for record #1
| 04 sorted record#2 B
| 04 associated data for record #2
| 04 sorted record#3 C
-> 04 associated data for record #3
-> 01 some data record sort no
| 01 associated line
block | 02 some data record
| 02 associated line
#2 | 04 sorted record#1 C
| 04 associated data for record #1
| 04 sorted record#2 A
| 04 associated data for record #2
| 04 sorted record#3 B
-> 04 associated data for record #3
Sorting rules are:
a) only 04 records sorted
b) 04 records sorted only in a boundaries of 'home' block
c) the associated data should follow sorted 04 record
d) 04 records sorted only if 01 record contains sort 'indicator'
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed May 16, 2007 3:55 pm Post subject:
Is the order of the record types in each block always 01, 02 and 04? If not, what are the variations?
Are there always two 01 record types at the start of every block? If not, what are the variations?
What is the RECFM and LRECL of the input file?
What is the starting position, length and format of the type indicator (01, etc)?
What are the actual values for the sort indicator - is it really 'sort yes' and 'sort no' or something else?
What is the starting position, length and format of the sort indicator?
How do you distinguish a sorted 04 record from an associated 04 record? Is there an indicator, or is every sorted 04 always followed by one associated 04, or what?
What is the starting position, length and format of the key in the sorted 04 record? _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Is the order of the record types in each block always 01, 02 and 04? If not, what are the variations?
The order can be 01-04 or 01-02-04, where 02 and 04 can be multiple, but only 04 should be sorted. Every record type has one (only one) associated (detail) record which starts with CR - this forms an 'indivisible' group.
Quote:
Are there always two 01 record types at the start of every block? If not, what are the variations?
I must admit that sample block in my first post is not accurate. Sorry.
It should be:
Code:
-> HEADER
| 01 some data record sort yes
| CR associated line
block | 02 some data record
| CR associated line
#1 | 02 some data record
| CR associated line
| 04 sorted record#1 A
| CR associated data for record #1
| 04 sorted record#2 C
| CR associated data for record #2
| 04 sorted record#3 B
-> CR associated data for record #3
....
So, start of every block distinguished by keyword 'HEADER' which always starts in position 1 and followed by one group of 01 + CR records.
Quote:
What is the RECFM and LRECL of the input file?
RECFM = VB, LRECL = 1954
Quote:
What is the starting position, length and format of the type indicator (01, etc)?
starting position = 1, length = 2. Format: 0x, where x = 1, 2, 4.
Quote:
What are the actual values for the sort indicator - is it really 'sort yes' and 'sort no' or something else?
What is the starting position, length and format of the sort indicator?
Sort indicator is a 3-char string, starting position = 37, it does not have any format - the only exception is that it can not contain digits. The 04 recs should be sorted if the value in block's sort indicator is 'YCF' or 'ZAQ'.
Quote:
How do you distinguish a sorted 04 record from an associated 04 record? Is there an indicator, or is every sorted 04 always followed by one associated 04, or what?
04 record is always followed by one (only one) associated (detail) record, which starts with CR.
Quote:
What is the starting position, length and format of the key in the sorted 04 record?
The starting position of the key is 120, lenght is up to 10 chars and does not follow any format, i. e. can be a varying string of any characters.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed May 30, 2007 11:18 am Post subject:
There probably is a way to do it with DFSORT, but I just got back from vacation and I'm really swamped right now, so I can't take the time to figure it out. Sorry.
Maybe Kolusu or Alain has time to work it out? _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed May 30, 2007 1:26 pm Post subject:
Quote:
04 record is always followed by one (only one) associated (detail) record, which starts with CR.
rover,
Is there anything to distinguish these 'CR' records (i.e 1 CR record immediately after the 04 record) from the other 'CR' records within the same group?
kolusu, yes, your suggestion is quite correct - every CR (min 1: max 1) record 'belongs' to preceding 04 (min 1: max 1) record and this is a way to distinguish them.
does not 'extract' chars from 1963... I was able to 'see' that field and sort when 1963 changed to 1940 and WITH(1,1962) to WITH(1,1939)
2. (sigh) sorry, I did not tell that first record contains some data after 'HEADER' indicator. This record should be moved to output as is instead of hardcoding 'HEADER'. I really hope that this missing detail would not ruin the solution...
does not 'extract' chars from 1963... I was able to 'see' that field and sort when 1963 changed to 1940 and WITH(1,1962) to WITH(1,1939)
Hmm that is not what that statement does.
The above statement does this
1. when the first 2 bytes = '04' , it will copy the contents from pos 124 for 10 bytes and palce it in byte 1963 for 10 bytes
Quote:
2. (sigh) sorry, I did not tell that first record contains some data after 'HEADER' indicator. This record should be moved to output as is instead of hardcoding 'HEADER'. I really hope that this missing detail would not ruin the solution...
lemme see , most probably we can do it in the same pass, however it may require another pass of data _________________ Kolusu
www.linkedin.com/in/kolusu
1. yes, got the idea that OVERLAY=(1963:124,10)) will copy the content to new position, but in my case it does not happen. Will review my jcl more carefully...
2. The input ds usually is about <200 records, so another pass of data is ok, I believe.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum