IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can we use PD Format fields in JOINKEYS


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
maridawson

New User


Joined: 24 Jun 2008
Posts: 59
Location: chennai

PostPosted: Thu Apr 29, 2010 7:27 pm
Reply with quote

Hi ,
I have two files with a common PD field. when i tried to match the files using the common PD field, i am not getting the intended result. Can someone clarify , whether we can use PD field in JOINKEYS, otherwise , how to use the PD fields in the JOINKEYS.

Thanks
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 29, 2010 7:31 pm
Reply with quote

Post your JCL that is not getting the intended result.
Post an example of your input and the intended result.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 29, 2010 7:38 pm
Reply with quote

Quote:
FIELDS=(p,m,s<,p,m,s>...)
Must be specified to indicate the starting position, length and order (ascending or descending) of the keys in the
input file. The keys will be treated as binary, so they must be "normalized". For example, if the keys are actually
zoned decimal, they must have all C and D signs, or all F and D signs. You can use an INREC statement in
JNF1CNTL and/or JNF2CNTL to normalize the keys for the F1 file and/or F2 file, respectively, if appropriate.

Each pair of keys for the F1 and F2 files must match with respect to length and order, but can start in different
positions. For example, if the first key for the F1 file is 5 bytes ascending and the second key for the F1 file is 3
bytes descending, the first key for the F2 file must be 5 bytes ascending and the second key for the F2 file must be
3 bytes descending.

p specifies the starting position of the key. The first data byte of a fixed-length record is in position 1.
The first data byte of a variable-length record is in position 5 after the 4-byte RDW. p can be 1 to 32752 but all fields must
be completely contained within the first 32752 bytes of the record.
Back to top
View user's profile Send private message
maridawson

New User


Joined: 24 Jun 2008
Posts: 59
Location: chennai

PostPosted: Thu Apr 29, 2010 7:55 pm
Reply with quote

Code:
JOINKEYS FILES=F1,FIELDS=(1,10,A,11,8,A)                             
JOINKEYS FILES=F2,FIELDS=(1,10,A,11,8,A)                             
JOIN UNPAIRED,F1,F2                                                   
REFORMAT FIELDS=(F1:1,10,F2:11,8,F1:19,586,F2:45,1,F1:606,253,F2:47,1,
                 F1:860,830,F2:35,10,F1:1700,301,F1:1,2000,F2:1,10)   
OUTFIL FNAMES=SORTOF01,INCLUDE(2001,10,CH,GT,C' ',AND,               
              4001,10,CH,GT,C' '),BUILD=(1,2000)                     
OUTFIL FNAMES=SORTOF02,INCLUDE(4001,10,CH,EQ,C' '),BUILD=(2001,2000)     
MERGE FIELDS=COPY

This is the Sort card i am using, Both the files have PD fields @ the position, 11,8. Even i tried to view the whole record (1:4010)..... but none of the records are matching between the two files based on the fields i have used for matching. 1,8 is a date field, and 11,8 is a PD field in both the files.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 29, 2010 8:02 pm
Reply with quote

other than record size, which I don't know if it is a problem,

Quote:

1,8 is a date field, and 11,8 is a PD field

but what is in columns 9 & 10?

Quote:

JOINKEYS FILES=F1,FIELDS=(1,10,A,11,8,A)
JOINKEYS FILES=F2,FIELDS=(1,10,A,11,8,A)

Back to top
View user's profile Send private message
maridawson

New User


Joined: 24 Jun 2008
Posts: 59
Location: chennai

PostPosted: Thu Apr 29, 2010 8:07 pm
Reply with quote

Tut mir leid...... it was a typo :'( .... actually 1,10 is the date field and 11,8 is a PD field.
Back to top
View user's profile Send private message
maridawson

New User


Joined: 24 Jun 2008
Posts: 59
Location: chennai

PostPosted: Thu Apr 29, 2010 8:09 pm
Reply with quote

When i tried to view the whole reformatted record, i.e, 1:4010, F2:11,8 are spaces for all the records. That means , the keys are itself not matching... right?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 29, 2010 8:15 pm
Reply with quote

maridawson,

how about
  1. all the JCL for the Sort Step
  2. are you sure the dates are of the same format? F1 uses '/', F2 uses '-' as separator?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 29, 2010 8:17 pm
Reply with quote

Since DFSORT does a binary compare on the JOINKEYS fields, the signs must be identical down to the bit representations, are they identical?
Back to top
View user's profile Send private message
maridawson

New User


Joined: 24 Jun 2008
Posts: 59
Location: chennai

PostPosted: Thu Apr 29, 2010 8:22 pm
Reply with quote

Herr Brenholtz,

1) JCL:
Code:
//PS0010   EXEC PGM=SORT                             
//TOOLMSG  DD SYSOUT=*                               
//DFSMSG   DD SYSOUT=*                               
//SYSOUT   DD SYSOUT=*                               
//SORTJNF1 DD DSN=FILE1,DISP=SHR                     
//SORTJNF2 DD DSN=FILE2,                             
//            DISP=SHR,BUFNO=20                       
//SORTOF01 DD DSN=MTCH.FILE,                         
//            DISP=(,CATLG,DELETE),                   
//            DCB=(RECFM=FB,LRECL=2000,BLKSIZE=0),   
//            UNIT=&UNIT,SPACE=&SP1                   
//*                                                   
//SORTOF02 DD DSN=UNMATCH.FILE,                       
//             DISP=(,CATLG,DELETE),                 
//             DCB=(RECFM=FB,LRECL=2000,BLKSIZE=0),   
//             UNIT=&UNIT,SPACE=&SP1                 





2) I am absolutely sure, both are using the seperator '-'.
Back to top
View user's profile Send private message
maridawson

New User


Joined: 24 Jun 2008
Posts: 59
Location: chennai

PostPosted: Thu Apr 29, 2010 8:48 pm
Reply with quote

OMG,

I sorted both the files seperately, and tried to view the PD field in HEX ON format. This is what i found,

The last bit is differing, one value is 'C' and other one is 'F'. this is why all the records are not matching i guess.

Is there any way to sort this out ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 29, 2010 8:58 pm
Reply with quote

dbz wrote:
FIELDS=(p,m,s<,p,m,s>...)
Must be specified to indicate the starting position, length and order (ascending or descending) of the keys in the input file.

The keys will be treated as binary, so they must be "normalized". For example, if the keys are actually zoned decimal, they must have all C and D signs, or all F and D signs. You can use an INREC statement in
JNF1CNTL and/or JNF2CNTL to normalize the keys for the F1 file and/or F2 file, respectively, if appropriate.


now, how to do it? someone else will have to provide you syntax for the INREC statement.

by the way, congratulations on figuring out what your problem is.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 29, 2010 8:58 pm
Reply with quote

Here is a link to the JOINKEY writeup
Back to top
View user's profile Send private message
maridawson

New User


Joined: 24 Jun 2008
Posts: 59
Location: chennai

PostPosted: Thu Apr 29, 2010 9:01 pm
Reply with quote

Is there any way to ignore the sign bit alone, and do a comparison between the two files ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 29, 2010 9:09 pm
Reply with quote

I don't think DFSORT does half-byte compares.
that is why the SORT documentation says
use an INREC statement to change the sign of one of the files.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 29, 2010 9:16 pm
Reply with quote

Good catch Dick....
User Guide for DFSORT PTFs UK51706 and UK51707 wrote:
You can use an INREC statement in JNF1CNTL and/or JNF2CNTL to normalize the keys for the F1 file and/or F2 file, respectively, if appropriate.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 29, 2010 9:23 pm
Reply with quote

I am glad I was able to help.
Frank has told me more than once
to stay out of Sort discussions

we were able to help the poster determine his problem,
without, unfortunately, providing a solution.
Back to top
View user's profile Send private message
maridawson

New User


Joined: 24 Jun 2008
Posts: 59
Location: chennai

PostPosted: Thu Apr 29, 2010 9:30 pm
Reply with quote

Thanks a lot DBZ....... icon_biggrin.gif Thanks for your help.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 29, 2010 9:47 pm
Reply with quote

dbzTHEdinosauer wrote:
I am glad I was able to help.
Frank has told me more than once
to stay out of Sort discussions
I don't think he means to 'stay out', more just to not post invalid, untested and poorly thought out information.
Quote:
we were able to help the poster determine his problem,
without, unfortunately, providing a solution.
Of that, I am not so sure, because if the OP is using DFsort, the INREC statement in JNFnCNTL will (I think) solve his problem.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 29, 2010 9:55 pm
Reply with quote

Quote:
Of that, I am not so sure, because if the OP is using DFsort, the INREC statement in JNFnCNTL will (I think) solve his problem.


what I meant was a FRANK-level solution -
I could not provide the requisite INREC statement to convert.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 29, 2010 10:04 pm
Reply with quote

Spent five minutes and looked at the Smart DFSORT Tricks

Quote:

Change a C sign to an F sign in PD values
A customer asked the following question:
I have three 5-byte packed decimal fields starting in positions 1, 6 and 11.
The positive values have a C sign (e.g X'123456789C'), but I need them to have an F sign.
The negative values have a D sign which I don't want to change.
Can DFSORT change the sign from C to F for the positive values?

DFSORT's TO=PDF feature makes it easy to change the C sign to an F sign in your PD values.
In this case, we can use OVERLAY to change the signs in the three specified fields
without changing anything else in each record.
Here's the control statements we'd use:
OPTION COPY
INREC OVERLAY=(1:1,5,PD,TO=PDF,
6:6,5,PD,TO=PDF,
11:11,5,PD,TO=PDF)

TO=PDF sets an F sign for each positive PD value regardless of whether it originally had an F sign or a C sign.
TO=PDC sets a C sign for positive PD values.
TO=ZDF sets an F sign for positive ZD values.
TO=ZDC sets a C sign for positive ZD values. the D sign is kept for negative values in all cases.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Apr 29, 2010 10:30 pm
Reply with quote

Jai Hind,

I can show you how to do what you want but I need more information.

Is 11 the starting position of the PD field in both files?

Which file has the PD field with the C sign?
Which file has the PD field with the F sign?

Which sign (C or F) do you want in the output records?

What is the RECFM and LRECL of each input file?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Apr 29, 2010 10:39 pm
Reply with quote

Dick,

It's not that I don't appreciate people trying to help - it's just that I get in later then everyone else because I'm on the U.S. West Coast and then I have to plow through all of the posts which is kind of counterproductive for me. There are 22 posts here in this thread. It should only have taken less than 5 at the most if I could have just asked the right questions myself. I just get a little tired of plowing through all these "good intentions". Even if the 22 posts helped clarify what was needed, that's a lot of posts. I think I can hone in on the problem and provide a solution more quickly in most cases, so I think the long discussions (and metadiscussions resulting from the discussions) are more of a distraction then a help. I hope you understand.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 29, 2010 10:46 pm
Reply with quote

Then I can well imagine you are not going to like
www.ibmmainframes.com/viewtopic.php?t=48326

Understand you, will comply.

dbz
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Apr 29, 2010 10:56 pm
Reply with quote

Quote:
Then I can well imagine you are not going to like
www.ibmmainframes.com/viewtopic.php?t=48326


Yes, you're right. I've deferred even looking at that one until later today.

Quote:
Understand you, will comply.


Thanks.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
Search our Forums:

Back to Top