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
 

 

Trailer count including the trailer record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
naveengec

New User


Joined: 24 Mar 2007
Posts: 35
Location: pune

PostPosted: Wed Apr 21, 2010 4:53 pm    Post subject: Trailer count including the trailer record
Reply with quote

Hi,

I am trying to include the record count including trailer record thru SORT with the below code.

Code:

SORT FIELDS=COPY                                                     
   OUTFIL REMOVECC,TRAILER1=(1:C'ZZZ',COUNT=(M11,LENGTH=8)) 


This is giving a cound of records except the trailer record. PLease let me know how to include trailer record in the total count.
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Apr 21, 2010 4:58 pm    Post subject:
Reply with quote

Use COUNT+1
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: Wed Apr 21, 2010 11:26 pm    Post subject:
Reply with quote

Code:

   SORT FIELDS=COPY                                                     
   OUTFIL REMOVECC,TRAILER1=(1:C'ZZZ',COUNT+1=(M11,LENGTH=8)) 
Back to top
View user's profile Send private message
Help-Me-Out

New User


Joined: 09 Dec 2006
Posts: 56
Location: Pune

PostPosted: Fri Apr 23, 2010 11:52 am    Post subject: Reply to: Trailor count including the trailor record
Reply with quote

Hi,

In addition to the above I have one question. Can we overwite the trailer count in the same file?

Ex:

File 1
HDR0001
DTL0002
DTL0003
TLR0006

In this count of all records in trailer is appearing as wrong (0006), I need to count the records and put the correct count at same position & in same file.

I know this can be done by seperating the trailer and then merging it, but just a thought can we overwrite the count using OVERLAY or some other function?

Thanks
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Apr 23, 2010 5:56 pm    Post subject:
Reply with quote

Sandy, Below code will give you required.
(assuming LRECL is 80)

Code:

//S1    EXEC  PGM=SORT                                                 
//SORTIN DD *                                                           
HDR0001                                                                 
DTL0002                                                                 
DTL0003                                                                 
TLR0006                                                                 
//SORTOUT DD SYSOUT=*                                                   
//SYSOUT    DD  SYSOUT=*                                               
//SYSIN    DD  *                                                       
  SORT FIELDS=COPY                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,4,ZD)),                   
        IFTHEN=(WHEN=(1,3,CH,EQ,C'TLR'),OVERLAY=(4:81,4))               
  OUTFIL BUILD=(1,80)                                                   
/*                                                                     
Back to top
View user's profile Send private message
Help-Me-Out

New User


Joined: 09 Dec 2006
Posts: 56
Location: Pune

PostPosted: Mon Apr 26, 2010 11:04 am    Post subject: Reply to: Trailor count including the trailor record
Reply with quote

Thanks..

This is working...one more on top of this can we do same for VB format? I have tried but it's not overwrtting the trailer, its giving me error for RDW icon_cry.gif though I have used correct sort card.. I have tried by converting the VB fomat to FB, overwrite the count in TLR & then again converting FB into VB. icon_rolleyes.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Apr 26, 2010 11:45 am    Post subject:
Reply with quote

Quote:
This is working...one more on top of this can we do same for VB format? I have tried but it's not overwrtting the trailer, its giving me error for RDW


Tell us what error you are getting.

Show us the sortcard you are using.

Without you, tellling this is its not possible to say where you are going wrong.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Apr 26, 2010 12:29 pm    Post subject:
Reply with quote

Hello,

Quote:
its giving me error for RDW though I have used correct sort card..
Sorry but correct sort cards do not generate errors. . .

To get help you need to do as Sambhaji said - show what you used and the exact error(s) generated.
Back to top
View user's profile Send private message
Help-Me-Out

New User


Joined: 09 Dec 2006
Posts: 56
Location: Pune

PostPosted: Mon Apr 26, 2010 1:09 pm    Post subject: Reply to: Trailor count including the trailor record
Reply with quote

Here is the sort card -

SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,4,ZD)),
IFTHEN=(WHEN=(1,3,CH,EQ,C'TLR'),OVERLAY=(10:81,4))
OUTFIL BUILD=(1,80), VLFILL=X'40'
/*

Trailer count starts at position 10.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Apr 26, 2010 1:20 pm    Post subject:
Reply with quote

Hello,

And where is the error that was generated?

You need to copy/paste the exact error(s) (including message ids) from the diagnostic output.
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 26, 2010 11:07 pm    Post subject:
Reply with quote

Help-Me-Out,

For a VB file, you'd want to put the sequence number between the RDW and the first byte of data, not at the end of the record.

Quote:
Trailer count starts at position 10.


I don't know if you mean it starts at position 10 including the RDW or not including the RDW, so I'll show you an example where the trailer count starts at position 5 including the RDW and hopefully you can figure it out from that.

If the input records look like this:

Code:

Len|Data
14  HDR0001ABC
15  DTL0002DEFG
13  DTL0003HI
14  TLR0006JKL


and you want the output records to look like this:

Code:

Len|Data
14  HDR0001ABC
15  DTL0002DEFG
13  DTL0003HI
14  TLR0004JKL


you can use this DFSORT job:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (VB)
//SORTOUT DD DSN=...  output file (VB)
//SYSIN DD *
  SORT FIELDS=COPY
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:SEQNUM,4,ZD,9:5)),
        IFTHEN=(WHEN=(9,3,CH,EQ,C'TLR'),BUILD=(1,4,9,3,5,4,16)),
        IFTHEN=(WHEN=NONE,BUILD=(1,4,5:9))
/*
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: Tue Oct 26, 2010 2:59 am    Post subject:
Reply with quote

If you have z/OS DFSORT V1R10 PTF UK90025 or z/OS V1R12 PTF UK90026 (Oct, 2010), you can use the new IFTRAIL function to update the trailer record more easily:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (VB)
//SORTOUT DD DSN=...  output file (VB)
//SYSIN DD *
 OPTION COPY
 OUTFIL IFTRAIL=(TRLID=(5,3,CH,EQ,C'TLR'),
         TRLUPD=(8:COUNT+1=(EDIT=(TTTT))))
/*


For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
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 update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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