View previous topic :: View next topic
|
Author |
Message |
gileshpg
New User
Joined: 22 May 2008 Posts: 27 Location: Bangaluru
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
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 |
|
|
gileshpg
New User
Joined: 22 May 2008 Posts: 27 Location: Bangaluru
|
|
|
|
Thanks...
This will create another trailer record.
can you please tell how I can update the trailer without creating another record? |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
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 |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
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 |
|
|
|