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
 

 

SPLICE Matrix across columns

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

New User


Joined: 14 Feb 2012
Posts: 5
Location: USA

PostPosted: Tue Feb 14, 2012 10:50 pm    Post subject: SPLICE Matrix across columns
Reply with quote

Hi,
I have an input file as -
Code:
 AA 11111 ,1212121212,PR1,
 AA 11111 ,1212121212,PR2,
 AA 11111 ,1212121212,PR3,
 AA 22222 ,1111111111,PR1,
 AA 22222 ,1111111111,PR2,
 AA 22222 ,1111111111,PR3,
 AB 33333 ,2222222222,PR1,
 AB 33333 ,2222222222,PR2,
 AC 44444 ,3333333333,PR3,
 AC 44444 ,3333333333,PR4,
 AC 55555 ,5555555555,PR5,
 AD 66666 ,6666666666,PR6,


I use SPLICE as -
Code:
SPLICE FROM(IN) TO(OUT) ON(1,22,CH) WITHANY KEEPNODUPS -             
  WITH(23,4) WITH(27,4) WITH(31,4) WITH(35,4) WITH(39,4) WITH(43,4) -
  WITH(47,4) WITH(51,4) WITH(55,4) WITH(59,4) WITH(63,4) WITH(67,4) -
  WITH(71,4) WITH(75,4) WITH(79,4) WITH(83,4) WITH(87,4) WITH(91,4) -
  WITH(95,4) WITH(99,4) WITH(103,4) WITH(107,4) WITH(111,4) -         
  WITH(115,4) WITH(119,4) WITH(123,4) WITH(127,4) WITH(131,4) -       
  WITH(135,4) WITH(139,4) WITH(143,4) WITH(147,4) WITH(149,4) -       
  WITH(151,4) USING(CTL1)                                             
/*                                                                   
//CTL1CNTL DD *                                                       
  OPTION COPY                                                         
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(170:SEQNUM,2,ZD,RESTART=(1,22))), 
    IFTHEN=(WHEN=(170,2,ZD,EQ,01),BUILD=(1,22,23:23,4)),             
    IFTHEN=(WHEN=(170,2,ZD,EQ,02),BUILD=(1,22,27:23,4)),             
    IFTHEN=(WHEN=(170,2,ZD,EQ,03),BUILD=(1,22,31:23,4)),             
    IFTHEN=(WHEN=(170,2,ZD,EQ,04),BUILD=(1,22,35:23,4)),             
    IFTHEN=(WHEN=(170,2,ZD,EQ,05),BUILD=(1,22,39:23,4)),             
    IFTHEN=(WHEN=(170,2,ZD,EQ,06),BUILD=(1,22,43:23,4)),             
    IFTHEN=(WHEN=(170,2,ZD,EQ,07),BUILD=(1,22,47:23,4)),     

:
: somemore repeated code follows....

The output is as -
Code:
 AA 11111 ,1212121212,PR1,PR2,PR3,
 AA 22222 ,1111111111,PR1,PR2,PR3,
 AB 33333 ,2222222222,PR1,PR2,   
 AC 44444 ,3333333333,PR3,PR4,   
 AC 55555 ,5555555555,PR5,
 AD 66666 ,6666666666,PR6,

I want the output as -
Code:

 AA 11111 ,1212121212,PR1,PR2,PR3,
 AA 22222 ,1111111111,PR1,PR2,PR3,
 AB 33333 ,2222222222,PR1,PR2,   
 AC 44444 ,3333333333,   ,   ,PR3,PR4,   
 AC 55555 ,5555555555,   ,   ,   ,   ,PR5,
 AD 66666 ,6666666666,   ,   ,   ,   ,   ,PR6,


Please suggest how to achieve this. The output will show somewhat distorted view, but the objective is that each Product under it's own column classification.

Regards
Rishi


[/url]
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Tue Feb 14, 2012 11:04 pm    Post subject:
Reply with quote

Rishi Trehan,

Use code tags to retain the spacing of the sample input.

So you want validate the last character in each record and put that value in the corresponding slot? i.e

if the value is 1 then it would be in pos 23
if the value is 2 then it would be in pos 27
if the value is 3 then it would be in pos 31
if the value is 4 then it would be in pos 35
... so on?

Looks like you have 34 value WITH values , but you only have a single digit on the last character. How do you want to handle the values greater than 9?
Back to top
View user's profile Send private message
Rishi Trehan

New User


Joined: 14 Feb 2012
Posts: 5
Location: USA

PostPosted: Tue Feb 14, 2012 11:41 pm    Post subject:
Reply with quote

Kolusu,
Thanks for your suggestion on using the Tags.
The whole Product code (as PRD1, PRD2 etc) has to be scanned. It is just for a sample that I put in as PRD1 etc, since the actual Company data is confidential.

Correct, I have 34 distinct values, and as specified in my previous paragraph, that because of confidentiality the acutal data is withheld, but for our hypothesis we can take it as PR10, PR11 so on...

Thanks
Rishi
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Feb 15, 2012 12:33 am    Post subject:
Reply with quote

Rishi Trehan wrote:
Kolusu,
Correct, I have 34 distinct values, and as specified in my previous paragraph, that because of confidentiality the acutal data is withheld, but for our hypothesis we can take it as PR10, PR11 so on...

Thanks
Rishi


Do you need the comma's between each slot? Is there a comma already after each PR value? Where does this PR01 thru PR34 field start in the input and what is the length of it? Is the input already sorted?

22 bytes of key + (34 X 4 bytes of PRnn) + 34 comma's = 192 bytes but you only show 170 bytes on your splice cards.

For better ease just show me the cobol layout of the input and output file.
Back to top
View user's profile Send private message
Rishi Trehan

New User


Joined: 14 Feb 2012
Posts: 5
Location: USA

PostPosted: Wed Feb 15, 2012 12:58 am    Post subject:
Reply with quote

Yes, a Comma is required between the slots. The Product Classification fields start at position - 23. The input is already Sorted on first 26 bytes.

There are 22 bytes of the key + (34 X 3 bytes of Pnn) + 34 commas = 158.

The Cobol Layout of the Input file is -
01 CRDB1207-I.
10 OWA-IN PIC X(10).
10 FILLER PIC X(1).
10 CLI-ID-IN PIC X(10).
10 FILLER PIC X(1).
10 PRODUCT PIC X(3).
10 FILLER PIC X(1).

Cobol Layout for Output file is like this -
01 CRDB1207-O.
10 OWA-OUT PIC X(10).
10 FILLER PIC X(1).
10 CLI-ID-OUT PIC X(10).
10 FILLER PIC X(1).
10 PR1-OUT PIC X(3) .
10 FILLER PIC X(01).
10 PR2-OUT PIC X(3) .
10 FILLER PIC X(01).
10 PR3-OUT PIC X(3) .
10 FILLER PIC X(01).
10 PR4-OUT PIC X(3) .
10 FILLER PIC X(01).
10 PR5-OUT PIC X(3) .
10 FILLER PIC X(01).
10 PR6-OUT PIC X(3) .
10 FILLER PIC X(01).
10 PR7-OUT PIC X(3) .
10 FILLER PIC X(01).
10 PR8-OUT PIC X(3) .
10 FILLER PIC X(01).
10 PR9-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P10-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P11-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P12-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P13-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P14-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P15-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P16-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P17-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P18-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P19-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P20-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P21-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P22-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P23-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P24-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P25-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P26-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P27-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P28-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P29-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P30-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P31-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P32-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P33-OUT PIC X(3) .
10 FILLER PIC X(01).
10 P34-OUT PIC X(3) .
10 FILLER PIC X(01).

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

Senior Member


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

PostPosted: Wed Feb 15, 2012 1:33 am    Post subject: Reply to: SPLICE Matrix across columns
Reply with quote

use the following DFSORT/ICETOOL JCL which will give you the desired results
Code:

//STEP0100 EXEC PGM=ICETOOL     
//TOOLMSG  DD SYSOUT=*         
//DFSMSG   DD SYSOUT=*         
//IN       DD DSN=your input Fb 26 byte file,DISP=SHR
//OUT      DD SYSOUT=*                                               
//TOOLIN   DD *                                                       
  SPLICE FROM(IN) TO(OUT) ON(1,22,CH) WITHANY KEEPNODUPS        -     
  WITH(027,3) WITH(031,3) WITH(035,3) WITH(039,3) WITH(043,3)   -     
  WITH(047,3) WITH(051,3) WITH(055,3) WITH(059,3) WITH(063,3)   -     
  WITH(067,3) WITH(071,3) WITH(075,3) WITH(079,3) WITH(083,3)   -     
  WITH(087,3) WITH(091,3) WITH(095,3) WITH(099,3) WITH(103,3)   -     
  WITH(107,3) WITH(111,3) WITH(115,3) WITH(119,3) WITH(123,3)   -     
  WITH(127,3) WITH(131,3) WITH(135,3) WITH(139,3) WITH(143,3)   -     
  WITH(147,3) WITH(151,3) WITH(155,3) USING(CTL1)                     
//*
//CTL1CNTL DD *                                                     
  OPTION COPY                                                       
  INREC IFOUTLEN=158,IFTHEN=(WHEN=INIT,BUILD=(1,22,34C'   ,',23,3)),
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P01'),OVERLAY=(023:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P02'),OVERLAY=(027:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P03'),OVERLAY=(031:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P04'),OVERLAY=(035:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P05'),OVERLAY=(039:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P06'),OVERLAY=(043:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P07'),OVERLAY=(047:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P08'),OVERLAY=(051:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P09'),OVERLAY=(055:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P10'),OVERLAY=(059:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P11'),OVERLAY=(063:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P12'),OVERLAY=(067:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P13'),OVERLAY=(071:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P14'),OVERLAY=(075:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P15'),OVERLAY=(079:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P16'),OVERLAY=(083:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P17'),OVERLAY=(087:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P18'),OVERLAY=(091:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P19'),OVERLAY=(095:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P20'),OVERLAY=(099:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P21'),OVERLAY=(103:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P22'),OVERLAY=(107:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P23'),OVERLAY=(111:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P24'),OVERLAY=(115:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P25'),OVERLAY=(119:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P26'),OVERLAY=(123:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P27'),OVERLAY=(127:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P28'),OVERLAY=(131:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P29'),OVERLAY=(135:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P30'),OVERLAY=(139:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P31'),OVERLAY=(143:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P32'),OVERLAY=(147:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P33'),OVERLAY=(151:159,3)),     
        IFTHEN=(WHEN=(159,3,CH,EQ,C'P34'),OVERLAY=(155:159,3))     
//*
Back to top
View user's profile Send private message
Rishi Trehan

New User


Joined: 14 Feb 2012
Posts: 5
Location: USA

PostPosted: Wed Feb 15, 2012 4:28 am    Post subject: Reply to: SPLICE Matrix across columns
Reply with quote

icon_biggrin.gif
I tested it, and it is super.

Thanks
Rishi
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 unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Combine columns without breaking words Indrajit_57 SYNCSORT 1 Sat Mar 19, 2016 9:33 am
No new posts Matching records using splice for COM... hiravibk DFSORT/ICETOOL 4 Sun Sep 27, 2015 12:05 pm


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