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

Break the line depending upon condition


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

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Mon Mar 16, 2009 7:49 pm
Reply with quote

Hi all,

I am having an input file of Lrecl 7000.

I need to copy the content of the files to another of lrecl = 1000.

SO while copying the record i need to split a single record of the source file into multiple records in the destination file of lrecl = 1000 depending upon wether the string "<CELL>" is present or not ??

For example

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+-
language developed <CELL> for commercial <CELL> application
asdasd <CELL> 12521376
dasd123456789
idruiswrn834284<CELL> sadasdadhfsw<CELL>


So my output should look like below,
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+-
language developed
for commercial
 application
asdasd
 12521376
dasd123456789
idruiswrn834284
 sadasdadhfsw


Could you guys please help me to achieve this through a sort card.
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: Mon Mar 16, 2009 8:57 pm
Reply with quote

You can use a DFSORT/ICETOOL job like the following. I assumed that you could have a maximum of 7 strings delimited by <CELL> in one line, but you can handle more by increasing the number of %nn fields appropriately. I also assumed that you wouldn't have any strings delimited by <CELL> that start with more than 50 blanks.

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (FB/7000)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/1000)
//TOOLIN DD *
* Split input records into 1000 byte output records using
* <CELL> as a delimiter.
COPY FROM(IN) USING(CTL1)
* Remove blank lines.
COPY FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
   OPTION COPY
   OUTFIL FNAMES=T1,
    PARSE=(%01=(ENDBEFR=C'<CELL>',FIXLEN=1000),
           %02=(ENDBEFR=C'<CELL>',FIXLEN=1000),
           %03=(ENDBEFR=C'<CELL>',FIXLEN=1000),
           %04=(ENDBEFR=C'<CELL>',FIXLEN=1000),
           %05=(ENDBEFR=C'<CELL>',FIXLEN=1000),
           %06=(ENDBEFR=C'<CELL>',FIXLEN=1000),
           %07=(FIXLEN=1000)),
     BUILD=(%01,/,%02,/,%03,/,%04,/,%05,/,%06,/,%07)
/*
//CTL2CNTL DD *
  OMIT COND=(1,50,CH,EQ,C' ')
/*
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Tue Mar 17, 2009 7:35 pm
Reply with quote

Hi Frank,

Thank you very much.
I just chage a bit as per my requirement and it works fine.
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts rewrite same SAY line CLIST & REXX 8
No new posts Merge files with a key and insert a b... DFSORT/ICETOOL 6
No new posts Repeat a DD line- comment and insert ... CA Products 3
Search our Forums:

Back to Top