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 

Appending records in a file based on a Key - Syncsort

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


Joined: 08 Nov 2004
Posts: 4
Topics: 2

PostPosted: Mon Jan 08, 2007 12:56 pm    Post subject: Appending records in a file based on a Key - Syncsort Reply with quote

I apologize if a similar questions has been asked before in this forum. I searched through the posts . But couldnt anything similar to the scenario i am posting.

Requriement:One input file - 1 Million Records (Sequential file)
Format: VB
LRECL = 5980

The input file has two record types 10 and 20. The key field is in postion 8 (9 bytes - character). There can be only one 10 record and one 20 record for a key. And the file is sorted based on the key (20 record is the record next to corresponding 10 record). I have added 4 bytes to the keyfield positions since it is a variable block file.

My requirement is to create a new file out of the input file with the some data from record 10 and some data from record 20.

Example:

Input
Code:

10AABCDEFGHI      00ASD      VIJAY   1111
20BABCDEFGHI      00THIS IS A TEST FILE     P
10AEFGHIJKLM      99ASD      INDIGO   9999
20BEFGHIJKLM      99THIS IS A TEST FILE     L

My output should be:
Code:

ABCDEFGHI 00 VIJAY  1111 P
EFGHIJKLM 99 INDIGO 9999 L

I am trying to append the 20 record to the corresponding 10 record based on the key. Is there any way to accomplish that using SYNCSORT? If the records are appended into one, i can easily extract the data in need using OUTREC.

Any help in this regard would be greatly appreciated.

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


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

PostPosted: Mon Jan 08, 2007 4:17 pm    Post subject: Reply with quote

Try this job

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT    DD SYSOUT=*
//SORTIN    DD DSN=your input vb file,
//             DISP=SHR
//SORTOUT   DD SYSOUT=*
//SYSIN     DD *
 SORT FIELDS=(05,09,CH,A)
 INREC FIELDS=(01,04,
               09,09,
               X,
               24,02,
               X,
               18:5,2,CHANGE=(06,C'20',X'00'),
                      NOMATCH=(35,06),
               X,
               25:5,2,CHANGE=(1,C'10',X'00'),
                      NOMATCH=(50,1),         
               X'00')

 SUM FIELDS=(18,04,
             22,02,
             25,02),FORMAT=BI

/*                                   


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu


Last edited by kolusu on Mon Jan 08, 2007 8:51 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
s_vijay_s
Beginner


Joined: 08 Nov 2004
Posts: 4
Topics: 2

PostPosted: Mon Jan 08, 2007 6:39 pm    Post subject: Reply with quote

Thanks Kolusu. I tried the sort card you have given and i am getting "WER244A INREC - SHORT RECORD" error.

I ran the HISTOGRM to check the length of the input VB file. This is the information that is getting displayed.

AVERAGE RECORD LENGTH......... 47
LONGEST RECORD................ 49
SHORTEST RECORD............... 45

Do i need to change anything in the sort card? I am novice with SYNCSORT; can you explain your Sort card?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Jan 08, 2007 8:57 pm    Post subject: Reply with quote

s_vijay_s,

I wrote the sort card based on your sample input and I assumed positions of couple of fileds. Tell me the exact positions of the following

1. Where does the indicator 10 or 20 start in the input file?
2. As per your description the key starts at pos 9 (including rdw) ? Is that right?
3. Where does the value 00 & 99 start in the input file?
4. Where does the fields Vijay and Indigo start in the input file?
5. Where does the values "p" & "L" start in the input file?
6. Do you want the output also to be a VB file ? or a fB file?
7. What is the version of syncsort you are running? You can find this in the first line of your sysout from the sort job.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
s_vijay_s
Beginner


Joined: 08 Nov 2004
Posts: 4
Topics: 2

PostPosted: Mon Jan 08, 2007 11:28 pm    Post subject: Reply with quote

Kolusu,
Sorry I should have made my requirements clear in my first post. All the positions i have mentiond below are inclusive of the RDW.

1) Indicator 10 or 20 start at position 5
2) The Key field starts at position 8 and is 9 bytes long.
3) 00 or 99 start at position 23
4) Vijay or Indigo starts at 34 and is 9 byte long
5) P or L starts at 49
6) The output should also be an VB file
7) "SYNCSORT FOR Z/OS 1.2.1.0R" is the version of SYNCSORT I am running.

Thanks for your help.
Vijay
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jan 09, 2007 11:55 am    Post subject: Reply with quote

s_vijay_s,

Code:

//SYSIN     DD * 
 SORT FIELDS=(05,09,CH,A)
 INREC FIELDS=(01,04,
               08,09,
               23,02,
               5,2,CHANGE=(09,C'20',X'00'),
                   NOMATCH=(34,09),
               5,2,CHANGE=(1,C'10',X'00'),
                   NOMATCH=(49,1))                                           

 SUM FIELDS=(16,08,
             24,02),FORMAT=BI
/*                                         


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