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

Overring particular postion from the file


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

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Mon May 26, 2008 11:10 am
Reply with quote

Input File1:


10000000000000000000000000000000000000000000000000000000000000000000000000000000
20000000000000000000000000000000000000000000000000000000000000000000000000000000
30033333333333333333333300330000000000000000000000000000000000000000000000000000
40044444444444444444444444440000000000000000000000000000000000000000000000000000
60000000000000000000000000000000000000000000000000000000000000000000000000000000


Input File 2:


10000000000000000000KK0000000000000000000000000000000000000000000000000000000000
20000000000000000000KK0000000000000000000000000000000000000000000000000000000000
30000000000000000000KK0000000000000000000000000000000000000000000000000000000000
40000000000000000000KK0000000000000000000000000000000000000000000000000000000000



Hi O.P File

10000000000000000000KK0000000000000000000000000000000000000000000000000000000000
20000000000000000000KK0000000000000000000000000000000000000000000000000000000000
30033333333333333333KK3300330000000000000000000000000000000000000000000000000000
40044444444444444444KK4444440000000000000000000000000000000000000000000000000000
60000000000000000000 000000000000000000000000000000000


Code:

//STEP05   EXEC PGM=SYNCSORT
//SORTJNF1 DD  DSN=File1,DISP=SHR
//SORTJNF2 DD  DSN=FILE2,DISP=SHR
//SORTOUT  DD  DSN=OUTPUTFILE,
//             DISP=(,CATLG,DELETE),
//             SPACE=(CYL,(100,100),RLSE)
//SYSOUT   DD SYSOUT=*
//SYSIN    DD *
   JOINKEYS FILES=F1,FIELDS=(1,3,A)
   JOINKEYS FILES=F2,FIELDS=(1,3,A)
   JOIN UNPAIRED
   REFORMAT FIELDS=(F2:21,2,F1:1,20,F1:23,78)


Issue:

File 1 having 5 records.. FIle 2 having 4 records

In FILE 1 and FILE 2 1st 3 character are key fields (bold letters) based on those key fields if the key fields matches in both the files override the 21st postion from the 1st file and replace it by KK( Ucan see in the o/p file ) but for the non match record should be remain same .. if you look at the p/p file u can identify spaces instead of "00"

please let me know i can retain the non matching record without alterring

Please let me know if you need more details

its syncsort product
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Mon May 26, 2008 6:42 pm
Reply with quote

Can you try with the below code. I just tried and this seems to be working.

Code:
   
   OPTION COPY                                               
   JOINKEYS FILES=F1,FIELDS=(1,3,A)                         
   JOINKEYS FILES=F2,FIELDS=(1,3,A)                         
   JOIN UNPAIRED,F1                                         
   REFORMAT FIELDS=(F1:1,80,F2:1,80)                         
   OUTFIL FNAMES=MYOUT                                       
   OUTREC IFTHEN=(WHEN=(101,2,CH,EQ,C'  '),                 
                     BUILD=(1,20,21,2,C'00',23,58)),         
          IFTHEN=(WHEN=(NONE),                               
                      BUILD=(1,20,101,2,23,58))   
           
Back to top
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Wed May 28, 2008 9:50 am
Reply with quote

hi Manuneedhi

Thats fine when you know what value you will get..

What if you dont know what value you will get in that pistion

So how we can resolve this?
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed May 28, 2008 11:21 am
Reply with quote

Sanjay,

Please check the below thread

ibmmainframes.com/viewtopic.php?t=31065&highlight=

The question there was almost similar to your's and my answer there should work for your case as well.

Thanks
Manu
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top