MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Summing summary records in a GDG

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
doubt_man
Beginner


Joined: 12 Mar 2004
Posts: 15
Topics: 6

PostPosted: Fri Mar 26, 2004 8:38 am    Post subject: Summing summary records in a GDG Reply with quote

HI ALL,
M input file has a summary record in the top followed by a number of detailed records. the summary record consist of
count pic 9(10)
debit pic s9(13)v99
credit pic s9(13)v99
date x( 08 )
time x( 06 )

The input is a gdg with a number of versions. i have to pick up the last 7 versions, concatenate the details with only one summary record(which is the sum of all 7 summary records).

I used this control card for that.

SORT FIELDS=COPY
OUTFIL FILES=1,
INCLUDE=(1,1,CH,NE,C'L')
OUTREC FIELDS=(1,300)
SUM FIELDS=(1,10),FORMAT=ZD
OUTFIL FILES=2,
INCLUDE=(1,1,CH,EQ,C'L')
OUTREC FIELDS=(1,300)

The problem is that as date fields are also present , the summary records will never be duplicate. How can i find the sum of the fields count,debit and credit, and display as a single summary record at the top and all the detail records following that?
please tell me if any clarifications of the post is needed.
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Mar 26, 2004 8:51 am    Post subject: Reply with quote

Doubtman,

Please follow the forum rules.Rule # 2 specifies to Use meaningful topics (don't use the Forum/subject name for the topic).

A more approriate topic title would be "summing summary records in a GDG"

Also whenever you post a question, Make sure to provide all the details like LRECL, RECFM, and a sample of input and desired output

I have an idea for the solution , but I don't want to make any assumptions. How do you distinguish the summary records in the gdg from the detail records?

Does any of the fields(credit , debit) have an imbedded decimal point.

When you say you want one record with all sumaries records summed up, what do you want for the date and time? Since you are clubbing the summary recs into 1 single records , what should be the value for date and time? Do you want the oldest or earliest date and time or current date and time.

I have a meeting right now, so I will post a solution once I get out of it. Mean while try to provide the details I asked for

Thanks

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
doubt_man
Beginner


Joined: 12 Mar 2004
Posts: 15
Topics: 6

PostPosted: Sat Mar 27, 2004 1:50 am    Post subject: Reply with quote

hi kolsu,
sorry for not following the rules. i will keep that in mind the next time i post something. The following are the details you asked me to provide

lrecl=300
recfm=fb
the working storage defenitions for the debit and credit fields are
debit pic s9(13)v99
credit pic s9(13)v99

There is no constraint in selecting date, we can have any one date from the 7 records. but if you can tell me how you insert the current date and time through syncsort , it would be nice,because i dont know how to do that.

thanks
doubt_man
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Sun Mar 28, 2004 9:06 pm    Post subject: Reply with quote

doubt_man,

Please answer the following questions.


  • How do you distinguish the summary records in the gdg from the detail records?
  • Does any of the fields(credit , debit) have an imbedded decimal point?
  • A sample of input and desired output



Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
doubt_man
Beginner


Joined: 12 Mar 2004
Posts: 15
Topics: 6

PostPosted: Mon Mar 29, 2004 12:51 am    Post subject: Reply with quote

hi kolsu,
these are the answers to the qustions you asked.

1. the detail records start with a 'L' and the summary records start with '0'

2. i am not clear with what an imbeded decimal point . anyway i will provide the sample summary record
000000025400000017346097L00000000005697O2004021716084020040208

3. the sample input of one version of the gdg will be like this

000000004000000008535803K00000000000000{2004021716084020040208
LHAF1101500001499206 110150000149920620031208PAFCADCA000002004010
LHAF1101500001507525 110150000150752520031218PAFCADCA000002004010
LHAF1101500001500279 110150000150027920031212PAFCADCA000002004010
LHAF1101500001503499 110150000150349920031208PAFCADCA000002004010
LHAF1101500001506659 110150000150665920031206PAFCADCA000002004010

There will be 7 versions like this. when we concatenate the 7 versions and split it into two files we will get someting like this(space originally not there. just given for clarification)
file 1 ( summary)
0000000041 0000007535803K 0000000000000{ 004021716084020040208
0000000045 0000006535803K 0000000000000{ 004021716084020040208
0000000049 0000005535803K 0000000000000{ 004021716084020040208
0000000052 0000008535803K 0000000000000{ 004021716084020040208
.....(7records)

file 2 (detail)
LHAF1101500001499206 110150000149920620031208PAFCADCA000002004010
LHAF1101500001499206 110150000149920620031208PAFCADCA000002004010
LHAF1101500001499206 110150000149920620031208PAFCADCA000002004010
LHAF1101500001499206 110150000149920620031208PAFCADCA000002004010
LHAF1101500001499206 110150000149920620031208PAFCADCA000002004010
.....
currently i am using this sort card for distinguishing between the summary record and detail record

SORT FIELDS=COPY
OUTFIL FILES=1,
INCLUDE=(1,1,CH,NE,C'L')
OUTFIL FILES=2,
INCLUDE=(1,1,CH,EQ,C'L')


Also please tell me how to insert the current date and time.
one more question. is there any way to insert numeric values using inrec?
i know that we can insert hexadecimal . for example
inrec fields=(1:10,8,9,x'001c')
what if we need to insert numeric values??
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Mar 29, 2004 6:40 am    Post subject: Reply with quote

Doubtman,

The following DFSORT/ICETOOL jcl will give you desired results. If you have syncsort at your shop then change the pgm name to synctool.

A brief explanation of the job. We first concatenate all your 7 gdg versions and seperate the summary records from them. While seperating them we also will add a constant "sum" at the end , so that we can sum all the summary records.

The second sort operator takes the summary record file and performs the sum and also writting out it will write the current date and time. You should have the latest ptf from dfsort or syncsort for z/os to use the parms date1 and time parameters.

If you get an error on those parms, you can use the dates existing from the summary records.

Code:

//STEP0100 EXEC PGM=ICETOOL   
//TOOLMSG  DD SYSOUT=*         
//DFSMSG   DD SYSOUT=*         
//IN       DD DSN=YOUR GDG VERSION(-6),
//            DISP=SHR               
//         DD DSN=YOUR GDG VERSION(-5),
//            DISP=SHR               
//         DD DSN=YOUR GDG VERSION(-4),
//            DISP=SHR               
//         DD DSN=YOUR GDG VERSION(-3),
//            DISP=SHR               
//         DD DSN=YOUR GDG VERSION(-2),
//            DISP=SHR               
//         DD DSN=YOUR GDG VERSION(-1),
//            DISP=SHR               
//         DD DSN=YOUR GDG VERSION(-0),
//            DISP=SHR               
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y,),RLSE)     
//T2       DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y,),RLSE)     
//T3       DD DSN=&T3,DISP=(,PASS),SPACE=(CYL,(X,Y,),RLSE)     
//CON      DD DSN=&T3,DISP=OLD,VOL=REF=*.T3                   
//         DD DSN=&T1,DISP=OLD,VOL=REF=*.T1                   
//OUT      DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//TOOLIN   DD *                                                       
  COPY FROM(IN) USING(CTL1)                                           
  SORT FROM(T2) USING(CTL2)                                           
  COPY FROM(CON) TO(OUT)                                               
//CTL1CNTL DD *                                                       
  OUTFIL FNAMES=T1,INCLUDE=(1,1,CH,EQ,C'L')  $ COPY DETAIL RECS       
  OUTFIL FNAMES=T2,SAVE,                     $ INCLUDE SUMMARY RECS   
  OUTREC=(01,10,                             $ COUNT                   
          11,15,                             $ DEBIT                   
          26,15,                             $ CREDIT                 
          C'SUM')                            $ CONSTANT SUM           
//CTL2CNTL DD *                                                       
  SORT FIELDS=(41,3,CH,A)                    $ SORT ON CONSTANT       
  SUM FIELDS=(01,10,ZD,                      $ SUM ON COUNT           
              11,15,ZD,                      $ SUM ON DEBIT       
              26,15,ZD)                      $ SUM ON DEBIT       
  OUTFIL FNAMES=T3,                                               
  OUTREC=(01,40,                             $ COUNT               
          DATE1,                             $ CURRENT DATE       
          TIME,                              $ CURRENT TIME       
          300:X)                             $ PAD SPACES UPTO 300
/*



Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Mar 29, 2004 6:43 am    Post subject: Reply with quote

doubtman,

Quote:

one more question. is there any way to insert numeric values using inrec?
i know that we can insert hexadecimal . for example
inrec fields=(1:10,8,9,x'001c')
what if we need to insert numeric values??


You can insert numeric values as shown below.
Code:

INREC FIELDS=(1,10,8,9,C'000010')            $ INSERT A CONSTANT 10


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Mar 29, 2004 12:06 pm    Post subject: Reply with quote

doubtman,

With DFSORT R14 PTF UQ90053 (Feb, 2003), you can also insert decimal constants directly and edit them or convert them to any numeric form you like with a specified length, e.g.

Code:

  INREC FIELDS=(1,10,8,9,+10,M11,LENGTH=6)


For complete information on this, see:

http://www.storage.ibm.com/software/sort/mvs/uq90053/online/srtmurfm.html#exp
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
doubt_man
Beginner


Joined: 12 Mar 2004
Posts: 15
Topics: 6

PostPosted: Mon Mar 29, 2004 11:28 pm    Post subject: Reply with quote

hi kolsu,
our shop is having synctool. but i got the idea. eventhough i completed the task i used three steps for the same. but yours is much better than mine and yours take only one step. Also i didnt know what "SAVE" was , but i went through the manual i have and found it out. i did some simple sorts using that and found how it works. today i learned somany new things like SAVE, how to insert a decimal constant.
Thanks frank i went thru the material and it was helpful. these r the things a fresher like me is looking for. thank you guys for the support.
thanks
doubt_man
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Mar 30, 2004 6:43 am    Post subject: Reply with quote

Doubtman,

I am glad that the solution worked out for you. Even though I showed as a single step, the process is actually a 3 step process in the background. well you will learn a lot about sort if you go thru some of the posts in the utilities forum. Enjoy your stay.

On a side note I would really appreciate if you can spell my name correctly. It is KOLUSU and not kolsu

Thanks,

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group