MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DFSORT- Selective Detail Records sorting with Headers

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
dips
Beginner


Joined: 21 Jun 2006
Posts: 9
Topics: 4
Location: Bangalore

PostPosted: Wed Jan 10, 2007 4:14 am    Post subject: DFSORT- Selective Detail Records sorting with Headers Reply with quote

Hi,

I am trying to sort a file using DFSORT. But the difficult part is that I have Record type 1 records and Record type 2 records. Only the record type 2 records should be sorted based on (4,4,CH,A,11,9,CH,A) and record type 1 records should be copied as is. Even the order of record type 1 should remain as is.

Ex: if the input file is
Code:

$$ADD  ID=A401251   BATCHID='XX 
DTLBXUB   6246845130000006111 
DTLBXUZ   1694640540000005745 
DTLBXUB   5483380830000006104 
DTLBXUA   5541551250000006155 
DTLBXUM   5669928810000005793 
DTLBXUB   6246845130000006111 
$$ADD  ID=A401245   BATCHID='XX
DTLBXUZ   XXXXXXXXX0000005745 
DTLBXUA   1111111110000006104 
$$ADD  ID=A401244   BATCHID='XX
DTLBXUB   2222222220000006155 
$$ADD  ID=A401241   BATCHID='XX
DTLBXUB   3333333330000005793 
DTLBXUR   4444444440000006111 
DTLBXUB   5555555550000006111 

output:
Code:

----------
$$ADD  ID=A401251   BATCHID='XX 
DTLBXUA   5541551250000006155 
DTLBXUB   5483380830000006104 
DTLBXUB   6246845130000006111 
DTLBXUB   6246845130000006111 
DTLBXUM   5669928810000005793 
DTLBXUZ   1694640540000005745 
$$ADD  ID=A401245   BATCHID='XX
DTLBXUA   1111111110000006104 
DTLBXUZ   XXXXXXXXX0000005745 
$$ADD  ID=A401244   BATCHID='XX
DTLBXUB   2222222220000006155 
$$ADD  ID=A401241   BATCHID='XX
DTLBXUB   3333333330000005793 
DTLBXUB   5555555550000006111 
DTLBXUR   4444444440000006111 



Records begining with $$ADD should not be touched. Only the records begining with DTL should be sorted based the above mentioned fields with $ADD records simply copied.

Is there anyone who can help me with this?

Thanks,
Deepa
_________________
Thanks,
Deepa
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Jan 10, 2007 9:12 am    Post subject: Reply with quote

dips,

Please Search before posting. check this link

http://www.mvsforums.com/helpboards/viewtopic.php?t=5398

You can try this DFSORT job to get the desired results.

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD *
$$ADD  ID=A401251   BATCHID='XX 
DTLBXUB   6246845130000006111 
DTLBXUZ   1694640540000005745 
DTLBXUB   5483380830000006104 
DTLBXUA   5541551250000006155 
DTLBXUM   5669928810000005793 
DTLBXUB   6246845130000006111 
$$ADD  ID=A401245   BATCHID='XX
DTLBXUZ   XXXXXXXXX0000005745 
DTLBXUA   1111111110000006104 
$$ADD  ID=A401244   BATCHID='XX
DTLBXUB   2222222220000006155 
$$ADD  ID=A401241   BATCHID='XX
DTLBXUB   3333333330000005793 
DTLBXUR   4444444440000006111 
DTLBXUB   5555555550000006111 
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  INREC IFTHEN=(WHEN=INIT,
        BUILD=(001,80,
               081:SEQNUM,8,ZD,
               089:16C'0',
               105:C'B')),
        IFTHEN=(WHEN=(1,5,CH,EQ,C'$$ADD'),
        OVERLAY=(081:8C'0',
                 089:SEQNUM,8,ZD,
                 105:C'A'),HIT=NEXT),
        IFTHEN=(WHEN=(1,3,CH,EQ,C'DTL'),
        OVERLAY=(089:SEQNUM,8,ZD,START=1,INCR=1),HIT=NEXT),
        IFTHEN=(WHEN=(105,1,SS,EQ,C'AB'),
        OVERLAY=(097:(081,8,ZD,SUB,089,8,ZD),M11,LENGTH=8))

  SORT FIELDS=(097,8,CH,A,
               105,1,CH,A,
               004,4,CH,A,
               011,9,CH,A)

  OUTREC BUILD=(01,80)
/*                     


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group