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
 

 

Problem in SPLICE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1530
Location: Andromeda Galaxy

PostPosted: Thu Feb 26, 2009 9:53 pm    Post subject: Problem in SPLICE
Reply with quote

I am trying to compare the files

File 1
Code:



A11 A22222222 UPDATE                                 
A11 A33333333 UPDATE                                 
A22 A33333333 UPDATE                                 



File 2

Code:


A11 A22222222 UPD1                         
A11 A33333333 UPD2                         
A22 A33333333 UPD3     




Using the code


Code:


//TOOLIN  DD *                                                         
  COPY FROM(IN1) TO(T1) USING(CTL1)                                     
  COPY FROM(IN2) TO(T1) USING(CTL2)                                     
  SELECT FROM(T1) TO(T2) ON(1,3,CH) ON(5,9,CH) ON(15,12,CH) NODUPS     
  SPLICE FROM(T2) TO(OUT12) ON(1,3,CH) ON(5,9,CH) WITH(28,1) -         
  USING(CTL3) KEEPNODUPS                                               
/*                                                                     
//CTL1CNTL DD *                                                         
  INREC OVERLAY=(27:C'11')                                             
/*                                                                     
//CTL2CNTL DD *                                                         
  INREC OVERLAY=(27:C'22')                                             
/*                                                                     
//CTL3CNTL DD *                                                         
  OUTFIL FNAMES=OUT12,INCLUDE=(27,2,CH,EQ,C'12'),BUILD=(1,26,C'U')     
  OUTFIL FNAMES=OUT1,INCLUDE=(27,2,CH,EQ,C'11'),BUILD=(1,26,C'I')       
  OUTFIL FNAMES=OUT2,INCLUDE=(27,2,CH,EQ,C'22'),BUILD=(1,26,C'D')       
/*                                                                     



yieds me proper results

But if

File 2 is and third field contains spaces it doesnt yield me what I need
Can any one clarify please?

Code:


A11 A22222222
A11 A33333333 
A22 A33333333 




Thanks
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: Fri Feb 27, 2009 12:03 am    Post subject:
Reply with quote

Well, you haven't explained what it is you need. You just showed us some code and some results without any context.

Please start over and give a good example of the records in each input file and what you expect for each output file. Explain the "rules" for getting from input to output.

Do you really want three output files or do you actually want one output file but didn't know how to get it?.

Give the RECFM and LRECL of the input files. Give the starting position, length and format of each relevant field.

I suspect there's a better way to do what you want, but I'd have to know what you're trying to do before I could help you.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1530
Location: Andromeda Galaxy

PostPosted: Fri Feb 27, 2009 1:05 pm    Post subject:
Reply with quote

Hi,

File 1
Code:


A11 A22222222 UPDATE                                 
A11 A33333333 UPDATE                                 
A22 A33333333 UPDATE 



Code:


A11 A22222222
A11 A33333333 
A22 A33333333 



Output should be


OUT
Code:



A11 A22222222             U
A11 A33333333             U
A22 A33333333             U
 
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1530
Location: Andromeda Galaxy

PostPosted: Fri Feb 27, 2009 7:42 pm    Post subject:
Reply with quote

To make it more clear I will give with much better example

FILE1

Code:

//STEP001 EXEC PGM=ICETOOL                                           
//TOOLMSG DD SYSOUT=*                                                 
//DFSMSG  DD SYSOUT=*                                                 
//IN1     DD *                                                       
A11 A22222222 UPDATE                                                 
A11 A33333333 UPDATE                                                 
A22 A33333333 UPDATE                                                 
A33 A33333333 UPDATE                                                 
A44 A33333333 UPDATE                                                 
//IN2     DD *                                                       
A11 A22222222                                                         
A11 A33333333                                                         
A22 A33333333                                                         
A33 A33333333 UPDATE                                                 
A55 A33333333 UPDATE                                                 
//T1      DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(555,555)),               
//           DISP=(MOD,PASS)                                         
//OUT12   DD SYSOUT=*                                                 
//OUT2    DD SYSOUT=*                                                 
//OUT1    DD SYSOUT=*                                                 
//TOOLIN  DD *                                                       
  COPY FROM(IN1) TO(T1) USING(CTL1)                                   
  COPY FROM(IN2) TO(T1) USING(CTL2)                   
  SPLICE FROM(T1) TO(OUT12) ON(1,3,CH) ON(5,9,CH) WITH(28,1) WITHEACH -
  KEEPNODUPS USING(CTL3)                                               
//*                                                                   
//CTL1CNTL DD *                                                       
 INREC OVERLAY=(27:C'11')                                             
//*                                                                   
//CTL2CNTL DD *                                                       
 INREC OVERLAY=(27:C'22')                                             
//*                                                                   
//CTL3CNTL DD *                                                       
 OUTFIL FNAMES=OUT12,INCLUDE=(27,2,CH,EQ,C'12'),BUILD=(1,26,C'U')     
 OUTFIL FNAMES=OUT1,INCLUDE=(27,2,CH,EQ,C'11'),BUILD=(1,26,C'I')     
 OUTFIL FNAMES=OUT2,INCLUDE=(27,2,CH,EQ,C'22'),BUILD=(1,26,C'D')     
//*                                                                     





I want output to be like

OUT12

Code:


A11 A22222222 UPDATE      U       
A11 A33333333 UPDATE      U       
A22 A33333333 UPDATE      U       





OUT2

Code:


A55 A33333333 UPDATE      D                     



OUT1

Code:


A44 A33333333 UPDATE      I     



But I am not able to elimanate the record which is having a match

Here my key is

key1 - 1,3

Key2 - 5,9

But all I get in

OUT12 is

Code:


A11 A22222222 UPDATE      U                                                     
A11 A33333333 UPDATE      U                                                     
A22 A33333333 UPDATE      U                                                     
A33 A33333333 UPDATE      U                                                     



Thanks.
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: Fri Feb 27, 2009 10:38 pm    Post subject:
Reply with quote

It would make it more clear if you would actually explain the "rules" you want to use for getting from input to output. What you want seems to have something to do with the 3rd field in the files, but you haven't said anything about a condition involving that 3rd field.

Quote:
But I am not able to elimanate the record which is having a match


A match on what? You talk about the two keys, but the 3rd field seems to be involved too. How?

In your latest example, the first 4 records all match by your two keys. The first 3 records have UPDATE for the 3rd field in file1 and blanks for the 3rd field in file2. The 4th record has UPDATE for the 3rd field in file1 and UPDATE for the 3rd field in file2. You seem to want the first 3 records in OUT12 but not the 4th record. But you haven't ever explained what the "rules" are for doing that. Do you want to eliminate records which match on the key fields AND the 3rd field? Or do you want something else? You really need to explain what you want to do.

Also, what is the starting position and length of the 3rd field?
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1530
Location: Andromeda Galaxy

PostPosted: Sun Mar 01, 2009 1:04 pm    Post subject:
Reply with quote

Hi Frank,

The rules goes this way

If the keys from file1 are not matching with keys with file 2 then the record should be identified for Insertion and I at the last position

If the keys from file2 are not matching with keys with file 1 then the record should be identified for Deletion and D at the last position

And if keys are matching but the other fileds getting changed in file 1 with that of file 2 after comparison then they need to identified as update.

And I need remove all those records which are matching in file1 and file2.
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: Sun Mar 01, 2009 11:13 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//STEP001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1     DD *
A11 A22222222 UPDATE
A11 A33333333 UPDATE
A22 A33333333 UPDATE
A33 A33333333 UPDATE
A44 A33333333 UPDATE
/*
//IN2     DD *
A11 A22222222
A11 A33333333
A22 A33333333
A33 A33333333 UPDATE
A55 A33333333 UPDATE
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(555,555)),
//   DISP=(MOD,PASS)
//OUT12   DD SYSOUT=*
//OUT2    DD SYSOUT=*
//OUT1    DD SYSOUT=*
//TOOLIN  DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT12) ON(1,3,CH) ON(5,9,CH) KEEPNODUPS -
  WITH(27,1) WITH(29,13) USING(CTL3)
/*
//CTL1CNTL DD *
 INREC OVERLAY=(27:C'II',29:13X)
/*
//CTL2CNTL DD *
 INREC OVERLAY=(27:C'DD',29:14,13)
/*
//CTL3CNTL DD *
 OUTFIL FNAMES=OUT12,
   INCLUDE=(27,2,CH,EQ,C'DI',AND,14,13,CH,NE,29,13,CH),
   BUILD=(1,26,27:C'U')
 OUTFIL FNAMES=OUT1,
   INCLUDE=(27,2,CH,EQ,C'II'),
   BUILD=(1,27)
 OUTFIL FNAMES=OUT2,
   INCLUDE=(27,2,CH,EQ,C'DD'),
   BUILD=(1,27)
/*
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm
No new posts Problem with GETMAIN command amitc23 CICS 6 Thu Sep 01, 2016 1:01 pm


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