Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
sivaplv

New User

Joined: 15 Mar 2005
Posts: 17

 Posted: Sun Apr 17, 2005 10:46 am    Post subject: Partial Sort on a Binary field using DFSORT 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.

Frank Yaeger

DFSORT Moderator

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

 Posted: Sun Apr 17, 2005 8:30 pm    Post subject: 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.
sivaplv

New User

Joined: 15 Mar 2005
Posts: 17

 Posted: Mon Apr 18, 2005 1:36 am    Post subject: Re: Partial Sort on a Binary field using DFSORT 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,
Frank Yaeger

DFSORT Moderator

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

Posted: Mon Apr 18, 2005 5:50 am    Post subject:

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)  /*
sivaplv

New User

Joined: 15 Mar 2005
Posts: 17