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 

Merging two sorted files when one may be corrupted

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Thu Jan 15, 2004 4:17 am    Post subject: Merging two sorted files when one may be corrupted Reply with quote

This relates to updating coded based on line numbers and delta card. Though both the files should have unique file number but sometime the original code has errors.

Input File ORIGINAL, corrupted with non unique line number
Code:

000100 Hi
000200 I
000300 Dibakar
000200 Biswas.
000400 Who
000500 are 
000600 you
000600 ?


Input File DELTA, correct delta code, no repitition.
Code:

000200 I'm
000400 How


Output File MERGED. First 000200 line got updated, other one is unchanged. Line 00400 is updated.
Code:

000100 Hi
000200 I'm
000300 Dibakar
000200 Biswas.
000400 How
000500 are 
000600 you
000600 ?


Currently I am using:
Code:

//MERGE015  EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DSN=DELTA,DISP=SHR                         
//         DD DSN=ORIGINAL,DISP=SHR                       
//SORTOUT  DD DSN=NEWCODE,UNIT=SYSDA,DISP=(,PASS),       
//            SPACE=(CYL,(10,1),RLSE),                   
//            DCB=(BLKSIZE=0080,LRECL=80,RECFM=FB)       
//SYSIN    DD *                                           
   SORT  FIELDS=(1,6,ZD,A),EQUALS                         
   SUM   FIELDS=NONE                                     


This gives me NEWCODE, which is not same as the required MERGED if ORIGINAL file has duplicates. Here first 00200 line got updated while the next one got deleted, and so is the second 000600 line.
Code:

000100 Hi
000200 I'm
000300 Dibakar
000400 How
000500 are 
000600 you


Thanks,
Diba.
Back to top
View user's profile Send private message Send e-mail
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Fri Jan 16, 2004 8:45 am    Post subject: Reply with quote

Diba,

The following ICETOOL job would give you the results.

Code:

//STEP1    EXEC PGM=ICETOOL                                     
//IN1      DD *                                                 
000100 HI                                                       
000200 I                                                       
000300 DIBAKAR                                                 
000200 BISWAS.                                                 
000400 WHO                                                     
000500 ARE                                                     
000600 YOU                                                     
000600 ?                                                       
/*                                                             
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//T1       DD DSN=&T1,UNIT=SYSDA,SPACE=(TRK,(1,1))             
//XSUM     DD DSN=&X,UNIT=SYSDA,SPACE=(TRK,(1,1))               
//CON1     DD DSN=&T1,DISP=SHR,VOL=REF=*.T1                     
//         DD DISP=SHR,DSN=YOUR.DELTA.INPUT                   
//CON2     DD DSN=&T1,DISP=SHR,VOL=REF=*.T1                           
//         DD DSN=&X,DISP=SHR,VOL=REF=*.XSUM                         
//OUT1     DD SYSOUT=*                                               
//TOOLIN   DD *                                                       
  SELECT FROM(IN1) TO(T1) ON(1,6,CH) FIRST DISCARD(XSUM) USING(CTL0) 
  SPLICE FROM(CON1) TO(T1) ON(1,6,CH) WITH(8,7) WITHALL KEEPNODUPS   
  SORT   FROM(CON2) TO(OUT1) USING(CTL1)                             
/*                                                                   
//CTL0CNTL DD *                                                       
*ADD SEQNUM                                                           
  INREC FIELDS=(1,20,76:SEQNUM,4,ZD,80:X)                             
/*                                                                   
//CTL1CNTL DD *                                                       
  SORT FIELDS=(76,4,ZD,A)                                             
  OUTREC FIELDS=(1,20,80:X)                                           
/*                                                                   
//


Hope this helps...

Cheers,
Coolman.
________
vaaapp


Last edited by coolman on Sat Feb 05, 2011 1:32 am; edited 1 time in total
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Thu Jan 29, 2004 3:32 am    Post subject: Reply with quote

Coolman,

I have an old sysncsort so couldn't try out your code. Moreover it was decided that in such cases we will correct the corrupt file. So, my requirement has gone too.

Sorry for the very delayed answer ... Diba.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) 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