IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Modifying a datase using sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rjain

New User


Joined: 12 Apr 2006
Posts: 3

PostPosted: Wed Sep 27, 2006 12:42 pm
Reply with quote

I have one file with the following format-

Code:

Position -: 1-3    4-8     9 -10
            FID    00001   01
            FID    00002   01
            FID    00003   01
            FID    00004   01



I want to sort this file on (Pos-1-3) and sum the fields (Pos 4-8) and (Pos9-10). This I can do using Sum fields. After doing the sum I will get the output as

Code:

Position -: 1-3    4-8     9 -10
            FID    00010   04


Now I want to replace this sums in all the records of the input file. i.e I want the output as -

Code:

Position -: 1-3    4-8     9 -10
            FID    00010   04
            FID    00010   04
            FID    00010   04
            FID    00010   04


Please suggest if we can do this using sort or icetool or any other means in a JCL.
Thanks
Rajeev
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Sep 27, 2006 9:29 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//    DD DSN=*.IN,VOL=REF=*.IN,DISP=(OLD,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
SORT FROM(IN) TO(T1) USING(CTL1)
SPLICE FROM(CON) TO(OUT) ON(1,3,CH) -
  WITHALL WITH(1,3)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,3,CH,A)
  OPTION ZDPRINT
  SUM FIELDS=(4,5,ZD,9,2,ZD)
/*
Back to top
View user's profile Send private message
rjain

New User


Joined: 12 Apr 2006
Posts: 3

PostPosted: Thu Sep 28, 2006 10:11 am
Reply with quote

Thans a ton dude ...the jcl working fine for me...thaks again
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Sep 28, 2006 8:33 pm
Reply with quote

You're welcome, dude icon_lol.gif
Back to top
View user's profile Send private message
rjain

New User


Joined: 12 Apr 2006
Posts: 3

PostPosted: Mon Oct 09, 2006 6:05 pm
Reply with quote

Hey Frank... In the above file i also have field from 11-20 and they are different for each record and I want the same to be populated in the output file with the above changes ..can you suggest something for that cause in the above jcl the sum are happening fine but the field 11 to 20 becomes same for all i.e the file contains teh same records.....
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Oct 09, 2006 9:10 pm
Reply with quote

Just add WITH(11,10) to the SPLICE operator, that is:

Code:

SPLICE FROM(CON) TO(OUT) ON(1,3,CH) -
  WITHALL WITH(1,3) WITH(11,10)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top