Page 1 of 2

How to left Justify the record count in trailer record?

PostPosted: Thu Dec 29, 2011 1:10 pm
by pjagathis
Hi,

My requirement is to get record count alone in a flat file..

When i am using TRAILER2= Count, it giving count as right justified..

Please see the code
//SORTIN   DD *                                     
  123                                               
  FDS                                               
  DER                                               
  234                                               
/*                                                   
//**                                                 
//CUNTFILE DD DSN=OUTPUT-FILE,                       
//            DISP=(NEW,CATLG,DELETE),               
//            UNIT=SYSDA,                           
//            SPACE=(CYL,(5,5),RLSE),               
//            DCB=(RECFM=FB,LRECL=010,BLKSIZE=0)     
//**                                                 
//SYSIN    DD *                                     
**                                                   
  SORT FIELDS=COPY                                   
**                                                   
  OUTFIL FNAMES=CUNTFILE,REMOVECC,NODETAIL,         
**     TRAILER1=(1:COUNT=(M10,LENGTH=10))           
/*                                                   
//**                                                 



Output getting:

        4


Required Output:


Please help me ....

ThanX in advance...!

Re: How to left Justify the record count in trailer record?

PostPosted: Thu Dec 29, 2011 3:02 pm
by Nik22Dec
Hi,

I tried calculating the record count & removing the leading spaces in a single sort step but, couldn't succeed. Though, what I could achieve was to remove leading spaces in a separate step. Please refer to the sort given below.

//S1    EXEC  PGM=SORT                 
//SYSOUT    DD  SYSOUT=*               
//SORTIN DD *                           
     1                                 
     3                                 
//SORTOUT DD SYSOUT=*                   
//SYSIN    DD    *                     
  SORT FIELDS=COPY                     
  INREC BUILD=(1,14,JFY=(SHIFT=LEFT))   
/*                                     

Hope it helps.

Thanks & Regards,
Nik

Re: How to left Justify the record count in trailer record?

PostPosted: Thu Dec 29, 2011 11:29 pm
by BillyBoyo
pjagathis,

It is not easy to do what you want. Why do you want it left-justified? If the data is to be read by something external to the mainframe, why don't you take the zero-suppression off? 000000004 is the same as 4bbbbbbbbb for anything which wants to read that figure.

Re: How to left Justify the record count in trailer record?

PostPosted: Fri Dec 30, 2011 2:20 pm
by pjagathis
Hi Nik22Dec,

ThanX Nik22Dec...

I also tried this yesterday.. but i am trying to do in single sort step.... Or we can use any logic to get it done ???

Hi BillyBoyo,

ThanX...

But my requirement is to suppress the leading zeros and left justify the count... Let me try further.. i googled it for many times but i didn't get solution for this... we can do it 2 steps.. but i am trying to do in single step.. since i have to create count for more than 6 files.. so that i can reduce the step...

Thanx...

Re: How to left Justify the record count in trailer record?

PostPosted: Fri Dec 30, 2011 2:26 pm
by BillyBoyo
I understand that it is your requirement, but I don't understand why. What is the business necessity for it to be like that?

To show you the sort of thing it will take, look at this: http://ibmmainframes.com/about54238.html Scroll back two posts, and you'll see some code. I'd not like that sort of code included anywhere just to do that, unless there is a really, really, good reason.

Re: How to left Justify the record count in trailer record?

PostPosted: Tue Jan 03, 2012 2:27 pm
by pjagathis
Hi BillyBoyo,

As of now, I have delivered files with leading zeros...

ThannX for your help..!

Re: How to left Justify the record count in trailer record?

PostPosted: Tue Jan 03, 2012 2:36 pm
by BillyBoyo
Thanks for letting us know.

There is no reason I can think of that this should cause a problem to anyone trying to read those totals in any language. If you get complaints, explain the situation to your boss, show his the amount of code you'd need (and the example won't work for you directly, you'd need to work on it) and get them to sort it out.

Re: How to left Justify the record count in trailer record?

PostPosted: Mon Jan 09, 2012 2:40 pm
by pjagathis
Happy .. BillyBoyo!

Accepted the file with leading Zeros..

Have a Great day..!

Re: How to left Justify the record count in trailer record?

PostPosted: Mon Jan 09, 2012 3:07 pm
by BillyBoyo
I'm glad. Thanks for letting us know.

Re: How to left Justify the record count in trailer record?

PostPosted: Tue Jan 10, 2012 7:09 pm
by pjagathis
Code I have used..

OUTFIL FNAMES=OTPTFIL,                     
           OUTREC=(1,80),REMOVECC,NODETAIL,     
         TRAILER1=(1:COUNT=(M11,LENGTH=10))