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

Doubt in splice of combining 4 files


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

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Mon Jun 09, 2008 9:41 pm
Reply with quote

Hi,

I need to know the change to be done for the following job.
I am not getting the output for the below job as expected.

Code:

INPUT FILE:
File 1:
F1FLD1 F1FLD2 F1FLD3 F1FLD4
X(4)   X(10)  X(2)   X(12)
ABCD   100001 08     200001
ABCD   100001 06     300001
KLMN    100003 05     400001

File 2:
F2FLD1 F2FLD2 F2FLD3
X(4)   X(12)  S9(13)V99 C3
ABCD   200001 2400
ABCD   300001 3500
KLMN    400001 4400

File 3:
F3FLD1 F3FLD2 F3FLD3
X(4)   X(12)  S9(13)V99 C3
ABCD   200001 5500
ABCD   300001 6400
KLMN    400001 0

File 4:
F4FLD1 F4FLD2 F4FLD3
X(4)   X(12)  S9(13)V99 C3
ABCD   100001 345.32
KLMN    100003 222.33


Code:

OUTPUT FILE:
F1FLD1 F1FLD2 F1FLD3 F1FLD4 F2FLD3   F3FLD3   F4FLD3
X(4)   X(10)  X(2)   X(12)  S9(13)C3 S9(13)C3 S9(13)C3
ABCD   100001 08     200001 2400     5500     354.32
ABCD   100001 06     300001 3500     6400     354.32
KLMN   100003 05     400001 4400     0        222.33


First I need to compare the F1FLD1 and F1FLD4 of file 1 with F2FLD1 and F2FLD2 of file 2 and append F2FLD3 to the end of first file
This step output will be F1FLD1 F1FLD2 F1FLD3 F1FLD4 F2FLD3 -> (TEMP1)

Then I need to compare the F1FLD1 and F1FLD4 of above output(TEMP1) with F3FLD1 and F3FLD2 of file 3 and append F3FLD3 to the end
This step output will be F1FLD1 F1FLD2 F1FLD3 F1FLD4 F2FLD3 F3FLD3 -> (TEMP2)

Then the last comparision will be F1FLD1 and F1FLD2 of above output(TEMP2) with F4FLD1 and F4FLD2 of file 4 and append F4FLD3 to the end
This step output will be F1FLD1 F1FLD2 F1FLD3 F1FLD4 F2FLD3 F3FLD3 F4FLD3

The job is as follows:
Code:

//STEP010  EXEC PGM=ICETOOL                                     
//FILE1    DD DSN=INPUT.FILE1,DISP=SHR         
//FILE2    DD DSN=INPUT.FILE2,DISP=SHR         
//FILE3    DD DSN=INPUT.FILE3,DISP=SHR         
//FILE4    DD DSN=INPUT.FILE4,DISP=SHR         
//TEMP1    DD DSN=&&TEMP1,DISP=(MOD,PASS),                     
//             SPACE=(CYL,(100,500)),         
//             UNIT=SYSDA                                       
//TEMP2    DD DSN=&&TEMP2,DISP=(MOD,PASS),                     
//             SPACE=(CYL,(100,500)),         
//             UNIT=SYSDA                                       
//TEMP3    DD DSN=&&TEMP3,DISP=(MOD,PASS),                     
//             SPACE=(CYL,(100,500)),         
//             UNIT=SYSDA                                       
//OUTPUT   DD DSN=OUTPUT.FILE,             
//             DISP=(,CATLG,DELETE),
//             RECFM=FB,LRECL=52                               
//TOOLIN   DD *
COPY FROM(FILE1) TO(TEMP1) USING(CTL1)             
COPY FROM(FILE2) TO(TEMP1) USING(CTL2)             
SPLICE FROM(TEMP1) TO(TEMP2) ON(1,4,CH) ON(17,12,CH) -
   WITHEACH KEEPNODUPS WITH(29,8)                     
COPY FROM(FILE3) TO(TEMP2) USING(CTL3)             
SPLICE FROM(TEMP2) TO(TEMP3) ON(1,4,CH) ON(17,12,CH) -
   WITHEACH KEEPNODUPS WITH(37,8)                     
COPY FROM(FILE4) TO(TEMP3) USING(CTL4)             
SPLICE FROM(TEMP3) TO(OUTPUT) ON(1,14,CH) -         
   WITHEACH KEEPNODUPS WITH(45,8)               
/*
//CTL1CNTL DD *
 OUTREC FIELDS=(1:1,28,29:24Z)
/*               
//CTL2CNTL DD *
 OUTREC FIELDS=(1:1,4,5:12Z,17:5,20,37:16Z)
/*
//CTL3CNTL DD *
 OUTREC FIELDS=(1:1,4,5:12Z,17:5,12,29:8Z,37:17,8,45:8Z)
/*
//CTL4CNTL DD *
 OUTREC FIELDS=(1:1,14,15:14Z,29:16Z,45:15,8)
/*


I am not getting the output properly. Fileds are not populated properly in the output.
What is the mistake in this.
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: Mon Jun 09, 2008 9:47 pm
Reply with quote

Hello,

What does the output from that input contain?
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Tue Jun 10, 2008 1:35 pm
Reply with quote

Hi,

Output should have all the four fileds from the 1st file and last field from the other three files.

We are comparing the 1st file with 2nd and 3rd file on two keys and appending the last field from 2nd and 3rd file to the first file.
In this comparision field 1 and field 4 of 1st file will be compared with field 1 and field 2 of second and third file.

The the ouput of this will be compared with the fourth file and last field will be appended to the above result.
In this senario the field 1 and field 2 of the above output will be compared with field 1 and field 2 of 4th file.

I will expain you with an example.

Code:

INPUT FILES:         
BCH  ACC-NO NO CUST-ID
ABCD 100001 02 200001
ABCD 100001 03 300001
                     
BCH  CUST-ID AMT1     
ABCD 200001  2500     
ABCD 300001  3400     
                     
BCH  CUST-ID AMT2     
ABCD 200001  2222     
ABCD 300001  4444     
                     
BCH  ACC-NO AMT3     
ABCD 100001 2345     


Code:

OUTPUT FILE:                         
BCH ACC-NO  NO CUST-ID AMT1 AMT2 AMT3
ABCD 100001 02 200001  2500 2222 2345
ABCD 100001 03 300001  3400 4444 2345


I hope this is clear now.
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Tue Jun 10, 2008 8:37 pm
Reply with quote

You can try this code.

Code:

//STEP010  EXEC PGM=ICETOOL               
//FILE1    DD *                           
----+----1----+----2----+----3----+----4--
ABCD100001    02200001                   
ABCD100001    03300001                   
//FILE2    DD *                           
----+----1----+----2----+----3----+----4--
ABCD200001      2500                     
ABCD300001      3400                     
//FILE3    DD *                           
ABCD200001      2222                     
ABCD300001      4444                     
//FILE4    DD *                           
----+----1----+----2----+----3----+----4--
ABCD100001    2345                       
//TEMP1    DD DSN=&&TEMP1,DISP=(MOD,PASS),
//             SPACE=(CYL,(100,500)),     
//             UNIT=SYSDA                 
//TEMP2    DD DSN=&&TEMP2,DISP=(MOD,PASS),           
//             SPACE=(CYL,(100,500)),                 
//             UNIT=SYSDA                             
//TEMP3    DD DSN=&&TEMP3,DISP=(MOD,PASS),           
//             SPACE=(CYL,(100,500)),                 
//             UNIT=SYSDA                             
//OUT      DD SYSOUT=*                               
//TOOLMSG  DD SYSOUT=*                               
//DFSMSG   DD SYSOUT=*                               
//TOOLIN   DD *                                       
COPY FROM(FILE1) TO(TEMP1) USING(CTL1)               
COPY FROM(FILE2) TO(TEMP1) USING(CTL2)               
COPY FROM(FILE3) TO(TEMP1) USING(CTL3)               
COPY FROM(FILE4) TO(TEMP2) USING(CTL4)               
SPLICE FROM(TEMP1) TO(TEMP2) ON(1,4,CH) ON(17,12,CH) -
   WITHEACH WITH(29,8) WITH(37,8)                     
 SPLICE FROM(TEMP2) TO(OUT) ON(1,14,CH) -             
    WITHALL WITH(1,44)                               
/*                                                   
//CTL1CNTL DD *                                       
 OUTREC FIELDS=(1:1,28,29:24Z)                       
/*                                                     
//CTL2CNTL DD *                                         
 OUTREC FIELDS=(1:1,4,5:12Z,17:5,20,37:16Z)             
/*                                                     
//CTL3CNTL DD *                                         
 OUTREC FIELDS=(1:1,4,5:12Z,17:5,12,29:8Z,37:17,8,45:8Z)
/*                                                     
//CTL4CNTL DD *                                         
 OUTREC FIELDS=(1:1,14,15:30Z,45:15,8)                 
/*



Output I have got is

Code:

ABCD100001    02200001      2500    2222    2345
ABCD100001    03300001      3400    4444    2345


Let me know if you need any clarification.

Hope this helps...

Regards
Amar
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Jun 10, 2008 10:56 pm
Reply with quote

bhaskar_kanteti,

You dont need 2 splices to get the desired results. The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN1      DD *                                               
ABCD100001    08     200001                                   
ABCD100001    06     300001                                   
KLMN100003    05     400001                                   
//IN2      DD *                                               
ABCD200001      2400                                         
ABCD300001      3500                                         
KLMN400001      4400                                         
//IN3      DD *                                               
ABCD200001      5500                                         
ABCD300001      6400                                         
KLMN400001      0                                             
//IN4      DD *                                               
ABCD100001      345.32                                       
KLMN100003      222.33                                       
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT      DD SYSOUT=*     
//TOOLIN   DD *                                   
  COPY FROM(IN1) USING(CTL1)                     
  COPY FROM(IN2) USING(CTL2)                     
  COPY FROM(IN3) USING(CTL3)                     
  COPY FROM(IN4) USING(CTL4)                     
  SPLICE FROM(T1) TO(OUT) ON(80,16,CH) WITHEACH -
          WITH(30,16) WITH(47,16) WITH(64,16) -   
          USING(CTL5)                             
//CTL1CNTL DD *                                   
  OUTFIL FNAMES=T1,BUILD=(1,28,51X,1,4,22,12)     
//CTL2CNTL DD *                                   
  OUTFIL FNAMES=T1,BUILD=(30:17,16,34X,1,16)     
//CTL3CNTL DD *                                   
  OUTFIL FNAMES=T1,BUILD=(47:17,16,17X,1,16)     
//CTL4CNTL DD *                                   
  OUTFIL FNAMES=T1,BUILD=(1,4,64:17,16,1,16)     
//CTL5CNTL DD *                                   
  OUTFIL FNAMES=OUT,BUILD=(1,79)                 
/*


Hope this helps...

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

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Wed Jun 11, 2008 8:12 pm
Reply with quote

Hi Amarendra Reddy/Skolusu,

Both soulutions provided by you didnt ran.
I think you missed out one thing.
In File 2, File 3, File 4 the last field is S9(13)V99 COMP-3 filed.

Because in my output in those field it is showing as INVALID.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Jun 11, 2008 10:28 pm
Reply with quote

bhaskar_kanteti,

How do expect us to intrepret C3 as comp-3? How do u want the output for last 3 fields? in comp-3 format or readable format? like you have shown in your example.
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Thu Jun 12, 2008 7:25 am
Reply with quote

Hi,
In the output i want the last 3 fields in comp 3 format. Actually i specified in my first post.
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: Thu Jun 12, 2008 8:39 am
Reply with quote

Hello,

Quote:
Actually i specified in my first post.
You showed C3 which meant comp-3 to only you. Please do not make up your own abbreviations. When working with a group to reach a solution, you need to use the terminology of the group, not something of your own.

How will the output of this process be used?
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Sun Jun 15, 2008 9:32 am
Reply with quote

Hi dick scherrer,

I will take care to use terminology and not to use short cuts.

In my output the last 3 fields are comp-3 fields.
After modifying Amarendra Reddy post as below i am getting the ouput. In case if my input comp-3 fileds are zero then my output should also have zero corresponding to those fields. But it is showing as INVALID in that field. What change to be done regarding that.

Code:

//TOOLIN   DD *                                                   
  COPY FROM(MRTGAPP) TO(TEMP1) USING(CTL1)                       
  COPY FROM(CUSTINC) TO(TEMP1) USING(CTL2)                       
  COPY FROM(MRTGSTRS) TO(TEMP3) USING(CTL4)                       
  SPLICE FROM(TEMP1) TO(TEMP2) ON(1,4,CH) ON(17,12,CH) -         
     WITHEACH WITH(29,8)                                         
  COPY FROM(CUSTEXP) TO(TEMP2) USING(CTL3)                       
  SPLICE FROM(TEMP2) TO(TEMP3) ON(1,4,CH) ON(17,12,CH) -         
     WITHEACH WITH(37,8)                                         
  SPLICE FROM(TEMP3) TO(MRTGDSR) ON(1,14,CH) -                   
     WITHALL WITH(1,44)                                           
/*                                                               
//CTL1CNTL DD *                                                   
  OUTREC FIELDS=(1:1,28,29:X'000000000000000000000000', -         
  41:X'000000000000000000000000')                                 
/*                                                               
//CTL2CNTL DD *                                                   
  OUTREC FIELDS=(1:1,4,5:X'000000000000000000000000', -           
  17:5,20,37:X'00000000000000000000000000000000')                 
/*                                                               
//CTL3CNTL DD *                                                   
  OUTREC FIELDS=(1:1,4,5:X'000000000000000000000000', -           
  17:5,12,29:X'0000000000000000',37:17,8,45:X'0000000000000000') 
/*                                                               
//CTL4CNTL DD *                                                   
  OUTREC FIELDS=(1:1,14,15:X'0000000000000000000000000000', -     
  29:X'00000000000000000000000000000000',45:15,8)                 
/*                                                 
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: Sun Jun 15, 2008 9:47 am
Reply with quote

Hello Bhaskar,

Quote:
I will take care to use terminology and not to use short cuts.
Thank you icon_smile.gif

Quote:
But it is showing as INVALID in that field.
What is showing invalid? You need to post the diagnostic info from the sysout - copy/paste rather than typing parts of it.

The strings ov x'00's are not valid packed-decimal values, if that is what they were intended to be. I also do not understand the length of the x'00' strings - they do not correspond to your initial post of the field lengths.
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Thu Jun 19, 2008 9:55 am
Reply with quote

Hi dick scherrer,

This job is working fine because my requirement is changed.

I want to know one thing regarding initilaization of COMP-3.
I mean how to move zeroes to COMP-3 field.

Quote:

I also do not understand the length of the x'00' strings


I am moving zeroes to COMP-3 field in Hexa Decimal Format. As 1 byte will occupy 2 digits, i moved 2 zeroes.
Even this didnt work.
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: Thu Jun 19, 2008 11:47 am
Reply with quote

Hello Bhaskar,

Quote:
I am moving zeroes to COMP-3 field in Hexa Decimal Format. As 1 byte will occupy 2 digits, i moved 2 zeroes.
Even this didnt work.
Your understanding of how packed-decimal data (comp-3) is stored is incorrect. While 1 byte will contain 2 dgits (most of the time), it is not true for the low-order byte.

In the low-order byte, the lowest-order digit of the value is contained in the first half-byte and the sign for the entire value is in second half-byte.

A value of +123.45 stored in a s9(5)v99 comp-3 field would be:
Code:

0135
024C
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Thu Jun 19, 2008 1:47 pm
Reply with quote

Hi dick scherrer,

Thanks for explaining regarding packed-decimal format.

To move zeroes for S9(3)V9(2) COMP-3 i need to code in my job as X'00000C'.
This is how i changed in my job and it worked.

Thanks a lot dick scherrer.
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: Thu Jun 19, 2008 7:38 pm
Reply with quote

You're welcome icon_smile.gif

d
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top