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

Group elements using ICETOOL


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

New User


Joined: 20 Sep 2007
Posts: 93
Location: India

PostPosted: Fri Apr 14, 2017 11:01 am
Reply with quote

Hi,
I have the below comma delimited dataset. In spite of this being comma delimited, the fields are not squeezed off spaces. Hence each column have a fixed width.

Code:
ABC ,1234,XYZ,       KEY-0001,CODE1,MESSAGE
BCD ,2345,UCC,       KEY-0002,CODE2,MESSAGE
DF  ,4555,CKI,        KEY-003,CODE3,MESSAGE
    ,    ,   ,               ,CODE5,MESSAGE
ABC ,1425,RBN,       KEY=0004,CODE6,MESSAGE
ABD ,4578,NBN,       KEY*0005,CODE7,MESSAGE
ABM ,1247,RBO,       KEY-0006,CODE2,MESSAGE
    ,    ,   ,               ,CODE1,MESSAGE
    ,    ,   ,               ,     ,
CNO ,4578,MNB,       KEY-0007,CODE4,MESSAGE
MBO ,1578,CGB,       KEY-0007,CODE2,MESSAGE


I would like to have the O/P as:

Code:
ABC ,1234,XYZ,       KEY-0001,CODE1,MESSAGE
BCD ,2345,UCC,       KEY-0002,CODE2,MESSAGE
DF  ,4555,CKI,        KEY-003,CODE3,MESSAGE
DF  ,4555,CKI,        KEY-003,CODE5,MESSAGE
ABC ,1425,RBN,       KEY=0004,CODE6,MESSAGE
ABD ,4578,NBN,       KEY*0005,CODE7,MESSAGE
ABM ,1247,RBO,       KEY-0006,CODE2,MESSAGE
ABM ,1247,RBO,       KEY-0006,CODE1,MESSAGE
CNO ,4578,MNB,       KEY-0007,CODE4,MESSAGE
MBO ,1578,CGB,       KEY-0007,CODE2,MESSAGE


Basically,
we would check whether the CODE field (5th Column) is spaces or not. If it's spaces, we will remove the record. If it is not, we will update the data from previous record till the code field (5th column). There may be multiple records with only code field(5th column) populated. We have to fill these up from the top record having data populated in the previous fields.

for ease of reference, I am providing below the Field length for each field:
FIELD1: 4
FIELD2: 4
FIELD3: 3
FIELD4: 15
FIELD5: 4
FIELD6: 50

I guess we have to use SPLICE to get the data from above to below fields. Before that we have to Group the data together based on the Blank fields & the row above the Blank fields that contains data for FIELD1 to FIELD4.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Fri Apr 14, 2017 12:04 pm
Reply with quote

WHEN=GROUP with KEYBEGIN, PUSH for the fields you want to propagate. OMIT COND= to get rid of the blank column fives.
Back to top
View user's profile Send private message
Learncoholic

New User


Joined: 20 Sep 2007
Posts: 93
Location: India

PostPosted: Fri Apr 14, 2017 3:32 pm
Reply with quote

Thanks Bill, it worked.
I have pasted by code below for improvement suggestions & references:

Code:
//STEP01 EXEC PGM=ICETOOL                     
//TOOLMSG DD SYSOUT=*                         
//DFSMSG DD SYSOUT=*                         
//INDD01 DD *                                 
ABC ,1234,XYZ,       KEY-0001,CODE1,MESSAGE   
BCD ,2345,UCC,       KEY-0002,CODE2,MESSAGE   
DF  ,4555,CKI,        KEY-003,CODE3,MESSAGE   
    ,    ,   ,               ,CODE5,MESSAGE   
ABC ,1425,RBN,       KEY=0004,CODE6,MESSAGE   
MOC ,5412,GHT,       KEY=0004,CODE2,MESSAGE   
ABD ,4578,NBN,       KEY*0005,CODE7,MESSAGE   
ABM ,1247,RBO,       KEY-0006,CODE2,MESSAGE   
    ,    ,   ,               ,CODE1,MESSAGE   
    ,    ,   ,               ,     ,         
/*                                           
//SPOOLDD DD SYSOUT=*                         
//TOOLIN DD *                                 
  COPY FROM(INDD01) TO(SPOOLDD) USING(CNT1)   
/*                                           
//CNT1CNTL DD *                               
  OMIT COND=(31,1,CH,EQ,C' ')                 
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(15,15,CH,NE,C'               '),
                 END=(15,15,CH,EQ,C'               '),             
               PUSH=(1:1,30))                                     
/*                         


Thanks once again.
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 How can we simulate JOINKEYS in ICETOOL DFSORT/ICETOOL 9
No new posts ICETOOL job to pull ML1 datasts DFSORT/ICETOOL 7
No new posts Hexadecimal Group compare and write t... DFSORT/ICETOOL 5
No new posts DB2 group member usage DB2 0
No new posts Group comparison/update between two f... DFSORT/ICETOOL 10
Search our Forums:

Back to Top