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

Validate the trailer count and update the count


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

New User


Joined: 22 May 2008
Posts: 27
Location: Bangaluru

PostPosted: Tue May 24, 2011 3:56 pm
Reply with quote

Hi,

The input file contain header and trailer record.
I need to validate the the trailer count and modify if it is not correct.(not necessary to validate and change, write the correct count will do)

For example the trailer count is 8 in input it should be modified to 5.
Can this be done using sort/icetool....
Input:

****** ***************************** Top of Data **********
000001 H0000000501IACT20110323
000002 TESTRSE195201051243863861334A2440010
000003 TESTRSE195201241545803586CF175842910
000004 TESTRSE19520310257372484488162179D20
000005 TESTRSE19531002157202013600022076310
000006 TESTRSE195406051558749377431A6286510
000007 T0000000501IACT20110323000000008
****** **************************** Bottom of Data ********

Output should be:


****** ***************************** Top of Data *******
000001 H0000000501IACT20110323
000002 TESTRSE195201051243863861334A2440010
000003 TESTRSE195201241545803586CF175842910
000004 TESTRSE19520310257372484488162179D20
000005 TESTRSE19531002157202013600022076310
000006 TESTRSE195406051558749377431A6286510
000007 T0000000501IACT20110323000000005
****** **************************** Bottom of Data *****

thanks,
Gilesh
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue May 24, 2011 4:27 pm
Reply with quote

Read through these..... to reach your solution..
ibmmainframes.com/viewtopic.php?t=54023&highlight=update+trailer+count
ibmmainframes.com/viewtopic.php?t=18180&highlight=update+trailer+count
ibmmainframes.com/viewtopic.php?t=26548&highlight=update+trailer+count
ibmmainframes.com/viewtopic.php?t=26548&highlight=update+trailer+count
ibmmainframes.com/viewtopic.php?t=33057&highlight=update+trailer+count
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Tue May 24, 2011 5:09 pm
Reply with quote

Hello,
Here is One using ICETOOL, IDK if maybe effecient than other methods or anywhere near to being effecient, but it maybe simple to understand.

Code:
//JS020    EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*                               
//DFSMSG   DD SYSOUT=*                               
//SORTIN   DD DISP=SHR,DSN=WELLS.SORTIN             
//SORTOUT  DD DSN=WELLS.SORTOUT,DISP=MOD           
//SYSOUT   DD SYSOUT=*                               
//TOOLIN   DD *                                       
  SUBSET FROM(SORTIN) TO(SORTOUT) INPUT REMOVE LAST(1)
  COPY FROM(SORTIN) TO(SORTOUT) USING(CTL1)           
/*                                                   
                                                     
//CTL1CNTL   DD *                                     
  OUTFIL FNAMES=SORTOUT,REMOVECC,NODETAIL,           
      TRAILER1=(1,23,COUNT-2=(M11,LENGTH=9),48X)     
/*                                                   
//SYSUDUMP DD SYSOUT=*                               
/*                                                   



NOTE: There is a DISP=MOD in SORTOUT.

Hope it helps.
Back to top
View user's profile Send private message
gileshpg

New User


Joined: 22 May 2008
Posts: 27
Location: Bangaluru

PostPosted: Tue May 24, 2011 6:09 pm
Reply with quote

Thanks...
This will create another trailer record.
can you please tell how I can update the trailer without creating another record?
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Tue May 24, 2011 6:25 pm
Reply with quote

Hello,
The above program is updating the record that is already there or creating a new one.

If you spot a difference let me know.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue May 24, 2011 8:12 pm
Reply with quote

gileshpg,
If you have latest PTF for DFSort (Oct,2010)installed then you may use below jcl to update trailer count. I am assuming that TRAILER can be identified by 'T0000000' in the first 8 position and your count start at 25th position for 8 bytes.

Code:
//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
H0000000501IACT20110323                                 
TESTRSE195201051243863861334A2440010                   
TESTRSE195201241545803586CF175842910                   
TESTRSE19520310257372484488162179D20                   
TESTRSE19531002157202013600022076310                   
TESTRSE195406051558749377431A6286510                   
T0000000501IACT20110323000000008                       
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
 OPTION COPY                                           
 OUTFIL IFTRAIL=(HD=YES,TRLID=(1,8,CH,EQ,C'T0000000'), 
                 TRLUPD=(25:COUNT=(M11,LENGTH=8)))     
/*                                                     
//*                                                     


OUTPUT
Code:
H0000000501IACT20110323               
TESTRSE195201051243863861334A2440010 
TESTRSE195201241545803586CF175842910 
TESTRSE19520310257372484488162179D20 
TESTRSE19531002157202013600022076310 
TESTRSE195406051558749377431A6286510 
T0000000501IACT20110323000000005     


Thanks,
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue May 24, 2011 9:40 pm
Reply with quote

If you are getting a difference between the number of records and the count then you hould fix the program creating the file. How do you know if there are actual records missing or not missing?
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 To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
Search our Forums:

Back to Top