View previous topic :: View next topic
|
Author |
Message |
sunil.sunny
New User
Joined: 25 Feb 2012 Posts: 5 Location: US
|
|
|
|
I have two files with the below description:
i) Sequential file with LRECL as 5 bytes and FB format
ii) Sequential file with LRECL as 15 bytes and FB format
My requirement is to overlay last 5 bytes of the second file with the contents from the first file and making sure that the first 10 bytes of the second file are not affected.
I have tried FILEAID option but I am not able to retain the first 10 bytes.
Note: I want this to be handled in a JCL step. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
search the forum for joinkeys
You will find quite a few topics dealing with file matching and building output records with fields from both input files
but ( fastest )
if You are using DFSORT ( ICE messages ) You might want to go to
ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
and look at Join fields from two files record-by-record
the solutions posted might work also for SYNCSORT ( WER messages ) |
|
Back to top |
|
|
sunil.sunny
New User
Joined: 25 Feb 2012 Posts: 5 Location: US
|
|
|
|
I got a JCL from the link mentioned by you and have customized the JCL mentioned below for my requirement. But it gives a syntax error at the JOINKEYS step. I am not able to figure out the problem.
IN1 dataset - LRECL - 10
IN2 dataset - LRECL - 5
Please note that I have only record in both of the files.
Code: |
//JOINS EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=TEMP1.DATASET,DISP=SHR
//IN2 DD DSN=TEMP2.DATASET,DISP=SHR
//SORTOUT DD DSN=FINAL.DATASET,DISP=SHR
//SYSIN SUBSYS=(CCSS,
// ' JOINKEYS F1=IN1,FIELDS=(11,8,A),SORTED,NOSEQCK ',
// ' JOINKEYS F2=IN2,FIELDS=(6,8,A),SORTED,NOSEQCK ',
// ' REFORMAT FIELDS=(F1:1,10,F2:1,5) ',
// ' OPTION COPY ')
//JNF1CNTL DD SUBSYS=(CCSS,
// ' INREC OVERLAY=(11:SEQNUM,8,BI) ')
//JNF2CNTL DD SUBSYS=(CCSS,
// ' INREC OVERLAY=(6:SEQNUM,8,BI) ') |
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
well what errors did you receive?
and what are all the single quotes? |
|
Back to top |
|
|
sunil.sunny
New User
Joined: 25 Feb 2012 Posts: 5 Location: US
|
|
|
|
I am getting the below syntax error:
Code: |
SYSIN:
JOINKEYS F1=IN1,FIELDS=(11,8,A),SORTED,NOSEQCK
*
JOINKEYS F2=IN2,FIELDS=(6,8,A),SORTED,NOSEQCK
*
REFORMAT FIELDS=(F1:1,10,F2:1,5)
OPTION COPY
JOINKEYS STATEMENT: SYNTAX ERROR
JOINKEYS STATEMENT: SYNTAX ERROR
SYNCSMF CALLED BY SYNCSORT; RC=0000
|
I think the problem is due to syncsort. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
It is not due to Syncsort, it is due to you using the wrong syntax.
Have a search in this forum for JOINKEYS. Note the difference in syntax for Syncsort. Apply change. Run.
Please use the Code tags when you want to preserve spacing in your posts. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
I got a JCL from the link mentioned by you and have customized the JCL mentioned below for my requirement.
|
it' s pity that You did not notice my remark
Quote: |
if You are using DFSORT ( ICE messages ) You might want to go to |
since You are using SYNCSORT it is more than normal that it did not work...
You will have to resort searching the JCL forum
also it is usual around here for code snippets and sysout data to use the code tags
the font is fixed and makes things more readable
Your posts were edited to show you how the should look |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Which example did you pick up? |
the one in DFSORT smart tricks |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
dbzTHEdinosauer wrote: |
[...]
and what are all the single quotes? |
Looks like a facility from gsf.
sunil.sunny, does your site just code everything in the JCL itself? How does the maintenance go with that? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
I found CCSS very useful for passing parameter to <DATA> cards inside a PROC
if properly used it saves quite a bit of work
no need for it with zOS 1.13 ( if it does the parameter substitution also for data cards )
but no reason at all to use it for STATIC data outside of a PROC
there is also a free version on the CBT tape
it needs to be reworked/streamlined a bit,
if You are interested let me know
and I can post the reworked/streamlined version |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
enrico-sorichetti wrote: |
Quote: |
Which example did you pick up? |
the one in DFSORT smart tricks |
Hi Enrico,
I should have been clearer - I search for "//SYSIN SUBSYS=(CCSS", from his example and looked for that in the DFSort tricks document. It was not there and so is my inquiry...
Regards, |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Hi Anuj,
I think there's a "small" confusion by TS. When they say they got "a JCL" from the link enrico provided, they mean the sort cards from same. There is no way the Smart Dfsort Tricks would have such site-specific JCL. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
my bad, did not bother to recognize the CCSS. |
|
Back to top |
|
|
sunil.sunny
New User
Joined: 25 Feb 2012 Posts: 5 Location: US
|
|
|
|
I got one Syncsort JCL from the link mentioned by you:
Code: |
//SORT EXEC PGM=SORT
//SORTJNF1 DD DISP=SHR,DSN=FILE1
//SORTJNF2 DD DISP=SHR,DSN=FILE2
//SORTOUT DD DISP=SHR,DSN=FILE3
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,5,A)
JOINKEYS FILES=F2,FIELDS=(1,5,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,10,F2:1,5)
SORT FIELDS=COPY
/* |
It works well for a scenario when the first 5 bytes in both of the input files are same but not if they mismatches.
My requirement is simple:
Input file 1: FB, LRECL - 10 bytes, will always have one record
Input file 2: FB, LRECL - 5 bytes, will always have one record
Output:
Output file: FB, LRECL - 15 bytes - should be created with first 10 bytes from I/P file 1 and next 5 bytes from I/P file 2. (Only one record)
Please note that I don't not need any matching to be performed before copying the data to Output file. I/P files data should be directly copied to O/P file. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Do you have a key, the same on each file? If 1,5 is the key on both files, they you already have the data, don't need to do the match, so I'll guess that you don't.
Do you have your Syncsort manual?
Did you find this example? Where you don't have a key, you make one, with a sequence number appended to each record. Look at Gerry's solution at the end of the topic linked-to. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Please note that I don't not need any matching to be performed before copying the data to Output file. I/P files data should be directly copied to O/P file. |
yes ... You do , You have the hidden logical key of the sequence number.
joinkeys as the name hints joins something based on a key
to sort based on the relative record number 1-1 2-2 3-3 ... n-n
You need to add a dummy key ( the sequence number ) in an unused postion of the records
and build the output dropping it |
|
Back to top |
|
|
sunil.sunny
New User
Joined: 25 Feb 2012 Posts: 5 Location: US
|
|
|
|
enrico-sorichetti wrote: |
Quote: |
Please note that I don't not need any matching to be performed before copying the data to Output file. I/P files data should be directly copied to O/P file. |
yes ... You do , You have the hidden logical key of the sequence number.
joinkeys as the name hints joins something based on a key
to sort based on the relative record number 1-1 2-2 3-3 ... n-n
You need to add a dummy key ( the sequence number ) in an unused postion of the records
and build the output dropping it |
Thanks all for the support. The JCL is working now.... |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You could try this, borrowed form Gerry. It puts an 8-byte sequence number at start position 11 of each record on both files. Then does the join. If it doesn't work, it is my fault, not Gerry's :-)
I don't think you need the JOIN UNPAIRED, but since I don't have Syncsort docs that is something you can discover (and let us know).
If you fancy making a second control file for the copy of the 5-byte file, you could start that sequence number at position 6. Since I can't test it, I'm not going to do the change.
The REFORMAT will take bytes 1-10 of file one and 1-5 of file two, putting them next to each other and starting at position 1 (thus dropping the sequence numbers from both files).
Since you don't need to sort the output, there is just a COPY. Your new file will appear on SORTOUT.
enrico, even if TS isn't interested (they're paying already, I guess), I'd like to see the souped-up CBT thing you mentioned :-)
Code: |
//S1 EXEC PGM=SYNCTOOL
//IN1 DD *
123456789A
123456789B
123456789C
123456789D
123456789E
123456789F
//IN2 DD *
1234A
1234B
1234C
1234D
1234E
1234F
//IN1O DD DSN=&&IN1O,DISP=(,PASS,DELETE),UNIT=SYSDA,
// SPACE=(TRK,(10,5),RLSE)
//IN2O DD DSN=&&IN2O,DISP=(,PASS,DELETE),UNIT=SYSDA,
// SPACE=(TRK,(10,5),RLSE)
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(IN1O) USING(CTL1)
COPY FROM(IN2) TO(IN2O) USING(CTL1)
/*
//CTL1CNTL DD *
INREC OVERLAY=(11:SEQNUM,8,ZD)
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=&&IN1O,DISP=(OLD,DELETE)
//SORTJNF2 DD DSN=&&IN2O,DISP=(OLD,DELETE)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(11,8,A),SORTED
JOINKEYS FILE=F2,FIELDS=(11,8,A),SORTED
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,10,F2:1,5)
OPTION COPY
|
|
|
Back to top |
|
|
Nikhil Jain
New User
Joined: 20 Jul 2011 Posts: 16 Location: India
|
|
|
|
Hi,
I have tried this in DFSORT. Please check if it works for you in Syncsort as well.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD *
X1234
//INB DD *
Y7868
//SORTOUT DD SYSOUT=*
//JNF1CNTL DD *
INREC OVERLAY=(7:SEQNUM,1,ZD)
//JNF2CNTL DD *
INREC OVERLAY=(7:SEQNUM,1,ZD)
//SYSIN DD *
JOINKEYS F1=INA,FIELDS=(7,1,A)
JOINKEYS F2=INB,FIELDS=(7,1,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,5,F2:1,5)
SORT FIELDS=COPY
//* |
SortOut -
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Problem is if the Syncsort used doesn't have the JNFnCNTL files available. That's why it ends up as two steps. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
I have tried this in DFSORT. Please check if it works for you in Syncsort as well. |
the ts has already told that DFSORT control card do not work with SYNCSORT
after having used the example found in DFSORT smart tricks
no reason to REprovide soultion that are known not to work
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
[quote="enrico-sorichetti"]
Quote: |
no reason to REprovide soultion that are known not to work
|
yeah, but it increases the post count.... |
|
Back to top |
|
|
Nikhil Jain
New User
Joined: 20 Jul 2011 Posts: 16 Location: India
|
|
|
|
H Bill,
Thanks so much for the explanation.
Hi Enrico,
Apologies for the confusion. I am not at all familiar with the Syncsort but, thought could do it in DFSort. From the next time onwards, I am definitely going to be extra careful.
Not sure but, how does increasing the post count help. |
|
Back to top |
|
|
Nikhil Jain
New User
Joined: 20 Jul 2011 Posts: 16 Location: India
|
|
|
|
Nikhil Jain wrote: |
I am not at all familiar with the Syncsort but, thought could do it in DFSort. |
& was under the impression that if it works in DFSort, it would most probably work in Syncsort as well. But, now I have understood that it is not the case. |
|
Back to top |
|
|
|