View previous topic :: View next topic
|
Author |
Message |
pjnithin
Active User
Joined: 22 Dec 2005 Posts: 116
|
|
|
|
I want to add trailer record at the end of the file after passing it thru a sort step.
input file
aaaaaaaaaaaaaaa
bbbbbbbbbbbbbbb
ggggggggggggggg
ddddddddddddddd
output shud look like
aaaaaaaaaaaaaaa
bbbbbbbbbbbbbbb
ggggggggggggggg
ddddddddddddddd
rec cnt : 4
let me know how i can do this. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
Back to top |
|
|
pjnithin
Active User
Joined: 22 Dec 2005 Posts: 116
|
|
|
|
I didn't get a clear idea from that link. Could you please throw some more light on this issue. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
sandy_mcs wrote: |
Thank's Frank, your "smart DFSORT tricks" helped me out and i got the solution to my query
The JCL i used to get count of records present in SORTIN in to SORTOUT. |
Code: |
//PGM1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=SMOM.SORT3.OUT,DISP=SHR
//SORTOUT DD DSN=SMOM.SORT.ICEOUT,DISP=SHR
//SYSIN DD *
OPTION COPY
OUTFIL NODETAIL,REMOVECC,
TRAILER1=(COUNT=(M11,LENGTH=4))
/*
|
Quote: |
Put the "COUNT" in the "TRAILER1"? |
|
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
Back to top |
|
|
pjnithin
Active User
Joined: 22 Dec 2005 Posts: 116
|
|
|
|
can i do this in one single step???? |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
pjnithin wrote: |
can i do this in one single step???? |
Looking at sandy_mcs's sample, I only see one step...... |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
pjnithin
This is how you do in a single step
Code: |
//*******************************************************
//STEP1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAAAAAAAAAAAAA
BBBBBBBBBBBBBBB
GGGGGGGGGGGGGGG
DDDDDDDDDDDDDDD
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,
TRAILER1=(1:C'REC CNT=',10:COUNT=(M11,LENGTH=8))
/*
|
SORTOUT:
Code: |
----+----1----+----2---
AAAAAAAAAAAAAAA
BBBBBBBBBBBBBBB
GGGGGGGGGGGGGGG
DDDDDDDDDDDDDDD
REC CNT= 00000004
|
|
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
CICS Guy
Quote: |
Looking at sandy_mcs's sample, I only see one step...... |
The NODETAIL in
Code: |
OUTFIL NODETAIL,REMOVECC,
|
ensures that no i/p records are copied to the o/p.
So in the o/p you see only one record which says the count of records.
Hence pjnithin thought that, this is a two step process.
But by removing the NODETAIL, in OUTFIL statement you can achieve this |
|
Back to top |
|
|
pjnithin
Active User
Joined: 22 Dec 2005 Posts: 116
|
|
|
|
Hi,
I need to update my trailer record count after excluding some records using sort.
Input:
1111111111 22222
1111111111 33333
4444444444 55555
6666666666 66666
trailr abc 00004
now the output after sort shud look like :
Output:
1111111111 22222
4444444444 55555
6666666666 66666
trailr abc 00003
'trailr abc' is not a constant value, so this cannot be hardcoded anywhere in the sort step. but i need the record count to be updated in the trailer record after sorting the input file based on (1,10) chars. |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
So are you saying that the trailer record contains unknown variable data?
eg it might be
but then again it might be
trailr def 00004
or maybe
trailer wxyz 00004
or 'something else'
and based on that , you want to remove any duplicates from the file prior to the trailer record and update the 'count' with the new number of records.
Is the trailer record at least always the last record in the file?
Maybe you could give some more input and output examples to explain the 'rules'. |
|
Back to top |
|
|
pjnithin
Active User
Joined: 22 Dec 2005 Posts: 116
|
|
|
|
sir the output file shows that the records are sorted on first 10 chars and the duplicate records are removed.
trailer will always be the last record.
again, trailr abc...this can be anything like trailk def or trailr kgh etc..
but wat i have to do is by retaining the other details in the trailer record i need to update the count in that.
So after sorting and removing the duplicates, the trailer record should become like 'trailr abc 00003' instead of 'trailr abc 00004' . Because there was one duplicate record and it has been removed. hope its clear to you now.... |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
Back to top |
|
|
pjnithin
Active User
Joined: 22 Dec 2005 Posts: 116
|
|
|
|
dear sir,
please read my requirement.
its a different question. i already have my trailer here and the count of input records. now i need to sort the detail records and retain the trailer record and also update the counter with proper count after remocing the dulicates. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Here is a similar job that Frank built for another using SYMNAMES:
SIMILARITIES- removing dups
- passing an updated count
DIFFERENCES- variable length records
- looking for a header
with a few modifications, you can have your fixed length trailer update
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (VB)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
SORT FIELDS=(5,13,CH,A)
SUM FIELDS=NONE
OUTFIL FNAMES=T1
OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,VTOF,
BUILD=(80X),
TRAILER1=('NEWCT,''',COUNT-1=(M11,LENGTH=4),C'''')
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=... output file (VB)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(5,1,CH,EQ,C'A'),
OVERLAY=(63:NEWCT))
/*
|
|
|
Back to top |
|
|
pjnithin
Active User
Joined: 22 Dec 2005 Posts: 116
|
|
|
|
I have a input file like this.
adc a 10.00
abc a 20.00
dfg b 30.00
My output file shud be like
adc a 10.00
abc a 20.00
dfg b 30.00
t cnt:3 tot=60.00
The last five digits is a character field of 5 digits. I need to take the sum of these fields and also the count of the number of records and create a trailer record as given below.
Please help. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Nithin,
Sort card for you req:
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,
TRAILER1=(C'T CNT:',COUNT=(EDIT=(TTTT)),
C'TOTAL=',TOT=(7,5,SFF,EDIT=(TT.TT)))
/* |
OP with your IP:
Code: |
ADC A 10.00
ABC A 20.00
DFG B 30.00
T CNT:0003TOTAL=60.00 |
Note: Change the trailer1 part according to your req. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Use the below code
Code: |
//SYSIN DD *
SORT FIELDS=(1,3,CH,A)
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('INPUT COUNT: ',COUNT=(M11,LENGTH=8),' TOTAL:',
TOT=(7,5,SFF,EDIT=(TT.TT)))
/*
|
|
|
Back to top |
|
|
|