MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
savi.sabari Beginner Joined: 11 Dec 2006 Posts: 6 Topics: 2
Posted: Fri Jun 29, 2007 3:48 pm Post subject: How to Add Editing Character Fields in a Flat file.
All,
How to add editing filed column by using sum fields =none forumula.
Eg: Code:
Policyno. Date Amt-1 Amt-2 Amt-3.
B3218655810 200603 000465.96 000391.52 0000044.80
B3218655810 200602 000465.96 000391.52 0000044.80
B3218655810 200601 000465.96 000391.52 0000044.80
E1128350610 200602 000182.25 000175.96 0000100.36
E1128350610 200601 000182.25 000175.96 0000100.36
E1128350610 200603 000182.25 000175.96 0000100.36
B1112282217 200603 000427.14 000409.19 0000383.89
B1112282217 200602 000427.14 000409.19 0000383.89
B1112282217 200601 000427.14 000409.19 0000383.89
B6544536917 200603 000250.02 000236.82 0000144.32
Here Amt-1 & Amt-2 are PIC -9999999.99
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Jun 29, 2007 4:21 pm Post subject:
You can't sum the values using PD format since they aren't PD values.
You can use the technique discussed in the "Sum a number with a decimal point" Smart DFSORT Trick at:
http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/ _________________ 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
savi.sabari Beginner Joined: 11 Dec 2006 Posts: 6 Topics: 2
Posted: Sat Jun 30, 2007 8:50 am Post subject:
Thanks Frank, In my shop we are using SYNCSORT, the same logic will apply for SYNCSORT. Any Example or earlier posted would be greatly appriciated.
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Back to top
savi.sabari Beginner Joined: 11 Dec 2006 Posts: 6 Topics: 2
Posted: Mon Jul 02, 2007 3:31 pm Post subject:
My updated requirement is need to sum of the individual columns. Since the Amt-1 , Amt-2 and Amt-3 are in editing characters and each numeric field prefix with Sign.
For eg:
Code:
Policyno. Date Amt-1 Amt-2 Amt-3.
B3218655810 200603 000465.96 000391.52 0000044.80
B3218655810 200602 000465.96 000391.52 0000044.80
B3218655810 200601 000465.96 000391.52 0000044.80
E1128350610 200602 000182.25 000175.96 0000100.36
E1128350610 200601 000182.25 000175.96 0000100.36
E1128350610 200603 000182.25 000175.96 0000100.36
B1112282217 200603 000427.14 000409.19 0000383.89
B1112282217 200602 000427.14 000409.19 0000383.89
B1112282217 200601 000427.14 000409.19 0000383.89
B6544536917 200603 000250.02 000236.82 0000144.32
-----------------------------------------------------------------
Sum of each item XXXXXX.XX XXXXX.XX XXXXXX.XX
-----------------------------------------------------------------
The sum of the individual columns should be placed in the triler record.
Kolusu i tried in the earlier posted, but couldnt find it. Please give me the link if you already gave solution for similar kind of example.
Thanks in advance.
Savitha.
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Jul 02, 2007 5:14 pm Post subject:
savi.sabari ,
You haven't provided us with complete details. What is the recfm and LRECL of the dataset and what is the file layout? from the little information you gave and based upon my assumption here is a job which will give you the desired results
Code: //STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5-
B3218655810 200603 000465.96 000391.52 0000044.80
B3218655810 200602 000465.96 000391.52 0000044.80
B3218655810 200601 000465.96 000391.52 0000044.80
E1128350610 200602 000182.25 000175.96 0000100.36
E1128350610 200601 000182.25 000175.96 0000100.36
E1128350610 200603 000182.25 000175.96 0000100.36
B1112282217 200603 000427.14 000409.19 0000383.89
B1112282217 200602 000427.14 000409.19 0000383.89
B1112282217 200601 000427.14 000409.19 0000383.89
B6544536917 200603 000250.02 000236.82 0000144.32
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS =COPY
OUTREC FIELDS =(01,80,
20,06, $ AMT1 BEFORE DECIMAL
27,02, $ AMT1 AFTER DECIMAL
30,06, $ AMT2 BEFORE DECIMAL
37,02, $ AMT2 AFTER DECIMAL
40,07, $ AMT3 BEFORE DECIMAL
48,02) $ AMT3 AFTER DECIMAL
OUTFIL REMOVECC,
OUTREC=(01,80),
TRAILER1=(50C'-',/,
'SUM OF EACH ITEM: ',
TOT=(81,08,ZD,EDIT=(IIIIIT.TT)),X,
TOT=(89,08,ZD,EDIT=(IIIIIT.TT)),X,
TOT=(97,09,ZD,EDIT=(IIIIIIT.TT)),/,
50C'-')
/*
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
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