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

How to update the record count in already exitsting trailer.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ESSPRABHU

New User


Joined: 11 Oct 2005
Posts: 22

PostPosted: Thu Jul 23, 2009 12:06 pm
Reply with quote

Hi,

I have to omit some records from my input file and need to update the record count(new count) in trailer record.

I will take care of records omission.
So please help me in updating the record count in the trailer record.

My file's RECFM =VB and LRECL=5063.
file has 'FFFF' at positon 1 for trailer record alone.
Trailer count should be 8 bype PD format.

I am copying portion of the trailer record in Hex format for reference.(from 60 - 80). Here the count is 38.

444444444444400000008
00000000000000000003C


Please let me know if you need further details.


Thanks,
Prabhu.
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Canada

PostPosted: Thu Jul 23, 2009 5:58 pm
Reply with quote

I think this link can help you

ibmmainframes.com/viewtopic.php?t=42409&highlight=
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: Thu Jul 23, 2009 9:49 pm
Reply with quote

Prabhu,

Does the count include the trailer record or is it just a count of the data records? That is, for your example are there 38 data records and a trailer record, or are there 37 data records and a trailer record?

Can the trailer record be rebuilt (e.g. it just has X'FFFF', blanks and the count) or is there something in the old trailer record that has to be kept for the new trailer record (what?).
Back to top
View user's profile Send private message
ESSPRABHU

New User


Joined: 11 Oct 2005
Posts: 22

PostPosted: Fri Jul 24, 2009 11:30 am
Reply with quote

Hi Frank,

In my file, one Header and one Trailer record will be there.

Count in the trailer record should be total detail record count. I.e excluding header and trailer.

Trailer is not required to re-build. Because old trailer needs to be copied as it is by updating the detail record count only.
Back to top
View user's profile Send private message
ESSPRABHU

New User


Joined: 11 Oct 2005
Posts: 22

PostPosted: Fri Jul 24, 2009 4:08 pm
Reply with quote

Frank,

when I use the below code, I am getting count of all the records including Header and trailer.

SORT FIELDS=COPY
OUTREC IFOUTLEN=5063,
IFTHEN=(WHEN=INIT,OVERLAY=(5064:SEQNUM,8,PD,START=1)),
IFTHEN=(WHEN=(5,2,BI,EQ,X'FFFF'),OVERLAY=(77:5064,8))


but I need the count of Detail records only i.e excludig Header and Trailer.

Could you please advice.

Thanks,
Prabhu.
Back to top
View user's profile Send private message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Fri Jul 24, 2009 4:41 pm
Reply with quote

What will be the value in 5,2 for detail records?

Regards
Tanden
Back to top
View user's profile Send private message
ESSPRABHU

New User


Joined: 11 Oct 2005
Posts: 22

PostPosted: Fri Jul 24, 2009 7:45 pm
Reply with quote

Tanden,

The value in 5,2 for detail records will not be unique.
It will have alphanumeric data.

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

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jul 24, 2009 9:06 pm
Reply with quote

ESSPRABHU,

Since your input is VB it is not a good idea to stick to the Seqnum at the end. We need to stick it right after the RDW and then later on remove it so that we preserve the original VB layout. Since you dont want the header and trailer to be part of the count , we subtract 2 from the seqnum which will give the count of just detail records

Adding the seqnum will push the data contents by 8 bytes

Code:

RDW |SEQNUM |13             |COUNT
1-4 |5-12   |DATA           |85   


Once we updated the count , then we remove the 8 bytes we added

Code:

RDW |5             |COUNT 
1-4 |DATA          |77     

Use the following control cards
Code:

//SYSIN    DD *                                       
  SORT FIELDS=COPY                                     
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,8,PD,5)), 
  IFTHEN=(WHEN=(13,2,CH,EQ,X'FFFF'),                   
  OVERLAY=(85:5,8,PD,SUB,+2,PD,LENGTH=8))             
  OUTREC BUILD=(1,4,13)                               
//*
Back to top
View user's profile Send private message
ESSPRABHU

New User


Joined: 11 Oct 2005
Posts: 22

PostPosted: Mon Jul 27, 2009 4:22 pm
Reply with quote

Hi Skolusu,

Thanks for your reply.
The code is working perfectly.
Thanks for your suggestion on Sequence number postion.


Prabhu...
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: Sat Oct 30, 2010 1:43 am
Reply with quote

With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct,2010), you can now use DFSORT's new IFTRAIL function to do this more easily like this:

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=(HD=YES,TRLID=(5,2,BI,EQ,X'FFFF'),
    TRLUPD=(77:COUNT=(TO=PD,LENGTH=8)))
/*


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

 


Similar Topics
Topic Forum Replies
No new posts count contained values of several col... DB2 5
No new posts DB2 Query to get the count of Unique ... DB2 2
No new posts To Discard record with 0 entry if Dup... SYNCSORT 7
No new posts To Populate Trailer cnt in the file w... SYNCSORT 1
No new posts Write record twice based on condition... SYNCSORT 7
Search our Forums:


Back to Top