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
 

 

Syncsort - Overlay value on matching records.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Oct 03, 2013 8:53 am    Post subject: Syncsort - Overlay value on matching records.
Reply with quote

I have two files (LRECL=80, RECFM=FB). There are 10 records in file-1 and 1000 records in file-2. There are 5 matching records between file-1 and file-2.

FILE-1:
Code:

----+----+----+----+----+----+----+----+----+----+ 
KEY000   35S960    FIADXERAC%!
KEY111   010K23    XXXXXXXXXXX
KEY222   580A34    YYYYYYYYYYY
KEY333   924T13    XYXYXYXYXYX
KEY444   P65340    #ABJ@!CCTCC
KEY555   00C983    CTXJSERVOLP
KEY666   403060    ASTLFJKA3I@
KEY777   3G9286    UALSAMNUJEL
KEY888   69573V    PFISLCJRETX
KEY999   1030X0    ESIRQMECHAL


FILE-2: Sample records
Code:

----+----+----+----+----+----+----+----+----+----+ 
KEY000   35S960    FIADXERAC%!
KEY001   001200    K;JIWRXKOO3
KEY111   010K23    XXXXXXXXXXX
KEY112   930203    SERIES8AM94
KEY222   580A34    YYYYYYYYYYY
KEY223   45093H    TOOLIPTOOLO
KEY333   924T13    XYXYXYXYXYX
KEY334   238992    WOEIASD;FWE
KEY444   P65340    #ABJ@!CCTCC
KEY495   J04511    NLKJIOBEP1X
KEY555   00C983    CTXJSERVOLP
KEY566   93120O    GYTONBCZPQM
KEY666   403060    ASTLFJKA3I@
KEY990   1209X5    BIJAMLARTYP


My requirement is to overlay "999999" from file-1 onto file-2 at 10th position for all matching records but at the same time output should also have all the records along with changed records. Please help me in achieving this.

Expected Output:
Code:

----+----+----+----+----+----+----+----+----+----+ 
KEY000   999999    FIADXERAC%!
KEY001   001200    K;JIWRXKOO3
KEY111   999999    XXXXXXXXXXX
KEY112   930203    SERIES8AM94
KEY222   999999    YYYYYYYYYYY
KEY223   45093H    TOOLIPTOOLO
KEY333   999999    XYXYXYXYXYX
KEY334   238992    WOEIASD;FWE
KEY444   999999    #ABJ@!CCTCC
KEY495   J04511    NLKJIOBEP1X
KEY555   999999    CTXJSERVOLP
KEY566   93120O    GYTONBCZPQM
KEY666   999999    ASTLFJKA3I@
KEY990   1209X5    BIJAMLARTYP


Please help.

Thanks.
Back to top
View user's profile Send private message

mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Thu Oct 03, 2013 11:58 am    Post subject:
Reply with quote

Hi Ramsri:

You can try this job:

Code:
//STEP01   EXEC PGM=SORT
//SORTJNF1 DD *               
KEY000   35S960    FIADXERAC%!
KEY111   010K23    XXXXXXXXXXX
KEY222   580A34    YYYYYYYYYYY
KEY333   924T13    XYXYXYXYXYX
KEY444   P65340    #ABJ@!CCTCC
KEY555   00C983    CTXJSERVOLP
KEY666   403060    ASTLFJKA3I@
KEY777   3G9286    UALSAMNUJEL
KEY888   69573V    PFISLCJRETX
KEY999   1030X0    ESIRQMECHAL
//SORTJNF2 DD *               
KEY000   35S960    FIADXERAC%!
KEY001   001200    K;JIWRXKOO3
KEY111   010K23    XXXXXXXXXXX
KEY112   930203    SERIES8AM94
KEY222   580A34    YYYYYYYYYYY
KEY223   45093H    TOOLIPTOOLO
KEY333   924T13    XYXYXYXYXYX
KEY334   238992    WOEIASD;FWE
KEY444   P65340    #ABJ@!CCTCC
KEY495   J04511    NLKJIOBEP1X
KEY555   00C983    CTXJSERVOLP
KEY566   93120O    GYTONBCZPQM
KEY666   403060    ASTLFJKA3I@
KEY990   1209X5    BIJAMLARTYP
//SORTOUT  DD SYSOUT=*         
//SYSOUT   DD SYSOUT=*                                         
//SYSIN    DD *                                               
    JOINKEYS FILE=F1,FIELDS=(1,6,A)                           
    JOINKEYS FILE=F2,FIELDS=(1,6,A)                           
    JOIN     UNPAIRED,F2                                       
    REFORMAT FIELDS=(F2:1,30,F1:10,6),FILL=C'?'               
    OPTION   COPY                                             
    INREC    IFTHEN=(WHEN=(31,6,CH,EQ,C'??????'),BUILD=(1,30)),
             IFTHEN=(WHEN=NONE,OVERLAY=(10:C'999999'))         
    OUTREC   BUILD=(1,30)                                     

Output:
Code:
KEY000   999999    FIADXERAC%!
KEY001   001200    K;JIWRXKOO3
KEY111   999999    XXXXXXXXXXX
KEY112   930203    SERIES8AM94
KEY222   999999    YYYYYYYYYYY
KEY223   45093H    TOOLIPTOOLO
KEY333   999999    XYXYXYXYXYX
KEY334   238992    WOEIASD;FWE
KEY444   999999    #ABJ@!CCTCC
KEY495   J04511    NLKJIOBEP1X
KEY555   999999    CTXJSERVOLP
KEY566   93120O    GYTONBCZPQM
KEY666   999999    ASTLFJKA3I@
KEY990   1209X5    BIJAMLARTYP
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Thu Oct 03, 2013 1:47 pm    Post subject: Reply to: Syncsort - Overlay value on matching records.
Reply with quote

You don't need the OUTREC.

If you use IFOUTLEN=30 on the INREC, then all the output will have 30 bytes, but you can have access to the data beond the 30 bytes in any IFTHENs.
Code:


 INREC   IFOUTLEN=30,
         IFTHEN=(WHEN=(31,6,CH,NE,C'??????'),
                       OVERLAY=(10:C'999999'))   
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Thu Oct 03, 2013 3:35 pm    Post subject:
Reply with quote

Thanks Bill. :-)

Initially I tried BUILD=(1,30) on WHEN=INIT condition but in next WHEN condition, I was not able to access data after 30 bytes. So used OUTREC.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Oct 03, 2013 4:10 pm    Post subject: Reply to: Syncsort - Overlay value on matching records.
Reply with quote

Wonderful mistah kurtz..........you saved my day. Thanks a lot icon_biggrin.gif
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Oct 03, 2013 4:33 pm    Post subject: Reply to: Syncsort - Overlay value on matching records.
Reply with quote

this is without using FILL on REFORMAT -

Code:

INREC    IFTHEN=(WHEN=(10,6,CH,EQ,31,6,CH),           
                 OVERLAY=(10:C'999999',31:C'      '))
OUTREC   BUILD=(1,30)                                 


Thanks.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Thu Oct 03, 2013 4:37 pm    Post subject: Reply to: Syncsort - Overlay value on matching records.
Reply with quote

Ramsri,

Did you read everything? You don't need the OUTREC or an INREC with all of that.

You didn't indicate that space is not a valid value for your field, so the FILL was chosen, The default for FILL is space.
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Matching with Key at different postions. rajatbagga DFSORT/ICETOOL 12 Wed Nov 09, 2016 10:58 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am


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