View previous topic :: View next topic |
Author |
Message |
nithyakothai Beginner
Joined: 26 Dec 2007 Posts: 4 Topics: 3
|
Posted: Thu Dec 23, 2010 7:36 am Post subject: replicate data until a condition is met using syncsort |
|
|
Hi,
i want to reformat the following.
i/p file format:
Code: |
abcd pds1 mem1
mem2
mem3
cdef pds2 mem4
mem5
mem6
|
o/p: Code: |
abcd pds1 mem1
abcd pds1 mem2
abcd pds1 mem3
cdef pds2 mem4
cdef pds2 mem5
cdef pds2 mem6
|
the length of the fields are field1(5), field2(45), field(10).
TIA |
|
Back to top |
|
 |
Brian Wood Beginner
Joined: 14 Jan 2009 Posts: 37 Topics: 0 Location: USA
|
Posted: Thu Dec 23, 2010 12:02 pm Post subject: |
|
|
nithyakothai:
Your posting displays the second and third input records as containing fields starting in position 01 with the data "mem2" and "mem3". In your first input record the field containing "mem1" begins at a different position (presuambly your third field, which appears to begin at position 51). Is this true?
If the records that contain "mem#" all begin at the same position within each record, then you should be able to use INREC/OUTREC IFTHEN WHEN=GROUP processing to handle this processing (see pages 2.165 through 2.171 in the current SyncSort for z/OS 1.3 Programmer's Guide). You need to better define what constitutes a GROUP of records (ie: is it always a group of 3 detail records, or is there some criteria that you could specify as your BEGIN=(conditions)).
Please reply if you require further assistance. _________________ Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com |
|
Back to top |
|
 |
Brian Wood Beginner
Joined: 14 Jan 2009 Posts: 37 Topics: 0 Location: USA
|
Posted: Thu Dec 23, 2010 2:26 pm Post subject: |
|
|
nithyakothai:
I see that someone has reformatted your post so that the "mem#" records now all appear at the same position in the record.
In order to use INREC/OUTREC IFTHEN WHEN=GROUP processing you need to be able to supply information regarding the logical test to be used to specify that a record starts a group (see page 2.165 in the SyncSort for z/OS 1.3 Programmer's Guide). How do you define this criteria? _________________ Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com |
|
Back to top |
|
 |
nithyakothai Beginner
Joined: 26 Dec 2007 Posts: 4 Topics: 3
|
Posted: Thu Dec 23, 2010 10:11 pm Post subject: |
|
|
Until next value arrives in first field we can consider them to a be a same group of data |
|
Back to top |
|
 |
Brian Wood Beginner
Joined: 14 Jan 2009 Posts: 37 Topics: 0 Location: USA
|
Posted: Tue Dec 28, 2010 3:49 pm Post subject: |
|
|
nithyakothai:
Using your simple example I was able to produce the desired results using these control statements (requires SyncSort for z/OS 1.3.2):
Code: | INREC IFTHEN=(WHEN=GROUP,
BEGIN=(01,01,CH,NE,X'40'),PUSH=(01:01,10))
SORT FIELDS=COPY |
Your record description idicates that the first field ('abcd') begins at position 1 for a length of 5, the second field ('pds#') begins at position 6 for a length of 45, and the third field ('mem#') begins at position 51 for a length of 10. Using this record layout the code can be modified as follows:
Code: | INREC IFTHEN=(WHEN=GROUP,
BEGIN=(01,01,CH,NE,X'40'),PUSH=(01:01,50))
SORT FIELDS=COPY |
Hope this helps! _________________ Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com |
|
Back to top |
|
 |
|
|