Posted: Tue Jan 11, 2005 11:58 am Post subject: SORT - sum of AST, select from 2 files
Hi,
i’ve searched for this in the forum, but found nothing!
i’ve got a problem with SORT and
- Build the sum of AST
- select records from a file depend on (existing) keys reading from another one.
We have only SORT/ICEMAN, but no ICETOOL!
Precisely: i have 2 files (today und yesterday), both FB, LRECL=19, stucture:
YYYYMMDDnnnnnnnnnn+,
Key (1,8 ) number/ZD (9,10) and sign (19,1)
e.g.
yesterday
200501010000000005-
200501020000000010-
today:
200501010000000005+
200501010000000003-
200501030000000011+
i need to sum the fields, but the record/key only existing in the yesterday-file must be deleted!
result: 2 records
200501010000000003- => key-sum of yersterday (1 time) and today (2 times)
200501030000000011+ => sum of today (1time)
key 20040102 plays no role, it doesnt exists in todays file.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Jan 11, 2005 12:21 pm Post subject:
Quote:
We have only SORT/ICEMAN, but no ICETOOL!
I don't understand this statement. If you have DFSORT (PGM=ICEMAN or PGM=SORT) then you have ICETOOL (PGM=ICETOOL). ICETOOL has been shipped free with DFSORT since 1991. Are you saying you use Syncsort (WER messages) rather than DFSORT (ICE messages)?
I can probably come up with a solution using DFSORT's ICETOOL, but I don't answer questions on Syncsort. _________________ 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
Thanks for the reply.
i am only a stupid programmer. If i use PGM=SORT, it runs from the "standard" steplib. with icetool i get 806 - pgm not found. maybe the sysadmin didnt install it? suppose, we have icetool, i have problem only with convert the AST in PD - AST cant be summarized, or am i mistaken?
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Jan 11, 2005 5:50 pm Post subject:
Kolusu,
When I run your job, I get the wrong output:
Code:
200501010000000005-
200501030000000011+
5- instead of 3-. Are you getting 3-?
I don't understand why you're summing on 17,8,ZD since that's the file identifier rather than the converted AST value. _________________ 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
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Jan 11, 2005 5:58 pm Post subject:
Banan,
If you get an 806 ABEND for ICETOOL, then I suspect you're using Syncsort. ICETOOL is installed in the same libaries as DFSORT, so your System Programmers would have had to do something strange to "uninstall" ICETOOL.
Check your messages - for Syncsort, you'll get WER messages whereas for DFSORT you'll get ICE messages.
With z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004), you could use INREC with the new SFF (signed free form) format to convert your "AST" values to ZD values directly so you can SUM them. Using DFSORT's ICETOOL, you can do it all in one step as follows:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TIN DD DSN=... Today's file
//YIN DD DSN=... Yesterday's file
//TT DD DSN=&&TT,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
COPY FROM(TIN) TO(TT) USING(CTL1)
COPY FROM(YIN) TO(TT) USING(CTL2)
SORT FROM(TT) USING(CTL3)
//CTL1CNTL DD *
* Add 'T' id at end of today records.
OUTREC FIELDS=(1,19,20:C'T')
//CTL2CNTL DD *
* Add 'Y' id at end of yesterday records.
OUTREC FIELDS=(1,19,20:C'Y')
//CTL3CNTL DD *
* Refomat records to:
* |date|zd_value|id|
INREC FIELDS=(1,8,9:9,11,SFF,TO=ZD,LENGTH=11,20:20,1)
* Sort on date.
SORT FIELDS=(1,8,CH,A)
* Sum on zd_value
SUM FIELDS=(9,11,ZD)
OUTFIL FNAMES=OUT,
* Remove extra record with Y id.
OMIT=(20,1,CH,EQ,C'Y'),
* Reformat records back to:
* |date|ast_value|
OUTREC=(1,8,9:9,11,ZD,M1,SIGNS=(,,+,-),LENGTH=11)
/*
Of course, if you're not using DFSORT, or you don't have the new PTF yet, you can't do it this way. _________________ 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
Last edited by Frank Yaeger on Thu May 19, 2005 3:05 pm; edited 1 time in total
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Jan 11, 2005 8:05 pm Post subject:
Quote:
When I run your job, I get the wrong output:
Frank,
Thanks for pointing it out. I missed the AST field in the sum fields in step0300 of my job. I missed it duing the cut and paste. I am updating my post to reflect the change.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Jan 11, 2005 8:31 pm Post subject:
Quote:
By summing on the file identifier , and using it in the omit condition we eliminate the non matching records from the output.
Oh, that's an interesting way to do it. My approach for that was to sort the Today ('T') records ahead of the Yesterday ('Y') records and just sum on the converted AST field. That way, SUM keeps the 'T' record and I can just use 'Y' to OMIT the extra (nonsummed) 'Y' record. _________________ 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
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