IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

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: 7312
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 All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Need to split single line into two li... DFSORT/ICETOOL 7
No new posts Join lines with dfsort DFSORT/ICETOOL 5
No new posts Read 4MB message and split into multi... COBOL Programming 9
No new posts Covert k to 1000 / m to 1000000 using... DFSORT/ICETOOL 5
No new posts using TXT2PDF to colour specific lines All Other Mainframe Topics 3

Back to Top