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
 

 

Modifying a datase using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Modifying a datase using sort
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 Moderator


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

PostPosted: Wed Sep 27, 2006 9:29 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Sep 28, 2006 8:33 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Mon Oct 09, 2006 9:10 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

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