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
 

 

Overring particular postion from the file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Overring particular postion from the file
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    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

Sanjay,

Please check the below thread

http://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    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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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