Posted: Fri Mar 26, 2004 8:38 am Post subject: Summing summary records in a GDG
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).
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.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Fri Mar 26, 2004 8:51 am Post subject:
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
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.
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
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
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??
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Mar 29, 2004 6:40 am Post subject:
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.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Mar 29, 2004 6:43 am Post subject:
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
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Mar 29, 2004 12:06 pm Post subject:
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.
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
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Mar 30, 2004 6:43 am Post subject:
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
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