Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Partial Sort on a Binary field using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Partial Sort on a Binary field using DFSORT
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 Moderator


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

PostPosted: Sun Apr 17, 2005 8:30 pm    Post subject:
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    Post subject: Re: Partial Sort on a Binary field using DFSORT
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 Moderator


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

PostPosted: Mon Apr 18, 2005 5:50 am    Post subject:
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    Post subject: Re: Partial Sort on a Binary field using DFSORT
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us