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

SPLICEing multiple records each adding a one position field


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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 Developer


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

PostPosted: Thu Jul 31, 2008 11:29 pm
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:

Use [URL] BBCode for External Links
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
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 Developer


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

PostPosted: Fri Aug 01, 2008 8:36 pm
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

Moderator Emeritus


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

PostPosted: Fri Aug 01, 2008 9:35 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top