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
 

 

Group elements using ICETOOL

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

New User


Joined: 20 Sep 2007
Posts: 83
Location: India

PostPosted: Fri Apr 14, 2017 11:01 am    Post subject: Group elements using ICETOOL
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Apr 14, 2017 12:04 pm    Post subject: Reply to: Group elements using ICETOOL
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: 83
Location: India

PostPosted: Fri Apr 14, 2017 3:32 pm    Post subject:
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    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 Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts Need Help with : IFTHEN(WHEN=GROUP) Sumanta_89 DFSORT/ICETOOL 1 Wed Apr 19, 2017 5:23 pm
No new posts Why TS/OP would Not contact site supp... RahulG31 All Other Mainframe Topics 4 Wed Mar 22, 2017 7:46 am


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