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 

Help with merging two records

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


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Mon Jun 28, 2010 1:11 pm    Post subject: Help with merging two records Reply with quote

Hi ,
I need a one time job that can merge the data.here are the requirements

Key is 1 - 14 char

Acct 16-19


For each key we can have a max. of 2 accts (1657 & 1857)

I want to merge these two accounts for each key in 1 record.

Input

Code:

----+----1----+----2----+----3----+----4----
***************************** Top of Data **
01078,20,08,01,1657,T,01,00,+,0,542,499,   
01078,20,08,02,1857,T,01,00,+,0,543,500,   
01088,20,09,03,1657,T,03,00,+,0,506,500,   
01088,20,09,03,1857,T,03,00,+,0,507,501,   



Output:



Code:

----+----1----+----2----+----3----+----4----+----
***************************** Top of Data *******
01078,20,08,01,1657,542,499,1857,543,500         
01088,20,09,03,1657,506,500,1857,507,501         



I can do this using cobol.Since this is 1 time,I need help doing this using SORT.


Thanks,
Vijay
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: Mon Jun 28, 2010 1:23 pm    Post subject: Reply with quote

vijay,

Use the following DFSORT JCL. I assumed that input lrecl is FB 80 bytes and the input is already sorted on the key
Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
01078,20,08,01,1657,T,01,00,+,0,542,499,                       
01078,20,08,02,1857,T,01,00,+,0,543,500,                       
01088,20,09,03,1657,T,03,00,+,0,506,500,                       
01088,20,09,03,1857,T,03,00,+,0,507,501,                       
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:SEQ=1)),         
  IFTHEN=(WHEN=GROUP,BEGIN=(81,1,ZD,EQ,1),PUSH=(82:13,8,33,7))
  OUTFIL INCLUDE=(81,1,ZD,EQ,2),BUILD=(1,12,82,15,15,6,33,7)   
//*


The output is FB 40 bytes
Code:

01078,20,08,01,1657,542,499,1857,543,500
01088,20,09,03,1657,506,500,1857,507,501

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


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Mon Jun 28, 2010 1:54 pm    Post subject: Reply with quote

Thanks Kolusu,But this is working only if I have 2 records per key all the time.

If I've only 1 account, I need the output like this

01078,20,08,01,1657,542,499,xxxx,xxx,xxx
01078,20,08,01,xxxx,xxx,xxx,1857,543,500

Where x = blank

Thanks,
VIjay
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Mon Jun 28, 2010 2:22 pm    Post subject: Reply with quote

Please think about what you finally need and post the complete definition.

It is a great waste of time to post the requirement bit by bit and expect a new soluton for each iteration. . .
_________________
All the best,

di
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: Mon Jun 28, 2010 2:41 pm    Post subject: Reply with quote

vijay wrote:
Thanks Kolusu,But this is working only if I have 2 records per key all the time.

If I've only 1 account, I need the output like this

01078,20,08,01,1657,542,499,xxxx,xxx,xxx
01078,20,08,01,xxxx,xxx,xxx,1857,543,500

Where x = blank

Thanks,
VIjay


Vijay,

huh? how did you end up with 2 records and 2 different values from a single record?

Also you mention that the key is 14 bytes but if you look at the first 2 records the key is different in bytes 13 and 14 . And how do you determine where to pad the spaces in terms of a single record. start over and show me all the possible variations inputs and desired results.
_________________
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