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

Need little assistance with SPLICE


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

New User


Joined: 03 Jul 2006
Posts: 55

PostPosted: Thu Sep 10, 2009 1:04 am
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 Developer


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

PostPosted: Thu Sep 10, 2009 2:56 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Join multiple records using splice DFSORT/ICETOOL 5
This topic is locked: you cannot edit posts or make replies. Need assistance in job scheduling logic. Mainframe Interview Questions 2
This topic is locked: you cannot edit posts or make replies. Splice JCL into one record for DD sta... SYNCSORT 2
No new posts Need assistance formatting when joini... SYNCSORT 8
This topic is locked: you cannot edit posts or make replies. Splice multiple records into single r... DFSORT/ICETOOL 9
Search our Forums:

Back to Top