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

Breaking records for every special character


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

New User


Joined: 08 Sep 2003
Posts: 32
Location: Toronto <-> Bangalore

PostPosted: Sun Dec 02, 2007 3:16 am
Reply with quote

Hi,

I have records like below.

Code:

51133&ADMINISTRATION&54549985&THIS&99
12&SECURITIES&3434569&INVESTMENTS&3444


Can I break every single record into multiple records whenever & is encountered? My output file should contain

Code:

51133
ADMINISTRATION
54549985
THIS
99
12
SECURITIES
3434569
INVESTMENTS
3444


Thanks,
Karthik
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: Sun Dec 02, 2007 10:08 pm
Reply with quote

What is the RECFM and LRECL of the input file.

You show 5 fields in each input record. Does each input record always have 5 fields? Or can there be more or less fields in a record? If there can be more than 5 fields, what is the maximum number of fields you expect?

What is the maximum length of a single field?

Do you expect any blank fields, e.g. like the second field below:

Code:

ABC& &CDE
Back to top
View user's profile Send private message
karthikbabudh

New User


Joined: 08 Sep 2003
Posts: 32
Location: Toronto <-> Bangalore

PostPosted: Mon Dec 03, 2007 11:43 am
Reply with quote

Frank,

My input file is a FB file with LRECL of 133. Here is my original record:

ALLOC DSNAME('XED#DD.BNSS.ZZ.EN2) NEW -&SPACE(99,99) TRACKS -&LRECL(80) RECFM(F,B) BLKSIZE(800)
ALLOC DSNAME('XED#DD.BNSS.ZZ.FR11') NEW -&SPACE(99,99) TRACKS -&LRECL(80) RECFM(F,B) BLKSIZE(800)

All the records in the file will be having same number of fields as indicated above. Only difference between records will be the length of final qualifier in dataset name. For example, in the first record, it is "EN2" (3 characters) and in the second record, it is "FR11" (4 characters). This may vary from 2 to 8. There will not be any blank fields. I want output like

ALLOC DSNAME('XED#DD.BNSS.ZZ.EN2) NEW -
&SPACE(99,99) TRACKS -
&LRECL(80) RECFM(F,B) BLKSIZE(800)
ALLOC DSNAME('XED#DD.BNSS.ZZ.FR11') NEW -
&SPACE(99,99) TRACKS -
&LRECL(80) RECFM(F,B) BLKSIZE(800)

Hope I have answered your questions.

Thanks,
Karthik.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Mon Dec 03, 2007 3:20 pm
Reply with quote

Karthik,

Try this -

Code:
//S1    EXEC PGM=SORT                               
//SYSOUT  DD SYSOUT=*                               
//SORTIN DD DSN=I/PFILE   LRECL-ASSUMED=100         
//SORTOUT  DD SYSOUT=*                             
//SYSIN DD *                                       
  SORT FIELDS=COPY                                 
  OUTFIL IFTHEN=(WHEN=(33,2,CH,EQ,C''')'),         
           BUILD=(1,40,/,41,22,/,63,38)),           
         IFTHEN=(WHEN=(34,2,CH,EQ,C''')'),         
           BUILD=(1,41,/,42,22,/,64,37)),           
         IFTHEN=(WHEN=(35,2,CH,EQ,C''')'),         
           BUILD=(1,42,/,43,22,/,65,36)),           
         IFTHEN=(WHEN=(36,2,CH,EQ,C''')'),         
           BUILD=(1,43,/,44,22,/,66,35)),           
         IFTHEN=(WHEN=(37,2,CH,EQ,C''')'),         
           BUILD=(1,44,/,45,22,/,67,34)),           
         IFTHEN=(WHEN=(38,2,CH,EQ,C''')'),         
           BUILD=(1,45,/,46,22,/,68,33))           
/*                                                 


I/P:

Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
********************************* Top of Data ******************************************************
ALLOC DSNAME('XED#DD.BNSS.ZZ.EN234567') NEW -&SPACE(99,99) TRACKS -&LRECL(80)RECFM(F,B) BLKSIZE(800)
ALLOC DSNAME('XED#DD.BNSS.ZZ.EN23456') NEW -&SPACE(99,99) TRACKS -&LRECL(80)RECFM(F,B) BLKSIZE(800)
ALLOC DSNAME('XED#DD.BNSS.ZZ.EN2345') NEW -&SPACE(99,99) TRACKS -&LRECL(80)RECFM(F,B) BLKSIZE(800) 
ALLOC DSNAME('XED#DD.BNSS.ZZ.EN234') NEW -&SPACE(99,99) TRACKS -&LRECL(80)RECFM(F,B) BLKSIZE(800)
ALLOC DSNAME('XED#DD.BNSS.ZZ.EN23') NEW -&SPACE(99,99) TRACKS -&LRECL(80)RECFM(F,B) BLKSIZE(800)
ALLOC DSNAME('XED#DD.BNSS.ZZ.EN2') NEW -&SPACE(99,99) TRACKS -&LRECL(80)RECFM(F,B) BLKSIZE(800)


O/P:

Code:
ALLOC DSNAME('XED#DD.BNSS.ZZ.EN234567') NEW -                   
&SPACE(99,99) TRACKS -                                           
&LRECL(80)RECFM(F,B) BLKSIZE(800)                               
ALLOC DSNAME('XED#DD.BNSS.ZZ.EN23456') NEW -                     
&SPACE(99,99) TRACKS -                                           
&LRECL(80)RECFM(F,B) BLKSIZE(800)                               
ALLOC DSNAME('XED#DD.BNSS.ZZ.EN2345') NEW -                     
&SPACE(99,99) TRACKS -                                           
&LRECL(80)RECFM(F,B) BLKSIZE(800)                               
ALLOC DSNAME('XED#DD.BNSS.ZZ.EN234') NEW -                       
&SPACE(99,99) TRACKS -                                           
&LRECL(80)RECFM(F,B) BLKSIZE(800)                               
ALLOC DSNAME('XED#DD.BNSS.ZZ.EN23') NEW -                       
&SPACE(99,99) TRACKS -                                           
&LRECL(80)RECFM(F,B) BLKSIZE(800)                               
ALLOC DSNAME('XED#DD.BNSS.ZZ.EN2') NEW -                         
&SPACE(99,99) TRACKS -       
&LRECL(80)RECFM(F,B) BLKSIZE(800)   
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 Dec 03, 2007 10:45 pm
Reply with quote

Karthik,

Here's an easier way to do what you asked for with DFSORT's PARSE function:

Code:

//S1    EXEC  PGM=ICEMAN                                             
//SYSOUT    DD  SYSOUT=*                                             
//SORTIN DD DSN=Y897797.KARTH2.TEXT,DISP=SHR                         
//SORTOUT DD SYSOUT=*                                               
//SYSIN    DD    *                                                   
  OPTION COPY                                                       
  OUTFIL PARSE=(%01=(ENDBEFR=C'&',FIXLEN=80),                       
               %02=(SUBPOS=1,STARTAT=C'&',ENDBEFR=C'&',FIXLEN=80),   
               %03=(SUBPOS=1,STARTAT=C'&',FIXLEN=80)),               
    BUILD=(%01,/,%02,/,%03)                                         
Back to top
View user's profile Send private message
karthikbabudh

New User


Joined: 08 Sep 2003
Posts: 32
Location: Toronto <-> Bangalore

PostPosted: Mon Dec 03, 2007 11:48 pm
Reply with quote

Murali,

Thanks, and this is what I want. Just for curiosity, if the input record contains many fields whose length is not consistent, (in my case, it is one field and is easy to code 6 IFs), what would be the solution?

Thanks,
Karthik.
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 Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top