View previous topic :: View next topic
|
Author |
Message |
Help-Me-Out
New User
Joined: 09 Dec 2006 Posts: 56 Location: Pune
|
|
|
|
can we sum the comp-3 amounts and write them in trailer with PD format |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
When you have a question, you should start a new topic for your question (rather than post a reply to a topic that has been inactive for years. . .).
Suggest you show some sample input and the output you want from this input. Mention the recfm and lrecl of the files. |
|
Back to top |
|
|
Help-Me-Out
New User
Joined: 09 Dec 2006 Posts: 56 Location: Pune
|
|
|
|
Applologies!! I was searching the forum n replied to that..
Here is my requirement -
I have a file of 159 FB, which has amount PIC S9(9)V99 COMP-3 along with other fields. I need to generate the update the trailer with the count & sum of the amount, both in PD. Can we do this??
INPUT
000000026JAN2010
1234456000010
1234456000010
1234456000010
99999999
OUTPUT
000000026JAN2010
Account amount in PD
1234456 000010
1234457 000010
1234458 000010
99999999count in PD sum in PD |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Applologies!! I was searching the forum n replied to that.. |
Not to worry
And we highly encourage searching
If there is a topic you want to refer, you can post the link to it (the topic you found) in your new topic.
Why did pos 1-7 change in the output? In the new trailer, what should be the count (i.e. should the count include the header and/or trailer)? Should the "sum" for the sample data be 30? |
|
Back to top |
|
|
Help-Me-Out
New User
Joined: 09 Dec 2006 Posts: 56 Location: Pune
|
|
|
|
Not that way..I was just showing wt is first field n second field.
OUTPUT
000000026JAN2010
Account amount in PD
1234456 000010
1234457 000010
1234458 000010
99999999count in PD sum in PD
In trailer count should exclude HDR & TLR. and sum willbe 30 but in comp-3 format. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
What is the starting position, length and format of each relevant field in your input records, and expected trailer record?
Is the Account record really in the input file?
Are you sorting the records or just copying them? |
|
Back to top |
|
|
Help-Me-Out
New User
Joined: 09 Dec 2006 Posts: 56 Location: Pune
|
|
|
|
Yes, I am sorting the input on account.
Account no is in file of 19 bytes (starting at pos 1) & amount is in S9(9)V99 COMP-3 (starting at pos 20). Account & amount is in input file only.
Trailer should have TLR identifier of 19 chars (19 9's), Total count excluding HDR & TLR in PD lenght of 9 & sum of amounts after that. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Well, your description doesn't really match your example. It looks like you have a 7-byte account number rather than a 19-byte account number. but assuming that 7 bytes of 0s and 9s is enough to identify the header and trailer record, respectively, you can use a DFSORT job like the following to do what I think you want:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/159)
//SORTOUT DD DSN=... output file (FB/159)
//SYSIN DD *
OMIT COND=(1,7,CH,EQ,C'9999999')
INREC IFTHEN=(WHEN=(1,7,CH,EQ,C'0000000'),
OVERLAY=(160:+0,TO=PD,LENGTH=6)),
IFTHEN=(WHEN=NONE,OVERLAY=(160:20,6))
SORT FIELDS=(1,19,CH,A)
OUTFIL REMOVECC,
BUILD=(1,159),
TRAILER1=(19C'9',TOT=(160,6,PD,TO=PD,LENGTH=9))
/*
|
|
|
Back to top |
|
|
|