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
 

 

SPLICEing multiple records each adding a one position field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Thu Dec 06, 2007 10:03 pm    Post subject: SPLICEing multiple records each adding a one position field
Reply with quote

I need to SPLICE the following. Input and output are FB,50,27950.

Code:

----+----1----+----2----+----3----+----4----+----5
DFLTGRP1 XX4567   JOHN ADAMS                     W 
DFLTGRP1 XX9876   JEREMY BENDER         A           
DFLTGRP1 XX9876   JEREMY BENDER          B         
DFLTGRP1 XX9876   JEREMY BENDER           C         
DFLTGRP1 XX9876   JEREMY BENDER            F       
DFLTGRP1 XX9876   JEREMY BENDER             L       
DFLTGRP1 XX9876   JEREMY BENDER              N     
DFLTGRP1 XX9876   JEREMY BENDER               R     
DFLTGRP1 XX9876   JEREMY BENDER                T   
DFLTGRP1 XX9876   JEREMY BENDER                 U   
DFLTGRP1 XX9876   JEREMY BENDER                  W 
DFLTGRP2 XX1234   JED CLAMPETT          A           
DFLTGRP2 XX1234   JED CLAMPETT           B         
DFLTGRP2 XX1234   JED CLAMPETT             F       
DFLTGRP2 XX1234   JED CLAMPETT              L       
DFLTGRP2 XX1234   JED CLAMPETT                R     
DFLTGRP2 XX1234   JED CLAMPETT                 T   
DFLTGRP2 XX1234   JED CLAMPETT                  U   


The output should look like:

Code:

----+----1----+----2----+----3----+----4----+----5
DFLTGRP1 XX4567   JOHN ADAMS                     W 
DFLTGRP1 XX9876   JEREMY BENDER         ABCFLNRTUW 
DFLTGRP2 XX1234   JED CLAMPETT          AB FL RTU   


Positions 1 through 40 are fixed. Positions 41 through 50 have at least one letter and the rest are blank. You can have individual records that do not match any other records in positions 1 - 40 and they should be kept.

I have tried many combinations using WITHALL and NOKEEPDUPS, but my attempts have not produce the desired results (all records matching positions 1 through 40 rolling up to a single record with positions 41-50 left intact.

Thanks in advance.
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Fri Dec 07, 2007 1:59 am    Post subject:
Reply with quote

Cpuhawg,

Here is a DFSORT JCL which would give you the desired results. We can use the traditional Binary sum trick to get the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
DFLTGRP1 XX4567   JOHN ADAMS                     W           
DFLTGRP1 XX9876   JEREMY BENDER         A                   
DFLTGRP1 XX9876   JEREMY BENDER          B                   
DFLTGRP1 XX9876   JEREMY BENDER           C                 
DFLTGRP1 XX9876   JEREMY BENDER            F                 
DFLTGRP1 XX9876   JEREMY BENDER             L               
DFLTGRP1 XX9876   JEREMY BENDER              N               
DFLTGRP1 XX9876   JEREMY BENDER               R             
DFLTGRP1 XX9876   JEREMY BENDER                T             
DFLTGRP1 XX9876   JEREMY BENDER                 U           
DFLTGRP1 XX9876   JEREMY BENDER                  W           
DFLTGRP2 XX1234   JED CLAMPETT          A                   
DFLTGRP2 XX1234   JED CLAMPETT           B                   
DFLTGRP2 XX1234   JED CLAMPETT             F                 
DFLTGRP2 XX1234   JED CLAMPETT              L               
DFLTGRP2 XX1234   JED CLAMPETT                R             
DFLTGRP2 XX1234   JED CLAMPETT                 T             
DFLTGRP2 XX1234   JED CLAMPETT                  U           
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  INREC IFTHEN=(WHEN=(41,1,CH,EQ,C' '),     
       OVERLAY=(41:X'00'),HIT=NEXT),       
        IFTHEN=(WHEN=(42,1,CH,EQ,C' '),     
       OVERLAY=(42:X'00'),HIT=NEXT),       
        IFTHEN=(WHEN=(43,1,CH,EQ,C' '),     
       OVERLAY=(43:X'00'),HIT=NEXT),       
        IFTHEN=(WHEN=(44,1,CH,EQ,C' '),     
       OVERLAY=(44:X'00'),HIT=NEXT),       
        IFTHEN=(WHEN=(45,1,CH,EQ,C' '),     
       OVERLAY=(45:X'00'),HIT=NEXT),       
        IFTHEN=(WHEN=(46,1,CH,EQ,C' '),     
       OVERLAY=(46:X'00'),HIT=NEXT),       
        IFTHEN=(WHEN=(47,1,CH,EQ,C' '),     
       OVERLAY=(47:X'00'),HIT=NEXT),       
        IFTHEN=(WHEN=(48,1,CH,EQ,C' '),     
       OVERLAY=(48:X'00'),HIT=NEXT),       
        IFTHEN=(WHEN=(49,1,CH,EQ,C' '),     
       OVERLAY=(49:X'00'),HIT=NEXT),       
        IFTHEN=(WHEN=(50,1,CH,EQ,C' '),     
       OVERLAY=(50:X'00'))

  SORT FIELDS=(01,15,CH,A)                 
  SUM FIELDS=(41,8,BI,49,2,BI)             
                 
  OUTREC BUILD=(01,40,                     
                41,10,TRAN=ALTSEQ)         
  ALTSEQ CODE=(0040)                       


and the output is
Code:

DFLTGRP1 XX4567   JOHN ADAMS                     W
DFLTGRP1 XX9876   JEREMY BENDER         ABCFLNRTUW
DFLTGRP2 XX1234   JED CLAMPETT          AB FL RTU 

Hope this helps...

Cheers
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Fri Dec 07, 2007 2:12 am    Post subject: Reply to: SPLICEing multiple records each adding a one posit
Reply with quote

Skolusu,

Thank you for your suggestion. I dropped it into the sort control cards and it ran perfect.

Your assistance is greatly appreciated!!
icon_biggrin.gif
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 Jul 31, 2008 11:29 pm    Post subject:
Reply with quote

If you have z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can use this DFSORT/ICETOOL job with the new SPLICE WITHANY option:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=... output file
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,40,CH) WITHANY KEEPNODUPS -
 WITH(41,1) WITH(42,1) WITH(43,1) WITH(44,1) WITH(45,1) -
 WITH(46,1) WITH(47,1) WITH(48,1) WITH(49,1) WITH(50,1)
/*


For complete details on the new WITHANY function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Fri Aug 01, 2008 12:14 pm    Post subject: Reply to: SPLICEing multiple records each adding a one posit
Reply with quote

Thank you very much. The code is much more straight forward than the previous solution. I had a similiar task of combining fields that were one position separated by a delimiter (X'05') and although it worked, I had to clean up the delimited fields (using ISPF edit) after all the records were combined. They had been overlayed by characters other than X'05'.

The new option will make combining records by a key field much easier.

I appreciate the update. I am finding the ICETOOL program invaluable and much easier than writing a REXX program to do these types of tasks.

Scott icon_biggrin.gif
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 01, 2008 8:36 pm    Post subject:
Reply with quote

Scott,

You're welcome. I'm glad you like DFSORT's ICETOOL and the new WITHANY option.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Aug 01, 2008 9:35 pm    Post subject:
Reply with quote

Hello,

Quote:
much easier than writing a REXX program
The sort will also use very much less cpu and i/o than rexx (sorry 'bout that 'hawg) icon_smile.gif
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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm


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