IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Trailer count including the trailer record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
Reply with quote

Use COUNT+1
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Apr 21, 2010 11:26 pm
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
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
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
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
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

Moderator Emeritus


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

PostPosted: Mon Apr 26, 2010 12:29 pm
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
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

Moderator Emeritus


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

PostPosted: Mon Apr 26, 2010 1:20 pm
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 Developer


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

PostPosted: Mon Apr 26, 2010 11:07 pm
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 Developer


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

PostPosted: Tue Oct 26, 2010 2:59 am
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:

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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
No new posts To get the count of rows for every 1 ... DB2 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top