IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Syncsort - Overlay value on matching records.


 
IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
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
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: 310
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Thu Oct 03, 2013 11:58 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Thu Oct 03, 2013 1:47 pm
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: 310
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Thu Oct 03, 2013 3:35 pm
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
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Thu Oct 03, 2013 4:37 pm
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 All times are GMT + 6 Hours
Forum Index -> SYNCSORT
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Inserting records into the empty segm... IMS DB/DC 0
No new posts Need assistance formatting when joini... SYNCSORT 8
No new posts JCL to extract repeating records DFSORT/ICETOOL 6
No new posts SYNCSORT Error - CONTROL FIELD BEYOND... SYNCSORT 10
No new posts Group selective VB records - Trailer ... DFSORT/ICETOOL 16

Back to Top