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 

Merge files and replace last digit

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


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Tue Nov 25, 2008 4:38 pm    Post subject: Merge files and replace last digit Reply with quote

I searched the forum and couldn't find any post which satisfied my criteria , Hence creating a new thread.

I need to replace the last digit in the 2nd file and merge the file. Here's an example:

File 1
Header:1
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx01
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx02
.
.
.
.
.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx43
Trailer1
File 2
Header1 ( The header in both the files will be the same)
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy01
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy02
.
.
.
.
.
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy47
Trailer2
Output file:
Header 1
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx01
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx02
.
.
.
.
.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx43
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy44
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy02
.
.
.
.
.
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy100
Trailer1
Trailer2
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: Tue Nov 25, 2008 5:29 pm    Post subject: Reply with quote

Martin,

Are u just re-sequencing the second file with a number after the first file? if so concatenate both files and use the following DFSORT JCL

Code:

//STEP0100 EXEC  PGM=ICEMAN               
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD *                           
HEADER:1                                   
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX01       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX02       
.                                         
.                                         
.                                         
.                                         
.                                         
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX43       
TRAILER1                                   
//         DD *                           
HEADER1                                   
YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY01       
YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY02       
.                                         
.                                         
.                                         
.                                         
.                                         
YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY47       
TRAILER2                                   
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                                                     
  OPTION EQUALS                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'2')),                       
  IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),OVERLAY=(81:C'1',SEQNUM,1,ZD)),
  IFTHEN=(WHEN=(1,7,CH,EQ,C'TRAILER'),OVERLAY=(81:C'9'))           
  SORT FIELDS=(81,1,CH,A)                                           
  OUTFIL IFOUTLEN=80,OMIT=(82,1,ZD,EQ,2),                           
  IFTHEN=(WHEN=(81,1,ZD,EQ,2),OVERLAY=(34:SEQNUM,3,ZD))             
//*

_________________
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