Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

help needed for sort
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Thu Aug 06, 2009 2:52 pm    Post subject: help needed for sort
Reply with quote

Hi all,

I need a help from you.it will be great helpful.
i have explained my problem below.

currently 513 values are stored into 697 values, it should be sum of 513 and 523 values.

CTESTKAT 0004 000000 7300 01 2009 2009N513 C000000000{00000000596990B
CTESTKAT 0004 000010 SWC1 01 2009 2009N523 C000000000{00000000006620{
CTESTKAT 0004 000009 NOR1 01 2009 2009N523 C000000000{00000000030000{
CTESTKAT 0004 000007 SWC1 01 2009 2009N523 C000000000{00000000037289D
CTESTKAT 0004 000006 NOR1 01 2009 2009N523 C000000000{00000000400000{
CTESTKAT 0004 000011 JAX1 01 2009 2009N523 C000000000{00000000000120{
CTESTKAT 0004 000005 JAX1 01 2009 2009N523 C000000000{00000000001060{
CTESTKAT 0004 000001 NOR1 01 2009 2009N523 C000000000{00000000100000{
CTESTKAT 0004 000013 OVRO 01 2009 2009N524 C000000000{00000000264000{
CTESTKAT 0004 000012 OVRO 01 2009 2009N524 C000000000{00000000400000{
CTESTKAT 0004 000000 7300 01 2009 2009N603 C000001000{00000000000000{
CTESTKAT 0004 000000 7300 01 2009 2009N696 C000000000{00000000596990B
CTESTKAT 0004 000000 7300 01 2009 2009N697 C000000000{00000000596990B

CTESTKAT 0004 000000 7300 01 2010 2010N513 C000000000{00000000606389H
CTESTKAT 0004 000011 JAX1 01 2010 2010N523 C000000000{00000000000120{
CTESTKAT 0004 000010 SWC1 01 2010 2010N523 C000000000{00000000006620{
CTESTKAT 0004 000007 SWC1 01 2010 2010N523 C000000000{00000000037289D
CTESTKAT 0004 000006 NOR1 01 2010 2010N523 C000000000{00000000400000{
CTESTKAT 0004 000005 JAX1 01 2010 2010N523 C000000000{00000000001060{
CTESTKAT 0004 000001 NOR1 01 2010 2010N523 C000000000{00000000610000{
CTESTKAT 0004 000009 NOR1 01 2010 2010N523 C000000000{00000000030000{
CTESTKAT 0004 000012 OVRO 01 2010 2010N524 C000000000{00000000800000{
CTESTKAT 0004 000013 OVRO 01 2010 2010N524 C000000000{00000000267000{
CTESTKAT 0004 000000 7300 01 2010 2010N603 C000001000{00000000000000{
CTESTKAT 0004 000000 7300 01 2010 2010N696 C000000000{00000000606389H
CTESTKAT 0004 000000 7300 01 2010 2010N697 C000000000{00000000606389H


CTESTKAT 0005 000009 8885 01 2010 2010N511 C000000000{00000000050000{
CTESTKAT 0005 000000 7250 01 2010 2010N513 C000000000{00000000051054C
CTESTKAT 0005 000003 SWC1 01 2010 2010N523 C000000000{00000000400000{
CTESTKAT 0005 000004 JAX1 01 2010 2010N523 C000000000{00000000073880{
CTESTKAT 0005 000007 JAX1 01 2010 2010N523 C000000000{00000000000021{
CTESTKAT 0005 000008 NOR1 01 2010 2010N523 C000000000{00000000120000{
CTESTKAT 0005 000002 NOR1 01 2010 2010N523 C000000000{00000000400000{
CTESTKAT 0005 000010 OVRO 01 2010 2010N524 C000000000{00000009000000{
CTESTKAT 0005 000011 OVRO 01 2010 2010N524 C000000000{00000000900000{
CTESTKAT 0005 000000 7250 01 2010 2010N601 C000000690{00000000000000{
CTESTKAT 0005 000000 7250 01 2010 2010N696 C000000000{00000000051054C
CTESTKAT 0005 000000 7250 01 2010 2010N697 C000000000{00000000051054C



1. need to add all 523 values ({00000000006620{ + {00000000006620{ + {00000000037289D + {00000000400000{ + {00000000000120{ + {00000000001060{ +
{00000000100000{ + {00000000264000{ + {00000000400000{ + {00000000000000{ + {00000000596990B + {00000000596990B )

2. then need to add the result(added all 523 valuee) values with 513 value {00000000596990B and assign that values to 697 instead of {00000000596990B (currently 513 values are stored into 697 values, it should be sum of 513 and 523 values.

note;
year 2009 and 2010 should not get mixed.
code 0004 and 0005 should not get mixed.

Can anyone help for sort statement

thanks!
Back to top
View user's profile Send private message

services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Thu Aug 06, 2009 6:55 pm    Post subject:
Reply with quote

can anyone please let me know is the above requirement possible by doing sort?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Aug 06, 2009 9:13 pm    Post subject:
Reply with quote

I'm in California, so I just got into work. You need to be patient.

Quote:
can anyone please let me know is the above requirement possible by doing sort?


Not based on what you've said so far since it isn't clear what you want to do.

It appears that a "group" is defined by the 2nd (e.g. 0004) and 6th fields (e.g. 2009) and that for each record in a group with a 613 or 623, you want the total of the last field to be put into the 697 record (the last record of the group). Is that what you want to do?

I'm not sure since you say:

Quote:
need to add all 523 values ({00000000006620{ + {00000000006620{ + {00000000037289D + {00000000400000{ + {00000000000120{ + {00000000001060{ +
{00000000100000{ + {00000000264000{ + {00000000400000{ + {00000000000000{ + {00000000596990B + {00000000596990B )


If I look at the first group (0004 and 2009), I see the following values in the 523 records:

Code:

{00000000006620{
{00000000030000{
{00000000037289D
{00000000400000{
{00000000000120{
{00000000001060{
{00000000100000{


These don't correspond to the values you listed. Are these the values you would want totalled for your first group? If not, then explain where the values you do want totalled are coming from.

Please show the expected output for your input example.

Are the blank records actually in the file?

Give the starting position, length and format of each field.

Give the RECFM and LRECL of the input file.
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Thu Aug 06, 2009 9:30 pm    Post subject:
Reply with quote

I have mentioned the expected result below

expected result

CTESTKAT 0004 0120092009513 000000000{000000000{000000000000{000000005969I
CTESTKAT 0004 0120092009523 000000000{000000000{000000000000{000000005750I ( sum of all 523 values)
CTESTKAT 0004 0120092009603 S 71 000000000{000001000{000000000000{000000000000{
CTESTKAT 0004 0120092009696 000000000{000000000{000000000000{000000005969I
CTESTKAT 0004 0120092009697 000000000{000000000{000000000000{000000011719I (sum of 513 nad 523)

CTESTKAT 0004 0120102010513 000000000{000000000{000000000000{000000006063I
CTESTKAT 0004 0120102010523 000000000{000000000{000000000000{000000010850I ( sum of all 523 values)
CTESTKAT 0004 0120102010603 S 71 000000000{000001000{000000000000{000000000000{
CTESTKAT 0004 0120102010696 000000000{000000000{000000000000{000000006063I
CTESTKAT 0004 0120102010697 000000000{000000000{000000000000{000000016913I (sum of 513 nad 523)


thanks a lot for your reply,first need to add all 523 values for year 2009 or 2010. second add the sum of 523 value with 513 value and assign the result to 697 place.


record detail:

01 COST-RECORD PIC X(77)

01 WS-COST-RECORD.
05 PS-OWNER-CD PIC X(01) VALUE SPACES.
05 PROP-NUM PIC X(11) VALUE SPACES.
05 PPTS-ITM-NUM PIC X(08) VALUE SPACES.
05 PROP-ITM-SUFX PIC X(02) VALUE SPACES.
05 PROP-SUBITEM-SUFFIX-CD PIC X(06) VALUE SPACES.
05 FILLER PIC X(01) VALUE SPACES.
05 UNIT-CD PIC X(04) VALUE SPACES.
05 FILLER PIC X(01) VALUE SPACES.
05 DELIVERY-OPTION-ID PIC 9(02) VALUE ZEROES.
05 FILLER PIC X(01) VALUE SPACES.
05 PROPOSAL-YEAR PIC X(04) VALUE SPACES.
05 FILLER PIC X(01) VALUE SPACES.
05 RATE-MATL-INPUT-YEAR PIC X(04) VALUE SPACES.
05 DELIVERED-HARDWARE-CD PIC X(01) VALUE SPACES.
05 COST-POOL.
10 COST-POOL1-3 PIC X(03) VALUE SPACES.
10 COST-POOL4 PIC X(01) VALUE SPACES.
05 CALENDAR-TYPE PIC X(01) VALUE SPACES.
05 LABOR-HOURS PIC S9(06)V9(04) VALUE 0.
05 DOLLARS-COST PIC S9(11)V9(04) VALUE 0.


dataset detail:

Management class . . : MCSTD
Storage class . . . : SCNORM
Volume serial . . . : QS3040
Device type . . . . : 3390
Data class . . . . . : DCPSDFLT
Organization . . . : PS
Record format . . . : FB
Record length . . . : 77
Block size . . . . : 27951


hope this explain your queries. please let me kow if you need more information.
once again thanks for helping me!
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Aug 06, 2009 11:04 pm    Post subject: Reply to: help needed for sort
Reply with quote

Quote:

thanks a lot for your reply,first need to add all 523 values for year 2009 or 2010. second add the sum of 523 value with 513 value and assign the result to 697 place.


I assumed the following

1. The key is a combo of PROPOSAL-YEAR(pos 38 for 4 bytes) and COST-POOL1-3(pos 48 for 3 bytes )
2. The sum fields are LABOR-HOURS(pos 53 for 10 bytes) and DOLLARS-COST(pos 63 for 15 bytes)

we sum the value based on the year and cost pool code (513, 523...)

Once summed we push those values to the end of the record for overlaying on to 697 type record.

and on 697 type record we sum the LABOR-HOURS of 513 and 523 records and put it at pos 53 for 10 bytes) and also sum the DOLLARS-COST of 513 and 523 records and put it as pos 63 validing the year.

use the following JCL

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=Your input 77 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  OPTION EQUALS                                               
  SORT FIELDS=(38,4,CH,A,      $ PROPOSAL-YEAR                 
               48,3,CH,A)      $ COST-POOL1-3                 
                                                               
  SUM FIELDS=(53,10,ZD,        $ LABOR-HOURS                   
              63,15,ZD)        $ DOLLARS-COST                 
                                                               
  OUTREC IFOUTLEN=77,IFTHEN=(WHEN=INIT,OVERLAY=(78:50C'0')),   
  IFTHEN=(WHEN=GROUP,BEGIN=(48,3,CH,EQ,C'513'),               
  PUSH=(078:53,25,128:38,4)),                                 
  IFTHEN=(WHEN=GROUP,BEGIN=(48,3,CH,EQ,C'523'),               
  PUSH=(103:53,25,128:38,4)),                                 
  IFTHEN=(WHEN=(48,3,CH,EQ,C'697',AND,38,4,CH,EQ,128,4,CH),   
  OVERLAY=(53:78,10,ZD,ADD,103,10,ZD,ZD,LENGTH=10,             
           63:88,15,ZD,ADD,113,15,ZD,ZD,LENGTH=15))           
/*
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Fri Aug 07, 2009 3:09 pm    Post subject:
Reply with quote

thanks for your valueable reply Kolusu,

I have mentioned the whole input file below, no need to consider about labor hours(pos 53 for 10 bytes),please consider pos 63 for 15 bytes only needs sum of 513 and 523 then assigned to 697 place.

example (0001 and 2009) : 00000000500000{ + 00000000400000{ needs to assign 697 with 00000000900000{.



CTESTKAT 0001 000000 JAX1 01 2009 2009N513 C000000000{00000000500000{
CTESTKAT 0001 000000 JAX1 01 2009 2009N523 C000000000{00000000400000{
CTESTKAT 0001 000000 JAX1 01 2009 2009N696 C000000000{00000000500000{
CTESTKAT 0001 000000 JAX1 01 2009 2009N697 C000000000{00000000500000{
CTESTKAT 0002 000000 NOR1 01 2009 2009N513 C000000000{00000000500000{
CTESTKAT 0002 000000 NOR1 01 2009 2009N523 C000000000{00000000200000{
CTESTKAT 0002 000000 NOR1 01 2009 2009N696 C000000000{00000000500000{
CTESTKAT 0002 000000 NOR1 01 2009 2009N697 C000000000{00000000500000{
CTESTKAT 0003 000000 SWC1 01 2009 2009N513 C000000000{00000000000000{
CTESTKAT 0003 000000 SWC1 01 2009 2009N523 C000000000{00000000300000{
CTESTKAT 0003 000000 SWC1 01 2009 2009N696 C000000000{00000000000000{
CTESTKAT 0003 000000 SWC1 01 2009 2009N697 C000000000{00000000000000{
CTESTKAT 0004 000000 7300 01 2009 2009N513 C000000000{00000000596990B
CTESTKAT 0004 000009 NOR1 01 2009 2009N523 C000000000{00000000030000{
CTESTKAT 0004 000007 SWC1 01 2009 2009N523 C000000000{00000000037289D
CTESTKAT 0004 000006 NOR1 01 2009 2009N523 C000000000{00000000400000{
CTESTKAT 0004 000010 SWC1 01 2009 2009N523 C000000000{00000000006620{
CTESTKAT 0004 000005 JAX1 01 2009 2009N523 C000000000{00000000001060{
CTESTKAT 0004 000001 NOR1 01 2009 2009N523 C000000000{00000000100000{
CTESTKAT 0004 000011 JAX1 01 2009 2009N523 C000000000{00000000000120{
CTESTKAT 0004 000013 OVRO 01 2009 2009N524 C000000000{00000000264000{
CTESTKAT 0004 000012 OVRO 01 2009 2009N524 C000000000{00000000400000{
CTESTKAT 0004 000000 7300 01 2009 2009N603 C000001000{00000000000000{
CTESTKAT 0004 000000 7300 01 2009 2009N696 C000000000{00000000596990B
CTESTKAT 0004 000000 7300 01 2009 2009N697 C000000000{00000000596990B
CTESTKAT 0004 000000 7300 01 2010 2010N513 C000000000{00000000606389H
CTESTKAT 0004 000006 NOR1 01 2010 2010N523 C000000000{00000000400000{
CTESTKAT 0004 000010 SWC1 01 2010 2010N523 C000000000{00000000006620{
CTESTKAT 0004 000001 NOR1 01 2010 2010N523 C000000000{00000000610000{
CTESTKAT 0004 000005 JAX1 01 2010 2010N523 C000000000{00000000001060{
CTESTKAT 0004 000009 NOR1 01 2010 2010N523 C000000000{00000000030000{
CTESTKAT 0004 000011 JAX1 01 2010 2010N523 C000000000{00000000000120{
CTESTKAT 0004 000007 SWC1 01 2010 2010N523 C000000000{00000000037289D
CTESTKAT 0004 000012 OVRO 01 2010 2010N524 C000000000{00000000800000{
CTESTKAT 0004 000013 OVRO 01 2010 2010N524 C000000000{00000000267000{
CTESTKAT 0004 000000 7300 01 2010 2010N603 C000001000{00000000000000{
CTESTKAT 0004 000000 7300 01 2010 2010N696 C000000000{00000000606389H
CTESTKAT 0004 000000 7300 01 2010 2010N697 C000000000{00000000606389H
CTESTKAT 0005 000009 8885 01 2010 2010N511 C000000000{00000000050000{
CTESTKAT 0005 000000 7250 01 2010 2010N513 C000000000{00000000051054C
CTESTKAT 0005 000002 NOR1 01 2010 2010N523 C000000000{00000000400000{
CTESTKAT 0005 000003 SWC1 01 2010 2010N523 C000000000{00000000400000{
CTESTKAT 0005 000008 NOR1 01 2010 2010N523 C000000000{00000000120000{
CTESTKAT 0005 000004 JAX1 01 2010 2010N523 C000000000{00000000073880{
CTESTKAT 0005 000007 JAX1 01 2010 2010N523 C000000000{00000000000021{
CTESTKAT 0005 000010 OVRO 01 2010 2010N524 C000000000{00000009000000{
CTESTKAT 0005 000011 OVRO 01 2010 2010N524 C000000000{00000000900000{
CTESTKAT 0005 000000 7250 01 2010 2010N601 C000000690{00000000000000{
CTESTKAT 0005 000000 7250 01 2010 2010N696 C000000000{00000000051054C
CTESTKAT 0005 000000 7250 01 2010 2010N697 C000000000{00000000051054C
CTESTKAT 0005 000009 8885 01 2011 2011N511 C000000000{00000000052750{
CTESTKAT 0005 000000 7250 01 2011 2011N513 C000000000{00000000052057B
CTESTKAT 0005 000007 JAX1 01 2011 2011N523 C000000000{00000000001113{
CTESTKAT 0005 000008 NOR1 01 2011 2011N523 C000000000{00000000120000{
CTESTKAT 0005 000004 JAX1 01 2011 2011N523 C000000000{00000000073880{
CTESTKAT 0005 000003 SWC1 01 2011 2011N523 C000000000{00000000400000{
CTESTKAT 0005 000002 NOR1 01 2011 2011N523 C000000000{00000000400000{
CTESTKAT 0005 000010 OVRO 01 2011 2011N524 C000000000{00000008000000{
CTESTKAT 0005 000011 OVRO 01 2011 2011N524 C000000000{00000000909000{
CTESTKAT 0005 000000 7250 01 2011 2011N601 C000000690{00000000000000{
CTESTKAT 0005 000000 7250 01 2011 2011N696 C000000000{00000000052057B
CTESTKAT 0005 000000 7250 01 2011 2011N697 C000000000{00000000052057B
CTESTKAT 0006 000000 OVRO 01 2009 2009D513 C000000000{00000000000000{
CTESTKAT 0006 000000 OVRO 01 2009 2009D524 C000000000{00000000092000{
CTESTKAT 0006 000000 OVRO 01 2009 2009D696 C000000000{00000000000000{
CTESTKAT 0006 000000 OVRO 01 2009 2009D697 C000000000{00000000000000{
CTESTKAT 0006 000000 OVRO 01 2010 2010N513 C000000000{00000000000000{
CTESTKAT 0006 000000 OVRO 01 2010 2010N524 C000000000{00000000095000{
CTESTKAT 0006 000000 OVRO 01 2010 2010N696 C000000000{00000000000000{
CTESTKAT 0006 000000 OVRO 01 2010 2010N697 C000000000{00000000000000{

I get below error when running the sort step

Code:

            OPTION EQUALS                                               
            SORT FIELDS=(38,4,CH,A,                                     
                         48,3,CH,A)                                     
                                                                         
            SUM FIELDS=(53,10,ZD,                                       
                        63,15,ZD)                                       
              OUTREC IFOUTLEN=77,IFTHEN=(WHEN=INIT,OVERLAY=(78:50C'0')),
              IFTHEN=(WHEN=GROUP,BEGIN=(48,3,CH,EQ,C'513'),             
                           $                                             
ICE007A 0 SYNTAX ERROR                                                   
              PUSH=(078:53,25,128:38,4)),                               
              $                                                         
ICE005A 0 STATEMENT DEFINER ERROR                                       
              IFTHEN=(WHEN=GROUP,BEGIN=(48,3,CH,EQ,C'523'),             
              $                                                         
ICE005A 0 STATEMENT DEFINER ERROR                                       
              PUSH=(103:53,25,128:38,4)),                               

              $                                                       
ICE005A 0 STATEMENT DEFINER ERROR                                     
              IFTHEN=(WHEN=(48,3,CH,EQ,C'697',AND,38,4,CH,EQ,128,4,CH),
              $                                                       
ICE005A 0 STATEMENT DEFINER ERROR                                     
              OVERLAY=(53:78,10,ZD,ADD,103,10,ZD,ZD,LENGTH=10,         
              $                                                       
ICE005A 0 STATEMENT DEFINER ERROR                                     
                       63:88,15,ZD,ADD,113,15,ZD,ZD,LENGTH=15))       
                       $                                               
ICE007A 0 SYNTAX ERROR                                                 
ICE751I 0 C5-K26318 C6-K90007 C7-K90000 C8-K23476 E7-K24705           
ICE052I 3 END OF DFSORT                                               
******************************** BOTTOM OF DATA ***********************


Please advice!


thanks!
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Fri Aug 07, 2009 5:19 pm    Post subject:
Reply with quote

can we use inrec for this sort?
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Fri Aug 07, 2009 7:59 pm    Post subject:
Reply with quote

if i get the expected result today, it will great helpful!
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Aug 07, 2009 8:15 pm    Post subject:
Reply with quote

Quote:
if i get the expected result today, it will great helpful!
icon_eek.gif

Have patience icon_neutral.gif

By the time read http://www.ibmmainframes.com/board_rules.php
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Fri Aug 07, 2009 8:28 pm    Post subject:
Reply with quote

thanks a lot for manual, i will read it
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Fri Aug 07, 2009 8:31 pm    Post subject:
Reply with quote

sorry, it was the forum rules,
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Aug 07, 2009 9:06 pm    Post subject:
Reply with quote

Hari,

The syntax errors indicate you do not have z/OS DFSORT V1R5 PTF UK90013 installed. You need that PTF to use WHEN=GROUP. It has been available since July, 2008. Ask your System Programmer to install it (it's free).
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Fri Aug 07, 2009 9:25 pm    Post subject:
Reply with quote

Thanks Frank,
I sent an email to my manager for z/OS DFSORT V1R5 PTF UK90013 installation possiblities.
Meanwhile is anyother way to solve this problem like using intrec statement.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Aug 07, 2009 11:20 pm    Post subject: Reply to: help needed for sort
Reply with quote

services,

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//IN       DD DSN=Your input file,DISP=SHR
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)         
//OUT      DD SYSOUT=*
//TOOLIN   DD *                                                   
  SORT FROM(IN) USING(CTL1)                                       
  SORT FROM(T1) USING(CTL2)                                       
//CTL1CNTL DD *       
  OPTION EQUALS                                             
  SORT FIELDS=(38,4,CH,A,      $ PROPOSAL-YEAR                     
               48,3,CH,A)      $ COST-POOL1-3                     
                                                                   
  SUM FIELDS=(63,15,ZD)        $ DOLLARS-COST                     
                                                                   
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(78:15C'0')),                   
  IFTHEN=(WHEN=(48,3,SS,EQ,C'513,523'),OVERLAY=(78:63,15)),       
  IFTHEN=(WHEN=(48,3,CH,EQ,C'697'),OVERLAY=(63:15C'0'))           

  OUTFIL FNAMES=T1,REMOVECC,BUILD=(1,77),                         
  SECTIONS=(38,4,                                                 
  TRAILER3=(38:38,4,48:C'697',63:TOT=(78,15,ZD,ZD,LENGTH=15)))
//*     
//CTL2CNTL DD *                                                   
  OPTION EQUALS
  SORT FIELDS=(38,4,CH,A,      $ PROPOSAL-YEAR                     
               48,3,CH,A)      $ COST-POOL1-3                     
  SUM FIELDS=(63,15,ZD)        $ DOLLARS-COST                     
  OUTFIL FNAMES=OUT                                               
//*
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Fri Aug 07, 2009 11:37 pm    Post subject:
Reply with quote

I am sorry to say, its giving different result, i have mentioned the result below. i ran the step given by you


CTESTKAT 0001 000000 JAX1 01 2009 2009N523 C000000000{00000001475089D
CTESTKAT 0004 000013 OVRO 01 2009 2009N524 C000000000{00000000756000{
CTESTKAT 0004 000000 7300 01 2009 2009N603 C000001000{00000000000000{
CTESTKAT 0004 000005 JAX1 01 2010 2010N523 C000000000{00000002078990D
CTESTKAT 0004 000012 OVRO 01 2010 2010N524 C000000000{00000011062000{
CTESTKAT 0005 000000 7250 01 2010 2010N601 C000000690{00000000000000{
CTESTKAT 0005 000009 8885 01 2011 2011N511 C000000000{00000000052750{
CTESTKAT 0005 000000 7250 01 2011 2011N513 C000000000{00000012265458B
CTESTKAT 0005 000007 JAX1 01 2011 2011N523 C000000000{00000000994993{
CTESTKAT 0005 000010 OVRO 01 2011 2011N524 C000000000{00000008909000{
CTESTKAT 0005 000000 7250 01 2011 2011N601 C000000690{00000000000000{
CTESTKAT 0005 000000 7250 01 2011 2011N696 C000000000{00000012265458B
CTESTKAT 0005 000000 7250 01 2011 2011N697 C000000000{00000013260451B.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Aug 07, 2009 11:53 pm    Post subject:
Reply with quote

services,

*sigh* what is the key for summing up? Here I considered only PROPOSAL-YEAR and COST POOL1-3

Looks like you have some other field also to sum. what is that field?
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Sat Aug 08, 2009 12:07 am    Post subject:
Reply with quote

below is the input file

Code:

CTESTKAT        0001  000000 JAX1 01 2009 2009N513 C000000000{00000000500000{
CTESTKAT        0001  000000 JAX1 01 2009 2009N523 C000000000{00000000400000{
CTESTKAT        0001  000000 JAX1 01 2009 2009N696 C000000000{00000000500000{
CTESTKAT        0001  000000 JAX1 01 2009 2009N697 C000000000{00000000500000{
CTESTKAT        0002  000000 NOR1 01 2009 2009N513 C000000000{00000000500000{
CTESTKAT        0002  000000 NOR1 01 2009 2009N523 C000000000{00000000200000{
CTESTKAT        0002  000000 NOR1 01 2009 2009N696 C000000000{00000000500000{
CTESTKAT        0002  000000 NOR1 01 2009 2009N697 C000000000{00000000500000{
CTESTKAT        0003  000000 SWC1 01 2009 2009N513 C000000000{00000000000000{
CTESTKAT        0003  000000 SWC1 01 2009 2009N523 C000000000{00000000300000{
CTESTKAT        0003  000000 SWC1 01 2009 2009N696 C000000000{00000000000000{
CTESTKAT        0003  000000 SWC1 01 2009 2009N697 C000000000{00000000000000{
CTESTKAT        0004  000000 7300 01 2009 2009N513 C000000000{00000000596990B
CTESTKAT        0004  000009 NOR1 01 2009 2009N523 C000000000{00000000030000{
CTESTKAT        0004  000007 SWC1 01 2009 2009N523 C000000000{00000000037289D
CTESTKAT        0004  000006 NOR1 01 2009 2009N523 C000000000{00000000400000{
CTESTKAT        0004  000010 SWC1 01 2009 2009N523 C000000000{00000000006620{
CTESTKAT        0004  000005 JAX1 01 2009 2009N523 C000000000{00000000001060{
CTESTKAT        0004  000001 NOR1 01 2009 2009N523 C000000000{00000000100000{
CTESTKAT        0004  000011 JAX1 01 2009 2009N523 C000000000{00000000000120{
CTESTKAT        0004  000013 OVRO 01 2009 2009N524 C000000000{00000000264000{
CTESTKAT        0004  000012 OVRO 01 2009 2009N524 C000000000{00000000400000{
CTESTKAT        0004  000000 7300 01 2009 2009N603 C000001000{00000000000000{
CTESTKAT        0004  000000 7300 01 2009 2009N696 C000000000{00000000596990B
CTESTKAT        0004  000000 7300 01 2009 2009N697 C000000000{00000000596990B
CTESTKAT        0004  000000 7300 01 2010 2010N513 C000000000{00000000606389H
CTESTKAT        0004  000006 NOR1 01 2010 2010N523 C000000000{00000000400000{
CTESTKAT        0004  000010 SWC1 01 2010 2010N523 C000000000{00000000006620{
CTESTKAT        0004  000001 NOR1 01 2010 2010N523 C000000000{00000000610000{
CTESTKAT        0004  000005 JAX1 01 2010 2010N523 C000000000{00000000001060{
CTESTKAT        0004  000009 NOR1 01 2010 2010N523 C000000000{00000000030000{
CTESTKAT        0004  000011 JAX1 01 2010 2010N523 C000000000{00000000000120{
CTESTKAT        0004  000007 SWC1 01 2010 2010N523 C000000000{00000000037289D
CTESTKAT        0004  000012 OVRO 01 2010 2010N524 C000000000{00000000800000{
CTESTKAT        0004  000013 OVRO 01 2010 2010N524 C000000000{00000000267000{
CTESTKAT        0004  000000 7300 01 2010 2010N603 C000001000{00000000000000{
CTESTKAT        0004  000000 7300 01 2010 2010N696 C000000000{00000000606389H
CTESTKAT        0004  000000 7300 01 2010 2010N697 C000000000{00000000606389H
CTESTKAT        0005  000009 8885 01 2010 2010N511 C000000000{00000000050000{
CTESTKAT        0005  000000 7250 01 2010 2010N513 C000000000{00000000051054C
CTESTKAT        0005  000002 NOR1 01 2010 2010N523 C000000000{00000000400000{
CTESTKAT        0005  000003 SWC1 01 2010 2010N523 C000000000{00000000400000{
CTESTKAT        0005  000008 NOR1 01 2010 2010N523 C000000000{00000000120000{
CTESTKAT        0005  000004 JAX1 01 2010 2010N523 C000000000{00000000073880{
CTESTKAT        0005  000007 JAX1 01 2010 2010N523 C000000000{00000000000021{
CTESTKAT        0005  000010 OVRO 01 2010 2010N524 C000000000{00000009000000{
CTESTKAT        0005  000011 OVRO 01 2010 2010N524 C000000000{00000000900000{
CTESTKAT        0005  000000 7250 01 2010 2010N601 C000000690{00000000000000{
CTESTKAT        0005  000000 7250 01 2010 2010N696 C000000000{00000000051054C
CTESTKAT        0005  000000 7250 01 2010 2010N697 C000000000{00000000051054C
CTESTKAT        0005  000009 8885 01 2011 2011N511 C000000000{00000000052750{
CTESTKAT        0005  000000 7250 01 2011 2011N513 C000000000{00000000052057B
CTESTKAT        0005  000007 JAX1 01 2011 2011N523 C000000000{00000000001113{
CTESTKAT        0005  000008 NOR1 01 2011 2011N523 C000000000{00000000120000{
CTESTKAT        0005  000004 JAX1 01 2011 2011N523 C000000000{00000000073880{
CTESTKAT        0005  000003 SWC1 01 2011 2011N523 C000000000{00000000400000{
CTESTKAT        0005  000002 NOR1 01 2011 2011N523 C000000000{00000000400000{
CTESTKAT        0005  000010 OVRO 01 2011 2011N524 C000000000{00000008000000{
CTESTKAT        0005  000011 OVRO 01 2011 2011N524 C000000000{00000000909000{
CTESTKAT        0005  000000 7250 01 2011 2011N601 C000000690{00000000000000{
CTESTKAT        0005  000000 7250 01 2011 2011N696 C000000000{00000000052057B
CTESTKAT        0005  000000 7250 01 2011 2011N697 C000000000{00000000052057B
CTESTKAT        0006  000000 OVRO 01 2009 2009D513 C000000000{00000000000000{
CTESTKAT        0006  000000 OVRO 01 2009 2009D524 C000000000{00000000092000{
CTESTKAT        0006  000000 OVRO 01 2009 2009D696 C000000000{00000000000000{
CTESTKAT        0006  000000 OVRO 01 2009 2009D697 C000000000{00000000000000{
CTESTKAT        0006  000000 OVRO 01 2010 2010N513 C000000000{00000000000000{
CTESTKAT        0006  000000 OVRO 01 2010 2010N524 C000000000{00000000095000{
CTESTKAT        0006  000000 OVRO 01 2010 2010N696 C000000000{00000000000000{
CTESTKAT        0006  000000 OVRO 01 2010 2010N697 C000000000{00000000000000{


expected result:

should

Code:

CTESTKAT        0001  000000 JAX1 01 2009 2009N697 C000000000{00000000900000{


should

Code:
 
CTESTKAT        0002  000000 NOR1 01 2009 2009N697 C000000000{00000000700000{


should

Code:

CTESTKAT        0003  000000 SWC1 01 2009 2009N697 C000000000{00000000300000{


should

Code:

CTESTKAT        0004  000000 7300 01 2009 2009N697 C000000000{00000001171990B


should

Code:

CTESTKAT        0004  000000 7300 01 2010 2010N697 C000000000{0000000169131H


and same like above for 0005 and 0006

513 cost and 523 cost needs to added and assigned to 697 cost, currently 513 cost 697 cost are same, but now 697 should be sum of 513 cost and 523 cost.

1. get all 523 cost for unit code 0001 or 0002 or 0003 or 0004 or 0005 or 0006
2. add all 523 costs
3. added all 523 costs with add 513 cost
4. assign the final(513+523) value to 697 cost for each unit code,

i am really thanks for your support,
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Aug 08, 2009 1:55 am    Post subject: Reply to: help needed for sort
Reply with quote

services,

Your sample input and output does not match the requirements. ex:

key
Code:

CTESTKAT        0004  000000 7300 01 2009 2009N697 C000000000{00000001171990B
CTESTKAT        0004  000000 7300 01 2010 2010N697 C000000000{0000000169131H


The sum of 513 (1 record) 7 records of 523 for year 2009 would be result in a sum of 00000001172079F

And for 2010 the sum would be 00000001691479B.

How did you end up with those numbers?

You provided a layout in your prior posts and according to it the unit-code is at position 30 and in your sample you show it at pos 17. How am I supposed to map as to which one is correct? I specifically asked you what is the key for summing , you never answered that question.

I assumed that the key is made up of the following fields

1. Unit code - pos 17 for a length of 4 and format is character (0001, 0002 ..0004)
2. Proposal Year - pos 38 for length of 4 and format is character (2009, 2010...)
3. cost pool 1-3 - pos 48 for length of 3 and format is character (513,523,524...697)

The sum field is dollar cost which is at pos 63 for 15 bytes

Assuming that the results you have typos, the following DFSORT ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//IN       DD DSN=Your input file,DISP=SHR
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)         
//OUT      DD SYSOUT=*
//TOOLIN   DD *                                                       
  SORT FROM(IN) USING(CTL1)                                           
  SORT FROM(T1) USING(CTL2)                                           
//CTL1CNTL DD *                                                       
  OPTION EQUALS                                                       
  SORT FIELDS=(17,4,CH,A,      $ UNIT CODE                           
               38,4,CH,A,      $ PROPOSAL-YEAR                       
               48,3,CH,A)      $ COST-POOL1-3                         
                                                                     
  SUM FIELDS=(63,15,ZD)        $ DOLLARS-COST                         
                                                                     
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(78:15C'0')),                     
  IFTHEN=(WHEN=(48,3,SS,EQ,C'513,523'),OVERLAY=(78:63,15)),           
  IFTHEN=(WHEN=(48,3,CH,EQ,C'697'),OVERLAY=(63:15C'0'))               
  OUTFIL FNAMES=T1,REMOVECC,BUILD=(1,77),                             
  SECTIONS=(17,4,SKIP=0L,38,4,SKIP=0L,                               
  TRAILER3=(17:17,4,38:38,4,48:C'697',63:TOT=(78,15,ZD,ZD,LENGTH=15)))
//CTL2CNTL DD *                                                       
  OPTION EQUALS                                                       
  SORT FIELDS=(17,4,CH,A,      $ UNIT CODE                           
               38,4,CH,A,      $ PROPOSAL-YEAR                       
               48,3,CH,A)      $ COST-POOL1-3                         
  SUM FIELDS=(63,15,ZD)        $ DOLLARS-COST                         
  OUTFIL FNAMES=OUT,OVERLAY=(63:63,15,ZD,ZDC,LENGTH=15)               
/*
Back to top
View user's profile Send private message
services

New User


Joined: 20 May 2009
Posts: 38
Location: India

PostPosted: Sat Aug 08, 2009 2:04 am    Post subject:
Reply with quote

i get below error, it says countinuation missing,

Code:

0            OPTION EQUALS                                                     
             SORT FIELDS=(17,4,CH,A,      $ UNIT CODE                           
                          38,4,CH,A,      $ PROPOSAL-YEAR                       
                          48,3,CH,A)      $ COST-POOL1-3                       
                                                                               
             SUM FIELDS=(63,15,ZD)        $ DOLLARS-COST                       
                                                                               
             OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(78:15C'0')),                     
             IFTHEN=(WHEN=(48,3,SS,EQ,C'513,523'),OVERLAY=(78:63,15)),         
               IFTHEN=(WHEN=(48,3,CH,EQ,C'697'),OVERLAY=(63:15C'0'))           
               OUTFIL FNAMES=T1,REMOVECC,BUILD=(1,77),                         
               SECTIONS=(17,4,SKIP=0L,38,4,SKIP=0L,                             
               TRAILER3=(17:17,4,38:38,4,48:C'697',63:TOT=(78,15,ZD,ZD,LENGTH=15
 ICE003A 0 CONTINUATION LINE MISSING                                           
 ICE146I 0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW   
           DEBUG NOABEND,ESTAE                                                 
           OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN,D
                          ALLOC                                                 
 ICE751I 0 C5-K26318 C6-K90007 C7-K90000 C8-K23476 E7-K24705                   
 ICE052I 3 END OF DFSORT
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Aug 08, 2009 2:24 am    Post subject:
Reply with quote

Kolusu has 'TRAILER3' starting in column 3. You appear to have it starting in a higher column so your trailer line is overflowing column 72 making it look like a continuation. Move your 'TRAILER3' line to the left so it only has two blanks before 'TRAILER3'.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us