View previous topic :: View next topic
|
Author |
Message |
wabasaja
New User
Joined: 25 Jul 2012 Posts: 14 Location: germany
|
|
|
|
Hi everyone,
Can please somebody help and provide the DFSORT/JCL-Code for following requirement (joinkeys, reformat, overlay)…would be great:
There are two input files:
F1 RECFM=VB, LRECL=23000
F2 RECFM=VB, LRECL=2800
Both files have different structure but joinkey is for both file at 23,40 (23 included the 4 Byte RDW).
Files may not contain duplicate keys.
The task is:
For all matching records replace at different addresses at F1 25 byte from different addresses from F2.
(all char)
For example:
replace 100,25 from F2 at 200,25 in F1
replace 150,25 from F2 at 250,25 in F1
and so on…after the job the output records of F1 are changed on and from the involved addresses.
(I’m working with GDG’s so let’s assume…output is a new GDG of F1 or a different Filename…doesn’t matter for my needed solution example)
If some of the keys/records are present only in F1, we want keep all records like that untouched in the output file F1.
(Input files are not sorted so the joinkeys default sort should be done etc (means no parameter sorted..)
PS: I wrote “Files may not contain duplicate keys.” …would be nice if you tell me additional what to add if that’s not the case…
PS2: I pre checked the forum posts but couldn’t find an valid example…most are FB or different at all….
Super thx in advance for any help!!!
Bye, have a nice time everyone!! |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
PS2: I pre checked the forum posts but couldn’t find an valid example…most are FB or different at all….
|
that means all the examples I found would require me to think in order to use them.
I just want you to provide the coded control cards for my problem.
Quote: |
Super thx in advance for any help!!!
Bye, have a nice time everyone!!
|
It's time for me to go home,
so don't expect any clarification of the requirement.
i expect to find the solution in the morning. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
The only real difference between an FB joinkeys and a VB joinkeys is that you have to be careful about the "variable" bits.
You need your entire F1 record. You only need certain fields from the F2.
(F1:1,4,F2:allthefieldsyouneed,?,F1:5)
The REFORMAT record is going to be variable, so needs to start with an RDW which is going to be adjusted as it goes along. So here, F1:1,4 . Then the "fixed" fields from F2 that you need. Then the match marker (the ?) then the entire F1 variable record, excluding the RDW. The F1:5 will copy from 5 to the end of the F1 record.
If any of the fields for replacement are in the actual variable part of the F1, you'll need to make those conditional. Otherwise, from the REFORMAT record example above, I think you'll get there. |
|
Back to top |
|
|
wabasaja
New User
Joined: 25 Jul 2012 Posts: 14 Location: germany
|
|
|
|
Hello Mr. Brenholtz,
that's really not fair and really not true...this was my first post...
I was motivated to the so often super help given to others by for example Frank Y or skolusu ....but anyway thanks for the reply even if that was a
not very nice assumption..
Have a nice time everyone!! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Quote: |
that's really not fair and really not true... |
Some of us "old guys" get testy at times. . . .
If you post a bit of representative sample input and the output you want whan the sample data is processes, someone may be better able to help.
Creating test data that is less than 80 chars makes for much easier testing
The width can be changed later for the real data. Also, please use the Code tag to preserve alignment of the data posted. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
I apologize,
i was wrong,
you obviously had not gone home. |
|
Back to top |
|
|
wabasaja
New User
Joined: 25 Jul 2012 Posts: 14 Location: germany
|
|
|
|
Hi and super thx to all of you...it's ok Dick...no problem at all...
I can imagine that all those questions are sometimes really annoying....
But I'm honestly not that familiar with that ...I' working on it...this is one step of it....thanks in advance for further help..
Relatet to my first post an example of data (short for the example):
F1:
Code: |
0123456789ABCDEFGHIJ0123456789ABCDEFGHIJ0123456789ABCDEFGHIJ0123456789
0123456789ABCDEFGHIJ0123456789ABCDEFGHIJ0123456789ABCDEFGHIJ0123456789
0123456789ABCDEFGHIJ0123456789ABCDEFGHIJ0123456789ABCDEFGHIJ0123456789 |
F2:
Code: |
xxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyzzzzzzzzzzzzzzzzzzzz
xxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyzzzzzzzzzzzzzzzzzzzz
xxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyzzzzzzzzzzzzzzzzzzzz |
new F1:
Code: |
0123456789ABCDEFGHIJ01234yyyyyyyyyyyyyyyyyyyyyyyyyABCDEFGHIJ0123456789
0123456789ABCDEFGHIJ01234yyyyyyyyyyyyyyyyyyyyyyyyyABCDEFGHIJ0123456789
0123456789ABCDEFGHIJ01234yyyyyyyyyyyyyyyyyyyyyyyyyABCDEFGHIJ0123456789 |
What I don't get / understand is the needed syntax for 1-n replacements of the data in VB file F1....do i need overlay statement etc..
Thx!!!! |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
wabasaja wrote: |
I was motivated to the so often super help given to others by for example Frank Y or skolusu ....[/b] |
Mr. Yaeger (who has now retired) was and Kolusu is a DFSORT developer, for which reason they did and will give people complete sort control decks and JCL. The rest of us lack this motivation; we will answer questions and offer suggestions and even code fragments, but seldom write entire programs for querents (save that we are offered our usual billing rates, on the close order of Rs. 50,000/day). |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I don't understand the 1-n reference. . .
Is there no key upon which these files can be matched? Is ther a way to ensure that both files have the same number of records?
To get the output you want, you could use BUILD (and OVERLAY?) to format the new output recorde. |
|
Back to top |
|
|
wabasaja
New User
Joined: 25 Jul 2012 Posts: 14 Location: germany
|
|
|
|
Hi Akatsukami,
I understand...but like I wrote...I was motivated by the posts
of Mr. Yaeger (I wish him a very nice and long long lasting retirement)
and Kolusu....hope there is an new Member for Frank ;-)....and thanks god...there is still Kolusu ;-)...anyway ...super thx for any help from anybody!! Great great forum!!!
Thx2all!!! |
|
Back to top |
|
|
wabasaja
New User
Joined: 25 Jul 2012 Posts: 14 Location: germany
|
|
|
|
Hi dick scherrer,
please check my first post..I wrote:
.."Both files have different structure but joinkey is for both file at 23,40 (23 included the 4 Byte RDW). .."
So the answer is ...yes...keys for matching let's say by joinkeys are available...
That: the 1-n reference. . .was related to the fact that I must change data at F1 at 1-n places....adresses...e.g. 50,25...150,25...500,25
Thx! |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
And whilst all this is going on did you actually look at the REFORMAT I showed?
You'll need BUILD, not OVERLAY, due to the position of the variable portion. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
wabasaja,
Use the following DFSORT JCL which will give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DSN=Your Input VB 23000 file,DISP=SHR
//INB DD DSN=Your Input VB 2800 file,DISP=SHR
//SORTOUT DD DSN=Your Output file,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(23,40,A)
JOINKEYS F2=INB,FIELDS=(23,40,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,4,?,F2:5,2796,F1:5)
INREC IFTHEN=(WHEN=(5,1,CH,EQ,C'B'), $ MATCH RECORDS
BUILD=(0001,04, $ RDW
2802,95, $ DATA BEFORE ADDRESS1
0201,25, $ REPLACED DATA1 FROM FILE2
2922,25, $ DATA BEFORE ADDRESS2
0251,25, $ REPLACED DATA2 FROM FILE2
2972)), $ REST OF THE FILE VB DATA
IFTHEN=(WHEN=NONE, $ NON-MATCH RECORDS
BUILD=(1,4,2802)) $ BUILD AS-IS
//* |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Good to see the complete solution from Kolusu
Quote: |
please check my first post..I wrote:
.."Both files have different structure but joinkey is for both file at 23,40 (23 included the 4 Byte RDW). .." |
Then you should have shown this in the sample data. . . The bunches of x, y, z gave no hint that there was a key in that data.
You will get far more usable replies far quicker if you post proper detail people can use to help you. Sample data should follow the written "rules" even if they have to be customized for the topic. |
|
Back to top |
|
|
wabasaja
New User
Joined: 25 Jul 2012 Posts: 14 Location: germany
|
|
|
|
Hello all,
after a 12 hours working day I finally left the office ;-)...but still time left
to say thanks again to all of you....and for sure I have read every word...thx
And...wow...I had luck...Skolusu you gave me all ...so as soon I'm back at the office....I try .....have a nice time everyone!!! |
|
Back to top |
|
|
wabasaja
New User
Joined: 25 Jul 2012 Posts: 14 Location: germany
|
|
|
|
Hi all, hi Skolusu,
I couldn't try it today due to other constraints…I will do it asap…on Monday or Tuesday.
Anyway I give a feedback and another Thx!!!
Have a nice one…!! |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
wabasaja,
It is a welcome change to see someone posting a feedback. Most of the time in here it is just "Here do my work and come back only when I need more work to be done"
btw I have a minor change in the control cards I provided.
change this statement to
to
so that you only pick the matched and unmatched records from F1. |
|
Back to top |
|
|
wabasaja
New User
Joined: 25 Jul 2012 Posts: 14 Location: germany
|
|
|
|
Hi Skolusu,
Thx again!!
If somebody helps as you do or earlier Frank did….
wow…it should be a matter of course that you receive always a great super thanks…and for sure an adequate feedback…
for me it’s normal without saying...
I’m glad that someone like you and all helping members exists!!!
But I have to admit that I still need one more day before I try…
But just by looking to the offered solution..I see that I have no clue about the build statement related to….
how is decided and marked respectively how knows DFSORT which part of the record comes from F1 and which from F2..…
I guess it’s a fixed rule like…rdw (if VB)…then F1, F2,F1, F2,F1….or??
Ok…I see all knowing people…experts laugh
Have a nice time Skoluso and for sure also all members of the board!!!
I come back asap ..hopefully tomorrow..Bye |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
wabasaja,
It is not a fixed rule. Look at the reformat statement
Code: |
REFORMAT FIELDS=(F1:1,4, $ RDW
?, $ INDICATOR
F2:5,2796, $ COPY FILE2 FULL 2796 BYTES
F1:5) $ COPY VARIABLE FILE1 REC
|
? indicates a 1-byte indicator is to be included in each joined record. The indicator will be set to one of the following values in each paired or unpaired joined record, as appropriate:
Code: |
'B' - the key was found in F1 and F2.
'1' - the key was found in F1, but not in F2.
'2' - the key was found in F2, but not in F1. |
Read about the REFORMAT statement here
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA60/4.5? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Ok…I see all knowing people…experts laugh |
Even the experts had to learn once upon a time and will not laugh. Most just want to help if possible. |
|
Back to top |
|
|
wabasaja
New User
Joined: 25 Jul 2012 Posts: 14 Location: germany
|
|
|
|
Hi Skolusu, thanks so much for your reply, information and link....and thanks Dick for not laughing and motivating me to go on
Skolusu do I get this right...I have to declare all the needed fields from f1 and f2 related to the needed sequence in both statements...the reformat and the built statement...then it's all clear to me...I was a bit confused about the given example...because... I thought...how does the given reformat and the build fit/work together...
Code: |
REFORMAT FIELDS=(F1:1,4,?,F2:5,2796,F1:5)
INREC IFTHEN=(WHEN=(5,1,CH,EQ,C'B'), $ MATCH RECORDS
BUILD=(0001,04, $ RDW
2802,95, $ DATA BEFORE ADDRESS1
0201,25, $ REPLACED DATA1 FROM FILE2
2922,25, $ DATA BEFORE ADDRESS2
0251,25, $ REPLACED DATA2 FROM FILE2
2972)), $ REST OF THE FILE VB DATA
IFTHEN=(WHEN=NONE, $ NON-MATCH RECORDS
BUILD=(1,4,2802)) $ BUILD AS-IS |
But I guess I understand now...and try as said tomorrow...however...
super nice time to you and Dick!!!
I appreciate all the help so much...thx!!
PS: normally we write very quick a cobol program for that task...but I like to learn to solve that also by DFSORT
Code'd |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
wabasaja wrote: |
Skolusu do I get this right...I have to declare all the needed fields from f1 and f2 related to the needed sequence in both statements...the reformat and the built statement...then it's all clear to me...I was a bit confused about the given example...because... I thought...how does the given reformat and the build fit/work together... |
Wabasaja,
You need to understand how Joinkeys works. With JOINKEYS there are 3 tasks done.
TASK-1 - FILE1 is sorted on the key fields and matched
TASK-2 - FILE2 is sorted on the key fields and matched.
Builds the Matched records using REFORMAT statement. This will be passed as New SORTIN record to
3. Main task - Here you can sort/modify the new built matched record.
Check this link for the flow of JOINKEYS
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA60/4.1.1?DT=20110608113434#FIGJKAPP
In simple terms, the REFORMAT statement is building a RECORD during MATCH. So when the keys match a new record is built with the fields specified on the REFORMAT statement. Once the match record is built , the INREC is actually building the record according to our needs picking the necessary fields. |
|
Back to top |
|
|
wabasaja
New User
Joined: 25 Jul 2012 Posts: 14 Location: germany
|
|
|
|
Hi Skolusu,
biggest thanks!!
Good teacher…allow me to say ….good friend ;-)....normally nobody helps like you do….that’s really amazing…and beyond a friendly response / reaction…
so I must say..it’s a help..support like normally only friends give :-)…
I will save the given links and information until the end of my days ;-)…
Very good information…Thx!!!
I’m somehow (I know …it’s my personal problem..) under stress the last days …and still today…so I couldn’t try like I wish…maybe finally tomorrow…
But after quick repeated test with the given syntax I get always 6 leading spaces…I played with the numbers of the positions… I can’t get rid of the leading blanks..
It’s looks like that….the “AAAAAA……” would be so far the wished data from F1.
Code: |
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 AAAAAABBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEE
000002 AAAAAABBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEE
000003 AAAAAABBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEE
000004 AAAAAABBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEE
000005 AAAAAABBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEE
****** **************************** Bottom of Data **************************** |
I didn't checked the rest so far…and I’m sure it’s my fault….I go on tomorrow…hopefully
I’m aware that I should show more details…and I will if don’t get it solved…but now I have to join a meeting..
Have a super nice day…evening!!! |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
wabasaja,
I need to see the control cards and complete sysout to figure out why you are getting the extra spaces. |
|
Back to top |
|
|
wabasaja
New User
Joined: 25 Jul 2012 Posts: 14 Location: germany
|
|
|
|
Hi Skolusu,
Now I get it!
As all times…the problem was sitting in front of the keyboard ;-)….I made a mistake on the numbers on the “when=none” side….and for sure
received an impact on the “eq side”…
So finally again…super thanks for helping me so super friendly :-)!!!
Have a nice on…
PS: btw…has the name / word skolusu something to do with…”the schools are..” |
|
Back to top |
|
|
|