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 

Sort selectivily only a portion of rec retaining other recs.

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


Joined: 14 Apr 2009
Posts: 5
Topics: 2

PostPosted: Thu Jun 18, 2009 10:17 pm    Post subject: Sort selectivily only a portion of rec retaining other recs. Reply with quote

I have a situation where in I need to Sort just the EX666 records. The input file will have the records as below,

EX664 1 ----
EX665 1---
EX665 1----
EX665 1---
EX666 1--
EX666 1-
EX664 1-
EX665 2
EX665 2
EX666 2
EX666 2
and so on..



The order of EX664 & EX665 should be reatained only the record containing the EX666 should be sorted for 49th pos thru 53rd pos which is for 4 bytes.
records sorting amongs the EX666 without changing the order of EX664 & EX665.

The data will always have 1 record containing EX664,
but there could be multiple records of EX665 and the max is up to 3 records.
The EX666 is also a multiple recrord and there is no max limit for this.
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: Thu Jun 18, 2009 11:10 pm    Post subject: Reply with quote

bsaishankar,

what is the LRECL and recfm of the input file? So You have groups of records which start EX664? and within each group you just need to sort EX666 records? Is that it? what is the position and format of EX664?
Show a sample of output also.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bsaishankar
Beginner


Joined: 14 Apr 2009
Posts: 5
Topics: 2

PostPosted: Fri Jun 19, 2009 7:48 am    Post subject: Reply with quote

LRECL-200 BYTES
REC FM- VB
Yes we have group of records that start with EX664 & then EX665 and EX666 for a given customer.
Yes just need to sort EX666 records only.
Position of EX664/EX665/EX666=> starts at 1st postion,5 char length (due to VB file we have to code 5 beg pos,5 char length)

Sequence number is another unique field for the customer and it starts from 7th pos, 2 bytes size char field(due to VB file we have to code 11,2)

sorted field for EX666 is 45th pos(49 due to VB file) and length is 4 bytes and is a char field.

Input sample:
EX664 1---some data continues till the 200th byte
EX665 1---some data continues till the 200th byte
EX665 1---some data continues
EX665 1---same as above
EX666 1---0005=> let say these are 45 thru 49 POSITIONS for EX666
EX666 1---0004=> let say these are 45 thru 49 POSITIONS for EX666
EX664 2------some data continues till the 200th byte
EX665 2 ---some data continues till the 200th byte
EX665 2---some data continues till the 200th byte
EX666 2---0003=> let say these are 45 thru 49 POSITIONS for EX666
EX666 2---0002=> let say these are 45 thru 49 POSITIONS for EX666
and so on..

Expected output sample:
EX664 1---some data continues till the 200th byte
EX665 1---some data continues till the 200th byte
EX665 1---some data continues
EX665 1---same as above
EX666 1---0004=> let say these are 45 thru 49 POSITIONS for EX666
EX666 1---0005=> let say these are 45 thru 49 POSITIONS for EX666
EX664 2---some data continues till the 200th byte
EX665 2 ---some data continues till the 200th byte
EX665 2---some data continues till the 200th byte
EX666 2---0002=> let say these are 45 thru 49 POSITIONS for EX666
EX666 2---0003=> let say these are 45 thru 49 POSITIONS for EX666
and so on..
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: Fri Jun 19, 2009 10:05 am    Post subject: Reply with quote

bsaishankar,

The following DFSORT JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN=your input vb file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,16X,5)),                         
  IFTHEN=(WHEN=GROUP,BEGIN=(21,5,CH,EQ,C'EX664'),PUSH=(5:ID=8,SEQ=4)),
  IFTHEN=(WHEN=(21,5,CH,EQ,C'EX666'),OVERLAY=(13:4C'9',65,4))         
  SORT FIELDS=(5,16,CH,A),EQUALS                                     
  OUTFIL BUILD=(1,4,21)                                               
//*

_________________
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