View previous topic :: View next topic
|
Author |
Message |
CICS fan
New User
Joined: 03 Apr 2008 Posts: 82 Location: United States
|
|
|
|
i want to add trailer record to a data file which will contain a hardcoded reacord type '2' and count of all rcords excluding trailer record newly written. pls help. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Cics Fan,
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
A
B
C
D
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,TRAILER1=('2',COUNT)
/* |
The output of the above job is as below. All the data records are copied as is and a trailer record is added with '2' in pos 1 followed by a 8 byte count with leading zeros suppressed.
|
|
Back to top |
|
|
Senthilkumar k Warnings : 1 New User
Joined: 07 May 2009 Posts: 51 Location: Chennai
|
|
|
|
I have same requirement like above. But I need trailer without leading zeros supressed for that 8 bytes. Could anyone help me on this.... |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Senthilkumar k,
use the following control cards
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,TRAILER1=('2',COUNT=(M11,LENGTH=8))
/* |
|
|
Back to top |
|
|
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
Hi,
What if we are getting both header and trailer in the file. Now COUNT is going to include both the recs in the counting.
If we want to exclude the header and trailer count from the COUNT then how can we do that?
Thanks |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
mohitsaini wrote: |
Now COUNT is going to include both the recs in the counting. |
Yes. COUNT will give total records in the file.
mohitsaini wrote: |
If we want to exclude the header and trailer count from the COUNT then how can we do that?
|
You can use COUNT+n or COUNT-n to add\subtract number from it.
If you want to exclude header and trailer from count you can use.
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,TRAILER1=('2',COUNT-2=(M11,LENGTH=8))
/*
|
|
|
Back to top |
|
|
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
Thanks Sambha |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
You are welcome.. |
|
Back to top |
|
|
|