View previous topic :: View next topic
|
Author |
Message |
chinnielr
New User
Joined: 11 Jul 2005 Posts: 87
|
|
|
|
Hi,
I have an I/P file LRECL=200, RECFM=FB
My sort card looks like below
OMIT COND=(02,09,ZD,EQ,345623211)
SORT FIELDS=COPY
I have a field in I/P file OUT-COUNT 9(8) starting at 192 and length of 9 bytes. OUT-COUNT field should contain the number of output records.
If my I/P file has 500 records and the number of records OMITTED using te above sort is 200 and the O/P file should contain 300 records.
I need the OUT-COUNT should be populated with 300. How can I achieve this using DFSORT.
Please tell me how to modify the above same sort card to achieve this.
Thanks in adavance. |
|
Back to top |
|
|
bipinpeter
Active User
Joined: 18 Jun 2007 Posts: 213 Location: Cochin/Kerala/India
|
|
|
|
You can use the keyword 'COUNT' along with the outrec statement which will gives you the number of records which copied from input to output..
Regards,
Bipin Peter |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
How do you want the count? You want to write total count in Trailer record or record count of each record has to be written in the output incrementing 1 by 1.
e.g., in first record field value '1'
in second record '2' and so on.... |
|
Back to top |
|
|
chinnielr
New User
Joined: 11 Jul 2005 Posts: 87
|
|
|
|
Hi,
Thanks for your reply.
I want the number of O/P records to be populated in one of the I/P file field OUT-COUNT
My OUT-COUNT should be populated 300 (if I/P file has 500 records and 300 is the O/P of the DFSORT).
OUT-COUNT is of PIC 9(8) which I has mentioned earlier.
Please help!!! |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Hi chinnielr,
is OUT-COUNT field is only in trailer and to be updated with number of records in output?
or OUT-COUNT is part of every detail line of the file.
It would be better if you show us sample file and expected output file.
of-course they will.
but only if you give proper details of your requirement. |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
You have not provided asked info but below solution provides you the count in trailer record.
Code: |
//CTRCDS EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input file............,DISP=SHR
//SORTOUT DD DSN=output file.......,DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
SORT FIELDS=COPY
OMIT COND=(02,09,ZD,EQ,345623211)
OUTFIL FNAMES=SORTOUT,
OUTREC=(1,200),
TRAILER1=(192:COUNT=(M11,LENGTH=9))
/*
|
Above code you give the number of records in the output file in trailer recrd from position 192-200.
If you need something else, show us with examples. |
|
Back to top |
|
|
|