Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Find, match and replace

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Find, match and replace
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    Post subject: Reply to: Find, match and replace
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    Post subject:
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    Post subject: Reply to: Find, match and replace
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Sat Jun 25, 2011 4:26 am    Post subject:
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: 1703
Location: Australia

PostPosted: Sat Jun 25, 2011 5:21 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Match records - scdinesh DFSORT/ICETOOL 6 Wed Feb 22, 2017 5:02 am
No new posts JCL sort Match and NoMatch rakeshsekar1987 SYNCSORT 2 Thu Feb 02, 2017 10:26 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us