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

Partial Sort on a Binary field using DFSORT


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

New User


Joined: 15 Mar 2005
Posts: 17
Location: Toronto, Canada

PostPosted: Sun Apr 17, 2005 10:46 am
Reply with quote

Hi,

I need to sort first part of a Binary field , 8 in length, which stores date stamp in julian date format + time + 4 byte userid. I need only the date part to be sorted without the time part. Is it possible. if so please explain.

Thanks in advance.
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: Sun Apr 17, 2005 8:30 pm
Reply with quote

Siva,

You can use DFSORT's byte.bit notation to sort part of a binary field (e.g SORT FIELDS=(11,1.2,BI,A) for the first 10 bits starting at position 11). But in order to tell you the exact SORT statement to use, I need to know what position your binary field starts in and what your binary field looks like.

What part of the binary field do you need to sort (e.g. first 10 bits)?
Please show an example of what the binary field looks like in hex and identify where the date stamp is.
Back to top
View user's profile Send private message
sivaplv

New User


Joined: 15 Mar 2005
Posts: 17
Location: Toronto, Canada

PostPosted: Mon Apr 18, 2005 1:36 am
Reply with quote

Hi Frank,

Thanks for your quick reply. Here are the details you asked me to expalin the solution in a better way.

The binary filed in question starts in the record at position 11 for a length of 8 bytes. the field contains 0YYDDDHHMISSUSER. YYDDD is the julian date, HHMISS is the time and USER is the four digit userID. The data is right justified hence padded with zero on left.

Example: This is the data of this field in one record '0043662300000000' and its hex form is '000027B5EBE1AF00'. Please help explain how can I acheive sort only on the julian date part of this field.

Thanks,
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: Mon Apr 18, 2005 5:50 am
Reply with quote

I don't know what you mean by "its hex form is '000027B5EBE1AF00'". It looks like the hex form is '0043662300000000' - that would correspond to an 8-byte value in '0YYDDDHHMISSUSER' form. Assuming that's true and the yy values represent 20yy years (not 19yy and 20yy years), you could use the following DFSORT job to sort by just the Julian date (YYDDD) in the field:

Code:

//S1    EXEC  PGM=ICEMAN           
//SYSOUT    DD  SYSOUT=*           
//SORTIN DD DSN=...  input file                     
//SORTOUT  DD DSN=...  output file             
//SYSIN    DD    *                 
  SORT FIELDS=(11.3,2.4,BI,A) 
/*     


11.3 says the starting position is the second nibble in byte 11. 2.4 says the length is 20 bits (2 bytes and 1 nibble). 1 nibble = 1 hex = 4 bits.

Actually, since the first nibble is always 0, you can just treat the date as a 3-byte value (X'0YYDDD') in positions 11-13 and use the following SORT statement:

Code:

    SORT FIELDS=(11,3,BI,A)


If the yy values represent 19yy and 20yy years, let me know.

If you want to see what the first few values look like in hex, you can use this DFSORT job:

Code:

//S1    EXEC  PGM=ICEMAN           
//SYSOUT    DD  SYSOUT=*           
//SORTIN DD DSN=...  input file                     
//SORTOUT  DD SYSOUT=*             
//SYSIN    DD    *     
   OPTION COPY,STOPAFT=5   
   INREC FIELDS=(11,8,HEX) 
/*
Back to top
View user's profile Send private message
sivaplv

New User


Joined: 15 Mar 2005
Posts: 17
Location: Toronto, Canada

PostPosted: Mon Apr 18, 2005 3:30 pm
Reply with quote

Hi Frank,

After your earlier reply, I read the 'bytes.bits' notation explanations in DFSORT Programming Guide and applied (11,3,BI,A) and it worked.

Sorry, I jumbled the data formats in my earlier mail.

The date stamp in this case has Julian date (consisting of no century). Including the padded zero, this date occupies 3 bytes (4 bits or half byte for each character) since this date part has 6 characters (0YYDDD). So SORT starting at 11 (starting position of the field) for 3 bytes of this Binary field should sort only the date portion of the date stamp.

Thanks for your help, which saved me from handling this aspect in a COBOL program.

You can treat this post as closed.

Regards,
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 Help required to reset decimal points... DFSORT/ICETOOL 10
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
Search our Forums:

Back to Top