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
 

 

Need little assistance with SPLICE

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

New User


Joined: 03 Jul 2006
Posts: 53

PostPosted: Thu Sep 10, 2009 1:04 am    Post subject: Need little assistance with SPLICE
Reply with quote

Hello everybody. I need little assistance with SPLICE. I have two input files: File1 - Main and File2 - Driver. Matching is done based on MEMBER which is 18 bytes long. When MEMBER matches we need to zero out AMOUNT on File1 if AMOUNTs on both files match. Otherwise we just write file1 record to output

File1
Key is MEMBER - POS 29 PIC X(18)
AMOUNT is in POS 57 and it's PIC S9(10)V99

Code:

                            MEMBER                      AMOUNT
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
                            111111111111111111          00000020000{   
                            111111111111111111          00000030000{   
                            111111111111111111          00000040000{   
                            222222222222222222          00000040000{   
                            222222222222222222          00000050000{   
                            222222222222222222          00000080000{   


File2
Key is MEMBER - POS 13 PIC X(18)
AMOUNT is in POS 47 and it's PIC S9(10)V99
Code:

            MEMBER                            AMOUNT
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
            111111111111111111                00000020000{             
            222222222222222222                00000080000{             


Output File shoudl look like this. Note that first and last records have AMOUNTs matching so it's zeroed out.
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7-
                            111111111111111111          00000000000{   
                            111111111111111111          00000030000{   
                            111111111111111111          00000040000{   
                            222222222222222222          00000040000{   
                            222222222222222222          00000050000{   
                            222222222222222222          00000000000{   


Thanks in advance to Frank icon_cool.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 Sep 10, 2009 2:56 am    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I added a few more input records for a better test.

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD *
                            111111111111111111          00000020000{
                            111111111111111111          00000030000{
                            111111111111111111          00000040000{
                            222222222222222222          00000040000{
                            222222222222222222          00000050000{
                            222222222222222222          00000080000{
                            333333333333333333          00000090000{
                            333333333333333333          00000090000{
                            555555555555555555          00000090000{
//IN2 DD *
            111111111111111111                00000020000{
            222222222222222222                00000080000{
            444444444444444444                00000080000{
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(29,18,CH) WITHALL WITH(1,80) WITH(93,1) -
  KEEPBASE KEEPNODUPS USING(CTL3)
//CTL1CNTL DD *
  INREC BUILD=(29:13,18,81:47,12,93:C'BB')
//CTL2CNTL DD *
  INREC OVERLAY=(93:C'VV')
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,OMIT=(93,2,CH,EQ,C'BB'),
    IFOUTLEN=80,
    IFTHEN=(WHEN=(57,12,ZD,EQ,81,12,ZD),
      OVERLAY=(57:+0,TO=ZDC,LENGTH=12))
/*


OUT would have:

Code:

                            111111111111111111          00000000000{       
                            111111111111111111          00000030000{       
                            111111111111111111          00000040000{       
                            222222222222222222          00000040000{       
                            222222222222222222          00000050000{       
                            222222222222222222          00000000000{       
                            333333333333333333          00000090000{       
                            333333333333333333          00000090000{       
                            555555555555555555          00000090000{       
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 Need assistance to Convert Decimal to... SENTHIL MURUGAAN COBOL Programming 5 Fri Oct 16, 2015 12:57 pm
No new posts Matching records using splice for COM... hiravibk DFSORT/ICETOOL 4 Sun Sep 27, 2015 12:05 pm
No new posts Mainframe File-Aid Assistance chhabraravneet Compuware & Other Tools 3 Fri May 08, 2015 10:24 pm
No new posts Assistance required for WHEN=GROUP sc... thirumalasetty JCL & VSAM 8 Wed Sep 10, 2014 12:56 am
No new posts JOINKEYS or SPLICE? while retaining h... hsinaz50 DFSORT/ICETOOL 4 Thu Apr 17, 2014 12:13 am


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