|
View previous topic :: View next topic
|
| Author |
Message |
vijayprabu
New User
Joined: 15 Dec 2005 Posts: 21
|
|
|
|
Input file:
BILL-ACCT ENDPT-IND NET-CHARGE-AMT CSF-ID
-------------------- -------------- ----------------- | -- --------------
330612010, ,Y, , 000000010.00, | ,1HXCH 75F 0002
330612010, ,N, , 000000020.00, | ,1HXCH 75F 0002[/b]
330612011, ,N, , 000000010.00, | ,1HXCH 75F 0003
330612011, ,N, , 000000030.00, | ,1HXCH 75F 0003
330612012, ,Y, , 000000010.00, | ,1HUSF K8F 0001
330612012, ,Y, , 000000030.00, | ,1HUSF K8F 0001
each account has two rows. i want my output in one row of each account.
conditions are
1. NET-CHARGE-AMT - this should be summarized
2. ENDPT-IND - should be splitted into two fields ENDPT-INDA & ENDPT-INDB in a single row.
OUTPUT
BILL-ACCT ENDPT-INDA ENDPT-INDB NET-CHARGE-AMT
330612010 Y N 30
330612011 N N 40
330612012 Y Y 40
Is it possible in SORT? Is it possible to store the retrieve the previous value in sort? |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
vijayprabu,
why are you ignoring the decimals? Here is a DFSORT JCL which will give you the desired results
| Code: |
//STEP0010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+--
330612010, ,Y, , 000000010.00, | ,1HXCH 75F 0002
330612010, ,N, , 000000020.00, | ,1HXCH 75F 0002
330612011, ,N, , 000000010.00, | ,1HXCH 75F 0003
330612011, ,N, , 000000030.00, | ,1HXCH 75F 0003
330612012, ,Y, , 000000010.00, | ,1HUSF K8F 0001
330612012, ,Y, , 000000030.00, | ,1HUSF K8F 0001
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,9,CH,A)
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(82:SEQNUM,8,ZD,RESTART=(1,9))),
IFTHEN=(WHEN=GROUP,BEGIN=(82,8,ZD,EQ,1),PUSH=(81:13,1))
OUTFIL REMOVECC,NODETAIL,BUILD=(80X),
SECTIONS=(1,9,TRAILER3=(1,9,C',',13,1,C',',81,1,C',',
TOT=(17,13,UFF,EDIT=(TTTTTTTTTT.TT))))
/* |
The output from this job is
| Code: |
330612010,N,Y,0000000030.00
330612011,N,N,0000000040.00
330612012,Y,Y,0000000040.00
|
|
|
| Back to top |
|
 |
vijayprabu
New User
Joined: 15 Dec 2005 Posts: 21
|
|
|
|
Thank you so much for your reply, i have been trying based on your sample sort.
But the push values is not getting inserted in out put,
Input rec length is 2742
my sort control card is
SORT FIELDS=(60,20,CH,A)
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(2744:SEQNUM,8,ZD,RESTART=(60,20))),
IFTHEN=(WHEN=GROUP,BEGIN=(2744,8,ZD,EQ,1),PUSH=(2743:328,1))
OUTFIL REMOVECC,NODETAIL,BUILD=(2751X),
SECTIONS=(60,20,TRAILER3=(1,59,60,20,80,247,2743,1,328,1,329,67,
TOT=(396,13,UFF,EDIT=(TTTTTTTTTT.TT)),2743,1))
I want the same input file structure and along with that i want to insert the PUSH position into 2743,1 but it is not actually inserting
Please let me know if you have any idea on this. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
vijayprabu,
Unless the input file is VB , I don't see any problem with the control cards. If the input is a VB file you need to do it a little differently. Show me the sysout you got from the above job and I will show you a way to do it? |
|
| Back to top |
|
 |
vijayprabu
New User
Joined: 15 Dec 2005 Posts: 21
|
|
|
|
Kolusu
My control card
//SYSIN DD *
SORT FIELDS=(60,20,CH,A,121,20,CH,A)
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(2744:SEQNUM,8,ZD,
RESTART=(121,20))),
IFTHEN=(WHEN=GROUP,BEGIN=(2744,8,ZD,EQ,1),PUSH=(2743:329,1))
OUTFIL REMOVECC,NODETAIL,BUILD=(2751X),
SECTIONS=(121,20,TRAILER3=(1,249,250,12,262,66,2743,1,329, 1,330,66, TOT=(396,13,UFF,EDIT=(TTTTTTTTTT.TT)),529,4, 533,100,633,4,637,26,663,136))
/*
//*--------------------------------------------------------------------
This is working fine
But i am having some minor issue.
I want to use combination of two key as a unique queue,
i am using 60,20,CH,A,121,20,CH,A to SORT
the same combination key can i use in RESTART and SECTION column?
60, 20 - account number
121, 20 - circuit id
i cant use either one as a key field
and again THANK U SO MUCH FOR YOUR HELP |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
vijayprabhu,
If you have a combination of fields as a key , then you first need to put them together at the end and use the RESTART parm. Here are the updated control cards for that
| Code: |
//SYSIN DD *
SORT FIELDS=(60,20,CH,A,121,20,CH,A)
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(2752:60,20,121,20)),
IFTHEN=(WHEN=INIT,OVERLAY=(2744:SEQNUM,8,ZD,RESTART=(2752,40))),
IFTHEN=(WHEN=GROUP,BEGIN=(2744,8,ZD,EQ,1),PUSH=(2743:328,1))
OUTFIL REMOVECC,NODETAIL,BUILD=(2742X),
SECTIONS=(60,20,121,20,
TRAILER3=(1,59,60,20,80,247,2743,1,328,1,329,67,
TOT=(396,13,UFF,EDIT=(TTTTTTTTTT.TT)),2743,1))
/* |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|