Page 1 of 1

JUNK CHARACTERS WHILE USING OUTREC

PostPosted: Thu Jul 16, 2009 3:09 am
by MAINFRAME GURU
Hi Guys,

This is the input file (which has Book #, Book name and Price):

1001 MATH  200
1002 ENG  100


This input file's LRECL is 80. I am using the below code to keep only Book # and Book name.

//STEP2    EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=XYZ.TEST2.ISORT,DISP=SHR                 
//SORTOUT  DD DSN=XYZ.TEST2.OSORT,DISP=(NEW,CATLG,DELETE),
//           SPACE=(CYL,(1,1),RLSE),                           
//           DCB=(BLKSIZE=8000,LRECL=80,RECFM=FB)               
//SYSIN    DD *                                                 
    SORT FIELDS=(1,4,CH,A)                                     
    OUTREC BUILD=(1,4,6,5)                           
/*                                                             
//*                                                             


When I executed the above code then I got the below mentioned output :

1001MATH .......................................................................
1002ENG  .......................................................................


Here I am not getting the space in b/w book # and book name... Moreover I am getting the junk characters after 11th column.

I used below code to insert space

OUTREC BUILD=(1,4,1X,6,5)


Is there anyway other way to get the spaces between the book # and book name other than above mentioned code... Also can anyone please tell me how can I remove the junk characters?

Regards,
Guru

Re: JUNK CHARACTERS WHILE USING OUTREC

PostPosted: Thu Jul 16, 2009 4:44 am
by Frank Yaeger
//           DCB=(BLKSIZE=8000,LRECL=80,RECFM=FB)               
//SYSIN    DD *                                                 
    SORT FIELDS=(1,4,CH,A)                                     
    OUTREC BUILD=(1,4,6,5)           


You got EXACTLY what you asked for.

1,4,6,5 will put input positions 1-4 in output positions 1-4 and input positions 6-10 in output positions 5-9.
LRECL=80 for the SORTOUT DD tells DFSORT to pad the rest of the bytes with binary zeros (those are your junk characters).

You can keep the space between the fields by using 1,10, or X or 1X or 6:. You can get rid of the junk characters by using 80:X to get blanks instead of binary zeros. So you can use:

  OUTREC BUILD=(1,10,80:X)


or

   OUTREC BUILD=(1,4,X,6,5,80:X)


or

   OUTREC BUILD=(1,4,6:6,5,80:X)


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080

Re: JUNK CHARACTERS WHILE USING OUTREC

PostPosted: Thu Jul 16, 2009 11:27 am
by MAINFRAME GURU
Thanks Frank for your help!!!

I have already started reading above mentioned book...

Again thanks for mentioning about the books....