IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

add the trailer record counts


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rkurapati

New User


Joined: 12 Sep 2006
Posts: 11
Location: vizag

PostPosted: Wed Sep 13, 2006 9:12 pm
Reply with quote

Hi PLease help me out

i am running a program 'A' for 5 times and it is creating output for 5 times. And in each and every run it writes a trailer record which contains a total amount calculated and a sign bite(to identify whether amount is positive/negetive)....After all the 5 outputs i need to add all the amounts...

ex-:

Code:

1 st o/p---                       -1000
2 st o/p---                       +1000
3 st o/p---                       +1000
4 st o/p---                       +1000
5 st o/p---                       +1000


the total o/p i am expecing is +3000

can some one help me out to solve this..
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Sep 13, 2006 9:50 pm
Reply with quote

It's not clear what you're trying to do. Do you have 5 output files, each with a value in it? What is the starting position, length and format of the value you want to add up? What is the RECFM and LRECL of the 5 output files?

As an example of how to get the total with DFSORT, if your five output files have records that look like your example, e.g.

Code:

1 st o/p---                       -1000
2 st o/p---                       +1000
3 st o/p---                       +1000
4 st o/p---                       +1000
5 st o/p---                       +1000


you can use this DFSORT job to get the total:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...   count 1
//       DD DSN=...   count 2
//       DD DSN=...   count 3
//       DD DSN=...   count 4
//       DD DSN=...   count 5
//SORTOUT DD DSN=...  total count
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    TRAILER1=(TOT=(34,6,FS,EDIT=(SIIIIT),SIGNS=(+,-)))
/*


You could change this job appropriately depending on what your count records look like.
Back to top
View user's profile Send private message
rkurapati

New User


Joined: 12 Sep 2006
Posts: 11
Location: vizag

PostPosted: Wed Sep 13, 2006 9:59 pm
Reply with quote

hi,

could you please let me

how the below works in detail

34,6,FS,EDIT=(SIIIIT),SIGNS=(+,-)))

34,6 is a posision of the file???? need some clarification...
Back to top
View user's profile Send private message
rkurapati

New User


Joined: 12 Sep 2006
Posts: 11
Location: vizag

PostPosted: Wed Sep 13, 2006 10:45 pm
Reply with quote

actual problem is sigh byte is storing in different field....
Back to top
View user's profile Send private message
rkurapati

New User


Joined: 12 Sep 2006
Posts: 11
Location: vizag

PostPosted: Wed Sep 13, 2006 10:47 pm
Reply with quote

can some one help me out to get some detail explanation for the below

Code:

//SYSIN    DD    *                                     
   INREC OVERLAY=(41:4C'0',7,2,51:4C'0',10,2)           
    SORT FIELDS=(1,4,CH,A)                             
    SUM FIELDS=(41,6,ZD,51,6,ZD)                       
    OUTREC BUILD=(1,5,                                 
        6:51,6,ZD,DIV,+60,ADD,41,6,ZD,TO=ZD,LENGTH=3, 
        C':',51,6,ZD,MOD,+60,TO=ZD,LENGTH=2)           
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Sep 13, 2006 11:00 pm
Reply with quote

rkurapati,

It's difficult to help you when you keep moving from question to question and don't answer my questions.

Code:

34,6,FS,EDIT=(SIIIIT),SIGNS=(+,-)))


34 is the starting position of the numeric field.
6 is the length of the numeric field.
FS is the format. Since you showed your input fields as -1000 and +1000, I used DFSORT's FS format which can handle values like that.
If your actual numeric field is in a different format or at a different starting position, you need to say exactly what it looks like and what positions it's in.
EDIT=(SIIIIT),SIGNS=(+,-) converts the 34,6,FS numeric value to the form siiiit where s is the sign (+ for positive or - for negative), i is a digit (1-9 or blank for a leading zero) and t is a digit (0-9).
If you want the total count to look a certain way, you need to say exactly what you want it to look like.

Quote:
actual problem is sigh byte is storing in different field....


You need to explain this. Where is the sign and what does it look like? Where are the digits and what is their format and length?

Quote:
can some one help me out to get some detail explanation for the below
...


Where did you copy these statements from?

You can find complete information on DFSORT's control statements in Chapter 3 of "z/OS DFSORT Application Programming Guide" which you can access online along with all of the other DFSORT books from:

Use [URL] BBCode for External Links

Since you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online from the link above.
Back to top
View user's profile Send private message
rkurapati

New User


Joined: 12 Sep 2006
Posts: 11
Location: vizag

PostPosted: Wed Sep 13, 2006 11:06 pm
Reply with quote

Hi,

sorry for the above..


my problem is

If my each record is 15 bytes long and
i am storing the sign byte in first position and the amount i am storing from 08th byte to 15th byte.....

i need to add the amount based upon the sign field which i stored in first byte..
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Sep 14, 2006 12:38 am
Reply with quote

Do you have any numbers in position 2-7, or just non-numbers? Show an example of the input records so we can get the whole picture.

What do you want in the output record? Just the total? In what positions? In what form? Or do you want something else? Be specific.
Show an example of the output record so we can get the whole picture.
Back to top
View user's profile Send private message
rkurapati

New User


Joined: 12 Sep 2006
Posts: 11
Location: vizag

PostPosted: Thu Sep 14, 2006 12:48 am
Reply with quote

hi,

pls find the below trailer records of each input file....

9999990000001-000000000001000
9999990000001+000000000001000
9999990000001+000000000001000
9999990000001+000000000001000
9999990000001+000000000001000

here first six bytes to show that it is trailer record
next seven bytes shows the count of all the detail records and stored in this trailer record..
next byte +/- shouws the sign field....
next 15 bytes are for amount totals for all detail records...

...these 5 records we are giving as input to sort

and we need the output as single record as shown below

9999990000001+000000000003000
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Sep 14, 2006 1:27 am
Reply with quote

Quote:
If my each record is 15 bytes long and
i am storing the sign byte in first position and the amount i am storing from 08th byte to 15th byte.....


Actually, the sign is in position 14 and the digits follow it. So rather than the complicated situation you describe, you have the very simple situation of a 16-byte FS field in positions 14-29 which you can handle quite easily with this variation of the DFSORT job I gave you in my first post:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...   count 1
//       DD DSN=...   count 2
//       DD DSN=...   count 3
//       DD DSN=...   count 4
//       DD DSN=...   count 5
//SORTOUT DD DSN=...  total count
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    TRAILER1=(1,13,
      TOT=(14,16,FS,EDIT=(STTTTTTTTTTTTTTT),SIGNS=(+,-)))
/*


Next time, please show the input and output records in your first post to save us all time.
Back to top
View user's profile Send private message
rkurapati

New User


Joined: 12 Sep 2006
Posts: 11
Location: vizag

PostPosted: Thu Sep 14, 2006 2:57 am
Reply with quote

Hi tks for the update but

i have given the jcl as below and output is adding but for negetive fields also it is adding to the field..

INPUT JCL


//SORT EXEC PGM=ICEMAN
//SORTIN DD *
9999990000001-000000000001000
9999990000001+000000000001000
9999990000001+000000000001000
9999990000001+000000000001000
9999990000001+000000000001000
/*
//SYSIN DD *
SORT FIELDS=(1,6,ZD,A)
INCLUDE COND=(1,6,ZD,EQ,999999)
SUM FIELDS=(7,7,ZD,15,15,ZD)
OUTREC FIELDS=(1,13,14,16,ZD,EDIT=(STTTTTTTTTTTTTTT),SIGNS=(+,-,,))
/*
//SORTOUT DD DSN=T.JTAIXXX.ATBDZ.PS,
// DISP=SHR
//SYSPRINT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//SYSOUT DD SYSOUT=*


OUTPUT FILE CONTAINS..
999999000000E+000000000005000...
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Sep 14, 2006 3:29 am
Reply with quote

I don't understand why you ask for help and then ignore what I say and go off in your own direction. I showed you how to use 14,16,FS to handle your data as it appears in your input records. Instead of using the job I gave you, you turn around and try to SUM with 15,15,ZD and OUTREC with 14,16,ZD and then come back here asking why it doesn't work. I used FS to fit your data. ZD does NOT fit your data. FS can handle the leading + or - sign. ZD can't. ZD expects the sign to be in the last nibble so it ignores the leading sign. FS works. ZD doesn't. That's why I used FS in my job.

Why do you need the INCLUDE when all of your input records have 999999? Why do you want to use SUM and OUTREC instead of TOT? TOT supports FS. SUM doesn't. Did you even try the job I gave you?

I see you're also summing on the second field. You didn't show that in your output example, so I didn't do it, but if you need a total for the second field, you can do that with TOT too.

I've got to say that this is the most annoying interaction I've ever had on this board. icon_rolleyes.gif
Back to top
View user's profile Send private message
rkurapati

New User


Joined: 12 Sep 2006
Posts: 11
Location: vizag

PostPosted: Thu Sep 14, 2006 1:06 pm
Reply with quote

HI Frank,

sorry for thouble..The solution which you have sent is working fine ...thanks a millian for the help....

Thanks,
Ranganath.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top