View previous topic :: View next topic |
Author |
Message |
user99 Beginner
Joined: 17 Aug 2005 Posts: 3 Topics: 1
|
Posted: Wed Aug 17, 2005 1:48 pm Post subject: can we do this through SPLICE of SYNCSORT |
|
|
Hi ,
I am having 2 files of length 80 fixed block like below.FIELD-A is the key of length 3.
FILE1:
FIELD-A FIELD-B
123 AAAAAA
234 BBBBBBBB
345 CC
(FIELD-A START AT POSITION 1 AND ENDS AT POSITION 3
FIELD-B START AT POSITION 10 AND NOT SURE OF ENDING POSITION)
FILE2:
FIELD-A FIELD-B FIELD-C
123 JJJJJJJJJJJJ RRRRRRRR
123 BBBBBBBB GGGGG
123 CC KKKKKKKKKK
234 JJJJJJJJJJJ RRRRRRRR
234 BBBBBBBB GGGGG
(FIELD-A START AT POSITION 1 AND ENDS AT POSITION 3
FIELD-B START AT POSITION 10 AND ENDS AT POSITION22
FIELD-C START AT POSITION 30 AND NOT SURE OF ENDING POSITION)
I need to have the o/p file like below.
123 AAAAAA JJJJJJJJJJJJ RRRRRRRR
123 AAAAAA BBBBBBBB GGGGG
123 AAAAAA CC KKKKKKKKKK
234 BBBBBBBB JJJJJJJJJJJJ RRRRRRRR
234 BBBBBBBB BBBBBBBB GGGGG
can we achive this thorugh SPLICE of SYNCTOOL?
I can have the o/p of 160 length.
Thanks |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Aug 17, 2005 1:58 pm Post subject: |
|
|
User99,
If you have syncsort version 1.2 then you can use the JOIN feature to combine 2 datasets.
Quote: |
FIELD-B START AT POSITION 10 AND NOT SURE OF ENDING POSITION)
|
I assumed that the field-b in file1 length is 30 bytes.
Quote: |
FIELD-C START AT POSITION 30 AND NOT SURE OF ENDING POSITION)
|
I assumed that the field-C in file2 length is also 30 bytes.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD *
123 AAAAAA
234 BBBBBBBB
345 CC
//SORTJNF2 DD *
123 JJJJJJJJJJJJ RRRRRRRR
123 BBBBBBBB GGGGG
123 CC KKKKKKKKKK
234 JJJJJJJJJJJ RRRRRRRR
234 BBBBBBBB GGGGG
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(01,3,A)
JOINKEYS FILES=F2,FIELDS=(01,3,A)
REFORMAT FIELDS=(F1:1,40,
F2:10,60)
SORT FIELDS=(1,3,CH,A)
/*
|
The output from this job is
Code: |
123 AAAAAA JJJJJJJJJJJJ RRRRRRRR
123 AAAAAA BBBBBBBB GGGGG
123 AAAAAA CC KKKKKKKKKK
234 BBBBBBBB JJJJJJJJJJJ RRRRRRRR
234 BBBBBBBB BBBBBBBB GGGGG
|
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
user99 Beginner
Joined: 17 Aug 2005 Posts: 3 Topics: 1
|
Posted: Wed Aug 24, 2005 1:37 pm Post subject: |
|
|
Kolusu,
Thank you very much for the reply.I am out of town for few days,so I couldn't check the code.Now I checked it and is working fine.
I am having a small doubt.I am creating the 2 files (file 1 and file 2) with sync sort step by using sort from(in) TO(FILE1) USING CTL1 and sort from(in) TO(FILE1) USING CTL2.Is there any posibility to code the JOIN KEYS OPTION with another sort statement in the same step or we need to have a seperate SORT step for the JOIN KEYS option?
Thank you |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Aug 24, 2005 1:55 pm Post subject: |
|
|
Quote: |
I am having a small doubt.I am creating the 2 files (file 1 and file 2) with sync sort step by using sort from(in) TO(FILE1) USING CTL1 and sort from(in) TO(FILE1) USING CTL2.Is there any posibility to code the JOIN KEYS OPTION with another sort statement in the same step or we need to have a seperate SORT step for the JOIN KEYS option?
|
user99,
If I understand you correctly, you are creating the above shown 2 input files running another sort step. And you are using the solution by me as the third step.
You don't have to do all the 3 steps. you can actually do the whole process in just 1 step.
Post the JCL you are running to create file1 and file2 along with the contents of CTL1 and CTL2
Thanks
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
user99 Beginner
Joined: 17 Aug 2005 Posts: 3 Topics: 1
|
Posted: Wed Aug 24, 2005 2:22 pm Post subject: |
|
|
Kolusu,Here is the sample jcl which I am using to get the fil1 and file2.
//pS10 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1
//IN2 DD DSN=... input file2
//file1 DD DSN=... output file1
//file2 DD DSN=.....output file2
//out3 DD DSN=xxx.yyyy,
// DISP=(new,catlg,del)
// UNIT=SYSDA,SPACE=(TRK,(5,5))
//*
//TOOLIN DD *
sort from(in1) to(file1) using ctl1
sort from(in2) to(file2) using ctl2
/*
//CTL1CNTL DD *
OUTREC FIELDS=(xxx)------->required fields from in1
inclde cond=(aaaaa)------->required inclde cond
sort fields=(2,1,bi,a,...)-->required sort card
/*
//CTL2CNTL DD *
OUTREC FIELDS=(xxx)------->required fields from in1
inclde cond=(aaaaa)------->required inclde cond
sort fields=(2,1,bi,a,...)-->required sort card
/*
i am having the above code with me,I need a add a new card to have the join keys on file1 and file2 to produce the final output in the out3 file.
can we have 3 rd sort statemet(in toolin statement) with another ctl3 statement(where we can use the join keys)?
Thank you |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Aug 24, 2005 4:08 pm Post subject: |
|
|
Quote: |
i am having the above code with me,I need a add a new card to have the join keys on file1 and file2 to produce the final output in the out3 file.
can we have 3 rd sort statemet(in toolin statement) with another ctl3 statement(where we can use the join keys)?
|
User99,
You don't have to run the step any more or add any steps to join the records. You can just run 1 step which will strip the necessary fields from the files and also join the files together . Post the entire CTL1 and CTL2 input cards. I need them to show you an complete example of joining the records. Also let me know the positions of the fields to be joined.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
msdandy Beginner
Joined: 12 Aug 2005 Posts: 5 Topics: 2
|
Posted: Fri Aug 26, 2005 3:13 am Post subject: |
|
|
Does anyone know of an online link to the Programmer's Guide for
SYNCSORT FOR Z/OS 1.1? |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Fri Aug 26, 2005 4:48 am Post subject: |
|
|
msdandy,
msdandy Syncsort manuals are not available online. If your shop has valid licence then you can request a manual from syncsort.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|