Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to sum PD values in the trailer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Help-Me-Out

New User


Joined: 09 Dec 2006
Posts: 56
Location: Pune

PostPosted: Wed Dec 29, 2010 8:04 pm    Post subject: can we sum the comp-3 amounts and write them in trailer
Reply with quote

can we sum the comp-3 amounts and write them in trailer with PD format
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Dec 29, 2010 9:45 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Help-Me-Out

New User


Joined: 09 Dec 2006
Posts: 56
Location: Pune

PostPosted: Wed Dec 29, 2010 9:55 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Dec 29, 2010 10:04 pm    Post subject:
Reply with quote

Hello,

Quote:
Applologies!! I was searching the forum n replied to that..
Not to worry icon_smile.gif

And we highly encourage searching icon_idea.gif
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
View user's profile Send private message
Help-Me-Out

New User


Joined: 09 Dec 2006
Posts: 56
Location: Pune

PostPosted: Wed Dec 29, 2010 10:13 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Dec 29, 2010 10:56 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Help-Me-Out

New User


Joined: 09 Dec 2006
Posts: 56
Location: Pune

PostPosted: Thu Dec 30, 2010 10:21 am    Post subject: Reply to: How to sum PD values in the trailer
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Dec 31, 2010 12:10 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Remove junk values in a file and rite... KP1125 DFSORT/ICETOOL 2 Wed Jan 25, 2017 9:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us