Page 1 of 1

I do understand the use of Binary in an include statement

PostPosted: Wed Jan 06, 2016 4:23 pm
by deucalion0
Hello all, happy new year!!

I am testing some control statements for Syncsort to learn the software.

I cannot for the life of me get my head around this simple piece of code:

//STEP1  EXEC  PGM=SORT   
//SYSOUT   DD  SYSOUT=*   
//SORTOUT  DD  SYSOUT=*   
//SORTIN   DD  *           
00000010                   
TEST1                     
TEST2                     
TEST3                     
//SYSIN    DD  *           
  SORT FIELDS=(1,6,CH,A)   
 INCLUDE COND=(1,1,BI,EQ,2)
//                         


When I run this it does not include the first line which I would expect it to.

What would I need to enter here in order for it to pick up on binary equaling 2?

I would have thought that 1,1 means starting in column one for a length of 1 would be one byte.

I would appreciate absolutely any advise on this.

Thank you so very much!!

Re: I do understand the use of Binary in an include statemen

PostPosted: Wed Jan 06, 2016 4:30 pm
by BillyBoyo
The INCLUDE is only going to select anything if the first byte of one or more records contains the hexadecimal value 02 (X'02').

Re: I do understand the use of Binary in an include statemen

PostPosted: Wed Jan 06, 2016 4:36 pm
by deucalion0
Thank you for your reply Billy.

I experimented and the EBCDIC letters STX is HEX 02, so when I change the include to 1,3 I thought it would have picked this up, but it didn't.

STX                       
TEST1                     
TEST2                     
TEST3                     
//SYSIN    DD  *           
  SORT FIELDS=(1,6,CH,A)   
 INCLUDE COND=(1,3,BI,EQ,2)


You can probably see my thinking is not correct here.

Thank you!!

Re: I do understand the use of Binary in an include statemen

PostPosted: Wed Jan 06, 2016 4:58 pm
by BillyBoyo
X'02' is not equivalent to the three letters STX. In certain specific contexts X'02' would mean STX (start of character) but I doubt you'll ever need to know that (I don't know what those contexts are).

Put your editor into HEX mode, put 02 into the hex area made available (in position one) and run your code.

Re: I do understand the use of Binary in an include statemen

PostPosted: Wed Jan 06, 2016 6:09 pm
by deucalion0
Hi Billy,

that is excellent, I did that and then it worked.

Thank you for the help, it is appreciated!!

Re: I do understand the use of Binary in an include statemen

PostPosted: Sat Jan 16, 2016 8:47 am
by steve-myers
STX is the code for 'Start of text," usually in the context of a data transmission using the now obsolete binary synchronous protocol. What we see here appears to be the character string STX, not X'02'.