IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SORT - 2 files and generate one file -override one parameter


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mohanrazz

New User


Joined: 30 Sep 2008
Posts: 30
Location: India

PostPosted: Fri Oct 24, 2008 11:17 am
Reply with quote

Hi,

I have two input files and I have to generate third output file. Requirement is as below.

From 11th to 12th charecters of the second input file need to be replaced with 1th to 12th charecters of the first input file - and generate the third output file

Thanks in advance
Back to top
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Fri Oct 24, 2008 11:34 am
Reply with quote

Hi mohanrazz,
Your requirement is not much clear.What you mean by "From 11th to 12th charecters of the second input file need to be replaced with 1th to 12th charecters of the first input file".
Replace the character if the two files have a common key? or
To replace the character in the 1 record in first file with 1st record in second file..2 record in 1st file 2nd record in 2nd file.... is it like that?
Back to top
View user's profile Send private message
mohanrazz

New User


Joined: 30 Sep 2008
Posts: 30
Location: India

PostPosted: Fri Oct 24, 2008 11:38 am
Reply with quote

bipin,

first file
Code:
abcdefghij12klmnopqrst


second file
Code:
          89         


my output file should be

Code:
abcdefghij89klmnopqrst


that means 12 (11th and 12th chars of first file) are replaced by 89 (11th and 12th chars of second file) -

Pls let me know how to do that in jcl
thanks.
Back to top
View user's profile Send private message
mohanrazz

New User


Joined: 30 Sep 2008
Posts: 30
Location: India

PostPosted: Fri Oct 24, 2008 11:38 am
Reply with quote

Also both the files have only one record each
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 24, 2008 9:04 pm
Reply with quote

mohanrazz,

Use the following DFSORT JCL if both files are of the same LRECL and RECFM

Code:

//STEP0100 EXEC PGM=ICEMAN                           
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                       
ABCDEFGHIJ12KLMNOPQRST                               
//         DD *                                       
          89                                         
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                       
  OPTION EQUALS,ZDPRINT                               
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,1,ZD)), 
  IFTHEN=(WHEN=(81,1,ZD,EQ,1),OVERLAY=(11:C'00')),   
  IFTHEN=(WHEN=(81,1,ZD,EQ,2),OVERLAY=(81:C'1'))     
  SORT FIELDS=(81,1,CH,A)                             
  SUM FIELDS=(11,2,ZD)                               
  OUTFIL BUILD=(1,80)                                 
/*                                                   


And if the files are of different LRECL then use the following DFSORT JCL

Code:

//STEP0100 EXEC PGM=ICEMAN                                 
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
          89                                               
//SORTOUT  DD DSN=&&T1,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN    DD *                                           
  OPTION COPY                                             
  OUTREC BUILD=(C'SRNO,C''',11,2,C'''',80:X)               
/*                                                         
//STEP0200 EXEC PGM=ICEMAN                                 
//SYMNAMES DD DSN=&&T1,DISP=SHR                           
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
ABCDEFGHIJ12KLMNOPQRST                                     
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  OPTION COPY                                             
  INREC OVERLAY=(11:SRNO)                                 
/*   
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top