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

Updating the existing Trailer


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

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Thu Dec 06, 2007 10:32 pm
Reply with quote

Hi All,
I have a VB file with header, trailer and detail record. Header record will start with 'A' in the first 8 bytes and Trailer record will have as shown below.

AAAAAAAA --> Header
FC232343
DE343523
ER343243
EE342423
999999999000000 - Trailer.

I want to update the trailer in the last 6 bytes with the actual number of records in teh file. How it can be done with ICETOOL and not with ICEMAN (as it wont work in my system).



Please dont say that it is already there in this forum, I already did numerous search with different combinations of words but none of the entry satisfies my query.
So Please help me on this as I have struck up with this final requirement. Please advice!!!
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 Dec 06, 2007 10:41 pm
Reply with quote

Quote:
How it can be done with ICETOOL and not with ICEMAN (as it wont work in my system).


This statement makes no sense. If you can use PGM=ICETOOL, then you can use PGM=ICEMAN.

When you say "the actual number of records in the file" do you mean the number of data records (4 in your example) or the number of data + header + trailer records (6 in your example)?

Can a new trailer record be rebuilt as:

999999999cccccc

where cccccc is the count? Or do you need other fields from the original trailer record that you didn't show in your example?

You said the input file has RECFM=VB. What is the input file's LRECL?
Back to top
View user's profile Send private message
sakthi_ksv

New User


Joined: 20 Jul 2006
Posts: 48
Location: Chennai

PostPosted: Fri Dec 07, 2007 9:18 am
Reply with quote

the count of records means, only the count of detail records, count of header and trailer should not be included. Length of the trailer and header will be as shown in the example above and only the length of detail record varies (from the above example with the actual file entries) and the LRECL is 436.

For your question

Quote:

Can a new trailer record be rebuilt as:

999999999cccccc

where cccccc is the count? Or do you need other fields from the original trailer record that you didn't show in your example?


Though the trailer will always contain '9' in the first 8 bytes followed by 6 bytes of count of no records, I will prefer to retain the original trailer in which the last six bytes will be the count of no of records.

Please advice!! This is the last thing I have to do with my requirement, once it is done, my task is over, Please help me on this.

Thanks and Regards,
Sakthi.
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: Fri Dec 07, 2007 9:49 pm
Reply with quote

Quote:
Though the trailer will always contain '9' in the first 8 bytes followed by 6 bytes of count of no records, I will prefer to retain the original trailer in which the last six bytes will be the count of no of records.


I don't see the difference between these two. They will both result in a 19-byte trailer with an RDW, eight 9's and a 6-character count.

You can rebuild the trailer record with a DFSORT job like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (VB/436)
//SORTOUT DD DSN=...  output file (VB/436)
//SYSIN    DD    *
  OPTION COPY,VLSCMP
  OMIT COND=(5,9,CH,EQ,C'999999999')
  OUTFIL REMOVECC,
    TRAILER1=(C'999999999',COUNT-1=(EDIT=(TTTTTT)))
/*


You can just change the count in the trailer record with a DFSORT job like this:

Code:

//X1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (VB/436)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    VTOF,BUILD=(80X),
    TRAILER1=(C'NEWCT,''',COUNT-2=(EDIT=(TTTTTT)),C'''')
/*
//X2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file (VB/436)
//SORTOUT DD DSN=...  output file (VB/436)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(5,9,CH,EQ,C'999999999'),
    OVERLAY=(14:NEWCT))
/*
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 Nov 13, 2010 5:13 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 update the count in the existing trailer record quite easily like this:

Code:

//NEW   EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (VB/436)
//SORTOUT DD DSN=...  output file (VB/436)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL IFTRAIL=(HD=YES,
     TRLID=(5,9,CH,EQ,C'999999999'),
     TRLUPD=(14:COUNT=(EDIT=(TTTTTT))))
/*


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 Adding first / last acct numerber to ... DFSORT/ICETOOL 7
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
No new posts I want to append a record in an exist... CLIST & REXX 17
No new posts Comparing Header and Trailer. DFSORT/ICETOOL 7
No new posts Updating a 1 byte thats in occurs mul... DFSORT/ICETOOL 6
Search our Forums:

Back to Top