Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
archer_denny

New User

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

Posted: Mon Jun 22, 2009 3:12 pm    Post subject: Split string x(255) into n parts of x(40) using sort

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

Frank Yaeger

DFSORT Moderator

Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

Posted: Mon Jun 22, 2009 9:52 pm    Post subject:

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' ') /*
archer_denny

New User

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

 Posted: Tue Jun 23, 2009 1:47 pm    Post subject: Reply to: Split string x(255) into n parts of x(40) using so it works... Thanks Frank Thanks Denny "The / (0 blank lines) in the middle is used to create two output records from each input record".
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us