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

Split string x(255) into n parts of x(40) using sort


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

New User


Joined: 11 Jun 2009
Posts: 8
Location: Atlanta, GA

PostPosted: Mon Jun 22, 2009 3:12 pm
Reply with quote

I/P RECFM=FB AND LRECL=260

Fields:
Line_nbr pic 9(7).
Notes pic x(253).

Input file :
Code:
Line_nbr Notes 
       1 AAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
       2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
       3 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
       4 DDDDDDDDDDDDDDDDDDDDD  DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
       5 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT


Need to split the Notes of pic x(253) into n parts of x(40) based on the content in the Notes. seq_nbr inserted between Line_nbr and Notes to differentiate it.

O/P RECFM=FB, LRECL=50
Fields:
Line_nbr pic 9(7).
Seq_nbr pic 9(3).
Notes pic x(40).

o/p file :

Code:
Line_nbr Seq_nbr Notes 
       1     1   AAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA
       1     2   AAAAAAAAAAAAAAAAAAAAAAAAA
       2     1   BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
       2     2   BBBBBBBBBBBBBBBBB
       3     1   CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
       4     1   DDDDDDDDDDDDDDDDDDDDD  DDDDDDDDDDDDDDDDD
       4     2   DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
       5     1   TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
       5     2   TTTTTTTTT


Thanks
Denny
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 Jun 22, 2009 9:52 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (FB/260)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/50)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,
    BUILD=(1,7,C'  1',8,40,/,
           1,7,C'  2',48,40,/,
           1,7,C'  3',88,40,/,
           1,7,C'  4',128,40,/,
           1,7,C'  5',168,40,/,
           1,7,C'  6',208,40,/,
           1,7,C'  7',248,13)
/*
//CTL2CNTL DD *
  OMIT COND=(11,40,CH,EQ,C' ')
/*
Back to top
View user's profile Send private message
archer_denny

New User


Joined: 11 Jun 2009
Posts: 8
Location: Atlanta, GA

PostPosted: Tue Jun 23, 2009 1:47 pm
Reply with quote

it works... Thanks Frank

Thanks
Denny
"The / (0 blank lines) in the middle is used to create two output records from each input record".
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top