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

Find, match and replace


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Apotheosis

New User


Joined: 27 Oct 2006
Posts: 8
Location: USA

PostPosted: Sat Jun 25, 2011 2:43 am
Reply with quote

I have a requirement where I am trying to match two files based on a common key, if they key matches, then I have to take a corresponding field from the matching key from file 2 and update it in file 1.

File1 -

Lrecl of 80, FB.
Field-Name is from character 18 to 38.

File2 -
Lrecl of 80, FB

Name1 is from character 1 to 20
Name2 is from character 30 to 50

If Name2 is present in File1 as Field-name, then replace Name1 in place of Field-name in File1. This has to be done for hundred's of records in File2.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Sat Jun 25, 2011 3:29 am
Reply with quote

Apotheosis wrote:
then replace Name1 in place of Field-name in File1. This has to be done for hundred's of records in File2.


It would have helped if you posted some sample data. try this
Code:

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//INA      DD *                             
----+----1----+----2----+----3----+----4----+
 RECORD -1       APOTHEOSIS                 
 RECORD -2       ANDERSON                   
 RECORD -3       NORECORD                   
//INB      DD *                             
COOPER                       ANDERSON       
LASTNAME                     APOTHEOSIS     
BLAHBLAH                     NOMATCH         
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                             
  OPTION COPY                               
  JOINKEYS F1=INA,FIELDS=(18,20,A)           
  JOINKEYS F2=INB,FIELDS=(30,20,A)           
  REFORMAT FIELDS=(F1:1,17,F2:1,20,F1:38,43)
//*


The output is
Code:

 RECORD -2       COOPER   
 RECORD -1       LASTNAME 
Back to top
View user's profile Send private message
Apotheosis

New User


Joined: 27 Oct 2006
Posts: 8
Location: USA

PostPosted: Sat Jun 25, 2011 3:51 am
Reply with quote

Thanks Skolusu,

I get this error on using the code -

Code:

//IN1      DD DSN=OFFRHG.REGISTER.BACKUP,DISP=OLD
//IN2      DD DSN=OFFRHG.REGISTER.NAMES,DISP=OLD               
//SYSIN    DD *                                               
!!!ERROR 08:                                                   
     
!!!ERROR 08:              *                                   
!!!ERROR 08:                                                   
     
!!!ERROR 08:              *                                   
!!!ERROR 08:   WER268A  JOINKEYS STATEMENT: SYNTAX ERROR       
!!!ERROR 08:   WER268A  JOINKEYS STATEMENT: SYNTAX ERROR       
  OPTION COPY                                                 
  JOINKEYS F1=IN1,FIELDS=(18,20,A)                             
  JOINKEYS F2=IN2,FIELDS=(30,20,A)                             
  REFORMAT FIELDS=(F1:1,17,F2:1,20,F1:38,43)                   
/*                                                             


Don't see anything wrong with the syntax though.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Sat Jun 25, 2011 3:57 am
Reply with quote

Apotheosis,

The job runs fine with DFSORT. The messages indicates you are using SYNCSORT. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
View user's profile Send private message
Apotheosis

New User


Joined: 27 Oct 2006
Posts: 8
Location: USA

PostPosted: Sat Jun 25, 2011 4:01 am
Reply with quote

Thanks Skolusu, must be having a bad day because fortunately my shop has ICETOOL as well, changed the job to use ICETOOL and it fails with a return code 20, exp 20. Need to have a look at this.
Back to top
View user's profile Send private message
Apotheosis

New User


Joined: 27 Oct 2006
Posts: 8
Location: USA

PostPosted: Sat Jun 25, 2011 4:10 am
Reply with quote

Code:

//******************************************************
//PS010    EXEC  PGM=ICETOOL                           
//IN1      DD DSN=OFFRHG.REGISTER.BACKUP,DISP=OLD       
//IN2      DD DSN=OFFRHG.REGISTER.NAMES,DISP=OLD       
//SYSIN    DD *                                         
  OPTION COPY                                           
  JOINKEYS F1=IN1,FIELDS=(18,20,A)                     
  JOINKEYS F2=IN2,FIELDS=(30,20,A)                     
  REFORMAT FIELDS=(F1:1,17,F2:1,20,F1:38,43)           
/*                                                     
//SYSPRINT DD SYSOUT=*                                 
//SYSOUT   DD SYSOUT=*                                 
//SYSTSPRT DD SYSOUT=*                                 
//SYSABOUT DD SYSOUT=*                                 
//SYSDBOUT DD SYSOUT=*                                 
//SYSUDUMP DD SYSOUT=*                                 
//SYSTERM  DD SYSOUT=*                                 
//SORTDIAG DD SYSOUT=*                                 
//*                                                     


Error -


#STEPNAME PROCSTEP PROGRAM RC EXCP
#PS010 ICETOOL 20 18

Code:
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Jun 25, 2011 4:26 am
Reply with quote

Apotheosis,

Wow. You really are confused!

DFSORT's ICETOOL is only available with DFSORT. Since you have Syncsort, you are actually using SYNCTOOL, not ICETOOL. Full doc for DFSORT's ICETOOL is available on the web. Doc for Syncsort's SYNCTOOL is not available at all.

ICETOOL/SYNCTOOL use different JCL and syntax then DFSORT/Syncsort. You can't just change PGM=SORT to PGM=ICETOOL and expect it to work. You got the RC=20 because you don't have the correct JCL. But those DFSORT statements won't work with Syncsort or SYNCTOOL, even if you get the JCL right, because Syncsort doesn't support some of the keywords that DFSORT supports for JOINKEYS.

I'm moving your Topic to JCL where somebody might (or might not) help you to use Syncsort or SYNCTOOL to do what you want.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sat Jun 25, 2011 5:21 am
Reply with quote

Hi,

this should work for SYNCSORT
Code:
//STEP1    EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTJNF1 DD *                                             
 RECORD -1       APOTHEOSIS                                 
 RECORD -2       ANDERSON                                   
 RECORD -3       NORECORD                                   
//SORTJNF2 DD *                                             
COOPER                       ANDERSON                       
LASTNAME                     APOTHEOSIS                     
BLAHBLAH                     NOMATCH                       
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  OPTION COPY                                               
  JOINKEYS FILE=F1,FIELDS=(18,20,A)                         
  JOINKEYS FILE=F2,FIELDS=(30,20,A)                         
  REFORMAT FIELDS=(F1:1,17,F2:1,20,F1:38,43)               


Gerry
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
Search our Forums:

Back to Top