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

DFSORT split long VB lines efficiently


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

New User


Joined: 12 Feb 2016
Posts: 4
Location: NZ

PostPosted: Fri Feb 12, 2016 5:10 am
Reply with quote

Hi
I have a VB file LRECL 5014 which I need to limit to an LRECL of 256. Most of the records are less than 256 but some aren't. The output file needs to be VB.

I need to find lines that are longer than 256 and split them up into 256 chunks with an intervening line with something like 'SPLIT LINE' on it so I can tell which lines have been split - This file is going to be emailed and then the long lines need to be put back together - hence the **SPLIT** for ease of finding the rows that were chopped up.

I've figure out a way to do it - but it is quite clunky and is going to be long as I will need about 20 IFTHEN statements. I have got the basics working (breaking it up into lengths of 100 for testing purposes).
Code:

//SRTNVAS  EXEC PGM=SORT                                     
//SYSOUT   DD  SYSOUT=*                                     
//SORTIN   DD  DISP=SHR,DSN=&URTHLQ..INPUT.TEXT             
//SORTOUT  DD  DISP=(SHR),                                   
//         DSN=&URTHLQ..TEST.&DATE..TXT,                     
//         RECFM=VB,SPACE=(TRK,(2,1)),UNIT=SYSDA             
//SYSIN    DD  *                                             
  OPTION COPY                                               
  OUTFIL IFTHEN=(WHEN=(1,2,BI,GT,300),                       
          BUILD=(1,4,5,100,                                 
                /,1,4,C'**SPLIT**',/,1,4,105,               
                /,1,4,C'**SPLIT**',/,1,4,205,               
                /,1,4,C'**SPLIT**',/,1,4,305)),             
         IFTHEN=(WHEN=(1,2,BI,GT,200),                       
          BUILD=(1,4,5,100,                                 
                /,1,4,C'**SPLIT**',/,1,4,105,               
                /,1,4,C'**SPLIT**',/,1,4,205)),             
         IFTHEN=(WHEN=(1,2,BI,GT,100),                       
          BUILD=(1,4,5,100,/,1,4,C'**SPLIT**',/,1,4,105)),   
         IFTHEN=(WHEN=(1,2,BI,LT,100),                       
          BUILD=(1,4,5))                                     
/*     

Any ideas how I could do this better?
Thanks
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 12, 2016 6:40 am
Reply with quote

There are no looping constructs. ICETOOL's RESIZE only works with fixed-length records, and would require a second pass of the data at least.

You need to specify a length in all but the final record of each IFTHEN. At the moment, you are writing out longer records than you think.

If your output needs to be 256, and you have that long "marker", you're going to need to have less data in each output record.

What about records which are 100 bytes long in your example? It doesn't really matter, as you have it. The final IFTHEN is redundant (it BUILDs a record to its exact original condition - so no need to bother).

You've got a lot of repetition. I'd use symbols/SYMNAMES which will reduce nasty typos, and aid testing with different-sized data. It will also make it clearer what you code is doing.

So, 20 IFTHENs (or so). Define the symbols, make the first IFTHEN, then it is just an editor-job to make the remaining ones.
Back to top
View user's profile Send private message
BridgetBrackenbury

New User


Joined: 12 Feb 2016
Posts: 4
Location: NZ

PostPosted: Wed Feb 17, 2016 6:26 am
Reply with quote

Thanks for your help - endee up using Rexx so I could do loops. But it was a good learning expeience
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
Search our Forums:

Back to Top