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 Splice

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Mon May 05, 2008 2:27 pm    Post subject: SYNCSORT Splice
Reply with quote

Hi,

I have 2 files.

file1(FB,LRECL=3) - having some data
Code:
ABC
DEF
GHI
JKL
MNO
PQR
...


file2(FB,LRECL=1) - having values as below
Code:
0
1
2


I want to attach the values in the 2nd file to the first file so that the ouptut should look like this

Code:
ABC0
DEF1
GHI2
JKL0
MNO1
PQR2
....


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

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Mon May 05, 2008 2:32 pm    Post subject:
Reply with quote

other than the usual record length and type info, how about:

1. do both files have equal number of records?
2. is there some kind of sort or sequencing? or just the data from file 2 to be appended to file 1?
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Mon May 05, 2008 2:34 pm    Post subject:
Reply with quote

you can do this by using splice operator in SYNCTOOL.

Steps:

1. Include sequence number for both the files(The sequence no will be the key for both the files).
2.now just reformat your 2nd file with 3 blank chars, in front of the data in file 2.
3.Now using seq num as key, use spilce operator to overlay the content of file 1 over file 2.(This can be done vice versa).

Hope This helps.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Mon May 05, 2008 3:03 pm    Post subject:
Reply with quote

Hi Dick,

file1 will always have more number of records
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Mon May 05, 2008 5:29 pm    Post subject:
Reply with quote

Hi Samuel,

What will happen if the sequence numbers are not matching???

Thanks,
Arun
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Mon May 05, 2008 5:43 pm    Post subject:
Reply with quote

That particular record will be written as it is.

consider

File 1:
seq num spaces(3) field2
1 aaa
2 bbb
3 ccc

File2:
Seq num field1
1 123
2 456


now u want to overlay 2 on 1,

your output will be,

seqnum field1field2
1 123aaa
2 456bbb
3 ccc

This reformatting can done according to your wish.

U have to take the file which has the maximum record as the base file and fewer as overlay.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Mon May 05, 2008 6:04 pm    Post subject:
Reply with quote

Hi Samuel,

I m sorry, I dint get your point. why the third record is having the below value

Code:

3 ccc


As per my requirement, as you could see in the first post, all the records in the output file should have values from both the files.

Can you please explain

Thanks,
Arun
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Mon May 05, 2008 6:20 pm    Post subject:
Reply with quote

the 3rd rec will be like:

seqnumspaces(3)field2
3___ccc

What I understood is :
you have 2 files file1 and file2.Both have set of records and there is no key common between the 2 files.
so u need to map all the records in file 2 to file 1 ...

or u have any criteria ?

U wanted the concatenation to happen with repeated values of file2 ?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Mon May 05, 2008 7:26 pm    Post subject:
Reply with quote

Hi,

I dont want to compare file1 & file2
I need to concatenate file2 values to file1 and just repeat the process till the end of file1

Thanks,
Arun
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Thu May 08, 2008 11:49 am    Post subject:
Reply with quote

Hi everybody...

Any hope on this....??

Thanks,
Arun
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Fri May 09, 2008 8:52 pm    Post subject:
Reply with quote

Hi,
Please check the below code.

Code:

//S1    EXEC  PGM=SYNCTOOL                                 
//TOOLMSG DD SYSOUT=*                                       
//DFSMSG  DD SYSOUT=*                                       
//IN0 DD *                                                 
ABC                                                         
DEF                                                         
GHI                                                         
JKL                                                         
MNO                                                         
PQR                                                         
//IN1 DD DSN=XXXXXXX.T1,UNIT=SYSDK,SPACE=(CYL,(6,6)),       
//       DISP=(NEW,CATLG,DELETE),DCB=(RECFM=FBA,LRECL=80)   
//IN2 DD *                                                 
0                                                           
1                                                           
2                                                           
//C1 DD DSN=&&C1,UNIT=SYSDK,SPACE=(CYL,(6,6)),DISP=(,PASS) 
//T1 DD DSN=&&T1,UNIT=SYSDK,SPACE=(CYL,(5,5)),DISP=(,PASS) 
//OUT DD DSN=XXXXX.T2,UNIT=SYSDK,SPACE=(CYL,(6,6)),         
//       DISP=(NEW,CATLG,DELETE),DCB=(RECFM=FB,LRECL=80)   
//TOOLIN DD *                                               
SORT FROM(IN0) TO(IN1) USING(CTL0)                         
COPY FROM(IN1) TO(C1) USING(CTL1)                           
COPY FROM(IN2) USING(CTL2)                                 
SORT FROM(T1) TO(OUT) USING(CTL3)                           
/*                                                         
//CTL0CNTL DD *                                             
   OPTION COPY                                             
   OUTFIL TRAILER1=(COUNT=(M11,LENGTH=8)),NODETAIL         
//CTL1CNTL DD *                                             
  INREC BUILD=(C'  REPEAT=',2,8,80:X)                       
/*                                                         
//CTL2CNTL DD *                                             
  INREC OVERLAY=(81:SEQNUM,8,ZD)                           
  OUTFIL FNAMES=T1,OVERLAY=(89:SEQNUM,8,ZD,RESTART=(81,8)),
/*                                                         
//    DD DSN=*.C1,VOL=REF=*.C1,DISP=(OLD,PASS)
//CTL3CNTL DD *                               
  OPTION EQUALS                               
  SORT FIELDS=(89,8,ZD,A)                     
  OUTREC BUILD=(1,80)                         
/*                                           
//S1       EXEC  PGM=SYNCTOOL                 
//TOOLMSG  DD SYSOUT=*                       
//DFSMSG   DD SYSOUT=*                       
//SYSOUT   DD SYSOUT=*                       
//INA DD *                                   
ABC                                           
DEF                                           
GHI                                           
JKL                                           
MNO                                           
PQR                                           
//INB DD DSN=XXXXX.T2,DISP=SHR               
//CTL1JNF1 DD DSN=XXXXX.S.K1,                 
//            DISP=(,CATLG,DELETE),           
//            UNIT=SYSDK,                     
//            SPACE=(CYL,(55,55),RLSE)       
//CTL1JNF2 DD DSN=XXXXX.S.T2,                 
//            DISP=(,CATLG,DELETE),           
//            UNIT=SYSDK,                     
//            SPACE=(CYL,(55,55),RLSE)       
//CTL1OF01 DD DSN=XXXXX.S.T1,                 
//            DISP=(,CATLG,DELETE),           
//            UNIT=SYSDK,                     
//            SPACE=(CYL,(55,55),RLSE)       
//TOOLIN    DD *                             
  SORT FROM(INA) TO(CTL1JNF1) USING(CTLA)     
  SORT FROM(INB) TO(CTL1JNF2) USING(CTLB)     
  SORT FROM(CTL1JNF1) USING(CTL1)             
//CTLACNTL  DD *                             
  SORT FIELDS=COPY                           
  OUTREC FIELDS=(1,3,1X,SEQNUM,8,ZD)         
//CTLBCNTL  DD *                             
  SORT FIELDS=COPY                           
  OUTREC FIELDS=(1,1,3X,SEQNUM,8,ZD)         
//CTL1CNTL  DD *                             
  JOINKEYS FILES=F1,FIELDS=(5,8,A)   
  JOINKEYS FILES=F2,FIELDS=(5,8,A)   
  REFORMAT FIELDS=(F1:1,3,F2:1,1)   
  SORT FIELDS=COPY                   
  OUTFIL FILES=01,OUTREC=(1,4)       
/*                                   



Code:

The output :
ABC0
DEF1
GHI2
JKL0
MNO1
PQR2


Thanks
Krishy
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 SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am


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