|
View previous topic :: View next topic
|
| Author |
Message |
Carloseven
New User
Joined: 01 Dec 2006 Posts: 4 Location: Portugal
|
|
|
|
Hello
I have 2 data sets.
The input of my first data set is:
AAAAAAA
And the input of my second data set is:
111
And I want put that information in another data set, but the output dataset would look like this:
AAAAAAA111
Can help me. How I do that?
Thanks |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2286 Location: USA
|
|
|
|
Since you have only one record in each of your datasets, I recommend to combine those two records manually, using available online tools.
The manual approach should take 100-1000 times less time, than any automation of this process. |
|
| Back to top |
|
 |
Carloseven
New User
Joined: 01 Dec 2006 Posts: 4 Location: Portugal
|
|
|
|
| I have more records. In example I only put the first record. |
|
| Back to top |
|
 |
dneufarth
Active User

Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
| Code: |
//WHATEVER EXEC PGM=ICEMAN
//F1 DD *
AAAAAAA
/*
//F2 DD *
111
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=F1,FIELDS=(81,1,A)
JOINKEYS F2=F2,FIELDS=(81,1,A)
REFORMAT FIELDS=(F1:1,80,F2:1,80)
OUTFIL FNAMES=(SORTOUT),
REMOVECC,
BUILD=(1,160,SQZ=(SHIFT=LEFT,LENGTH=80))
END
/*
//JNF1CNTL DD *
OPTION STOPAFT=1
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:X))
END
/*
//JNF2CNTL DD *
OPTION STOPAFT=1
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:X))
END
/* |
|
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
| Carloseven wrote: |
| I have more records. In example I only put the first record. |
Why not providing real samples using the code tag button then? |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2286 Location: USA
|
|
|
|
| Carloseven wrote: |
| I have more records. In example I only put the first record. |
Hint:
1) re-number the input records in each of input "files" = datasets
2) join each two records, - matching them on equal record numbers
3) decide what to do when the number of records is different in both inputs? |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
| Honestly, we need to see better sample data. Most of us helping here are volunteers. We have other things to do in our spare time. |
|
| Back to top |
|
 |
Carloseven
New User
Joined: 01 Dec 2006 Posts: 4 Location: Portugal
|
|
|
|
Hello first thank you about your answer.
Second I execute the JCL... (change f1 and f2 with my data sets...
//SORTRDJ1 JOB (SYST),'SORTTEST,25/06,12:32',
// CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
//*
//SORT EXEC PGM=SORT
//F1 DD DSN=GPCCMN.SORT1.TESTE.D260722,DISP=SHR - FB 80
/*
//F2 DD DSN=GPCCMN.SORT2.TESTE.D260722,DISP=SHR - FB 80
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=GPCCMN.SORT5.TESTE.D260722, - FB 80
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(1,1),RLSE),
// DCB=(LRECL=80,RECFM=FB)
//SYSIN DD *
OPTION COPY
JOINKEYS F1=F1,FIELDS=(81,1,A)
JOINKEYS F2=F2,FIELDS=(81,1,A)
REFORMAT FIELDS=(F1:1,80,F2:1,80)
OUTFIL FNAMES=(SORTOUT),
BUILD=(1,160,SQZ=(SHIFT=LEFT,LENGTH=80))
END
/*
//JNF1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:X))
END
/*
//JNF2CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:X))
END
But my output don't stay like I want. He stay like that:
AAAAAAA0000010011100000100
AAAAAAA0000010022200000200
AAAAAAA0000010033300000300
AAAAAAA0000010044400000400
BBBBBBB0000020011100000100
BBBBBBB0000020022200000200
BBBBBBB0000020033300000300
BBBBBBB0000020044400000400
CCCCCCC0000030011100000100
CCCCCCC0000030022200000200
CCCCCCC0000030033300000300
CCCCCCC0000030044400000400
DDDDDDD0000040011100000100
DDDDDDD0000040022200000200
Can you help me again?
And can you explain another questions:
why you use ,FIELDS=(81,1,A) for F1 and F2 ??
And why 160 in build (BUILD=(1,160) ??
Thank you |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2286 Location: USA
|
|
|
|
Did you ever read my answer?
Did you understand something of it?
| sergeyken wrote: |
| Carloseven wrote: |
| I have more records. In example I only put the first record. |
Hint:
1) re-number the input records in each of input "files" = datasets
2) join each two records, - matching them on equal record numbers
3) decide what to do when the number of records is different in both inputs? |
P.S.
1. You are not "running JCL program".
You are running SORT application program, and all 100% of your issues are related exclusively to SORT, not to JCL, or VSAM, or whatever else.
2. Please!!!!! Learn how to use the Code button when presenting your samples!
3. When presenting your testing, present also your input and output data, properly, using the Code button. Or you can present your test data under your // DD * statements
4. Finally, start reading at least basic manuals on the stuff you intend to use in your life, before asking at the forum. |
|
| Back to top |
|
 |
Marso
REXX Moderator

Joined: 13 Mar 2006 Posts: 1356 Location: Israel
|
|
|
|
- Search for "smart dfsort tricks" using your favorite search engine.
- Download the PDF file (preferably from IBM site but not necessarily)
- Look at all the different things you can do with a sort
- Look at the chapter called "Join fields from two files record-by-record"
- If you have questions about ICETOOL, search for "ICETOOL Mini-User Guide"
Even the sample is almost like yours (and the answer is yes, btw)
| The book wrote: |
I want to merge two files laterally record by record. For example:
If FILE1 contains:
AAAAA
BBBBB
CCCCC
and FILE2 contains:
11111
22222
33333
then my output file should contain:
AAAAA11111
BBBBB22222
CCCCC33333
Can DFSORT do this? |
The ICETOOL document was written by our friendly Frank L. Yaeger, now retired. Let's hope he is enjoying his time ! |
|
| Back to top |
|
 |
Carloseven
New User
Joined: 01 Dec 2006 Posts: 4 Location: Portugal
|
|
|
|
4. Finally, start reading at least basic manuals on the stuff you intend to use in your life, before asking at the forum.[/quote]
???
sergeyken I read the manual and read before ask...If I ask was because it not works what I do...you don't need help or answer if you don't want. when I put the JCL and my result the question is not for you.
Thank you |
|
| Back to top |
|
 |
dneufarth
Active User

Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
Adjust the BUILD start, length to appropriate values for your example.
I believe specified FIELDS gives you a one to one match.
Been quite a few years since I’ve used DFSORT. |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
Change
| Code: |
JOINKEYS F1=F1,FIELDS=(81,1,A)
JOINKEYS F2=F2,FIELDS=(81,1,A)
|
to
| Code: |
JOINKEYS F1=F1,FIELDS=(81,8,A)
JOINKEYS F2=F2,FIELDS=(81,8,A)
|
and the INREC each to
| Code: |
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD))
|
|
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
Let us not make a big deal about this and help without criticizing any further.
Please try the solution posted above and if it doesn’t work then provide us with sample input data in both the data sets.
Moved to beginners section of this forum. |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
| Basically JOINKEYS is NOT for beginners. |
|
| Back to top |
|
 |
Marso
REXX Moderator

Joined: 13 Mar 2006 Posts: 1356 Location: Israel
|
|
|
|
By luck (or lack of it), I have to do something more or less similar.
Maybe only DFSORT uses the JNF1CNTL and JNF2CNTL, SYNCSORT seems to ignore them.
| Quote: |
//SYSIN DD *
OPTION COPY
JOINKEYS F1=F1,FIELDS=(81,1,A)
JOINKEYS F2=F2,FIELDS=(81,1,A)
REFORMAT FIELDS=(F1:1,80,F2:1,80)
OUTFIL FNAMES=(SORTOUT),
BUILD=(1,160,SQZ=(SHIFT=LEFT,LENGTH=80))
END
/*
//JNF1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:X))
END
/*
//JNF2CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:X))
END
But my output don't stay like I want. He stay like that:
AAAAAAA0000010011100000100
AAAAAAA0000010022200000200 |
|
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
SYNCSORT behaves also exactly as wanted.
| Code: |
//WHATEVER EXEC PGM=SORT,PARM='MSG=AP'
//F1 DD *
AAAAAAA
BBBBBBBBBBBBBB
C
/*
//F2 DD *
111
2
3333333
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=F1,FIELDS=(81,8,A)
JOINKEYS F2=F2,FIELDS=(81,8,A)
REFORMAT FIELDS=(F1:1,80,F2:1,80)
OUTFIL FNAMES=(SORTOUT),
REMOVECC,
BUILD=(1,160,SQZ=(SHIFT=LEFT,LENGTH=80))
END
/*
//JNF1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD))
END
/*
//JNF2CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD))
END
/* |
Output:
| Code: |
AAAAAAA111
BBBBBBBBBBBBBB2
C3333333 |
Tested right now using:
| Code: |
| SYNCSORT FOR Z/OS 3.1.0.0N |
|
|
| Back to top |
|
 |
dneufarth
Active User

Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
| Perhaps CTL1 CTL2 |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
| I don't think so. UNNUM in 3.4 could help. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|