Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

DFSORT split long VB lines efficiently

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: DFSORT split long VB lines efficiently
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Feb 12, 2016 6:40 am    Post subject: Reply to: DFSORT split long VB lines efficiently
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us