Parse VB file to FB



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Parse VB file to FB

Postby MFDEV » Sat Sep 05, 2020 12:55 pm

Hi,

Input file: VB - lrecl - 255

The sample input data :

ID_ID,ID_SIZE,LENGTH.100000000,200,5.100000001,300,6.100000002,100,3.100000
003,10000,5.100000004,10000,1.100000005,10000,5.
 

Output file: FB - 95

The below is expected output.

ID_ID     ID_SIZE LENGTH
100000000 200       5
100000001 300       6
100000002 100       3
100000003 10000     5
100000004 10000     1
100000005 10000     5


Code:

INREC IFTHEN=(WHEN=INIT,                  
      PARSE=(%0=(ENDBEFR=X'05',FIXLEN=20),   * ID_ID,ID_SIZE,LENGTH
             %1=(ENDBEFR=X'05',FIXLEN=15)),  * 100000000,200,5.100000001

BUILD=(1,4,                      
       %0,                        
       %1,                        
       80:X)),                    
IFTHEN=(WHEN=INIT,                
 FINDREP=(IN=C',',OUT=C' ',      
          STARTPOS=5,ENDPOS=95)),
  OPTION COPY                          
*                                      
  OUTREC BUILD=(1:1,4,                  
                5:5,75,                
               95:X)                    
*                                      
  OUTFIL BUILD=(5,36,/,42,15,95:X),VTOF
 END                                    



ID_ID     ID_SIZE LENTH
100000000 100 8
003 10000 5.100000004 10000 1.100000005


Please suggest.
MFDEV
 
Posts: 15
Joined: Mon Dec 01, 2014 3:25 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Parse VB file to FB

Postby NicC » Sat Sep 05, 2020 3:04 pm

Please use the code tags when posting code and data. Coded for you this time.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Parse VB file to FB

Postby MFDEV » Sat Sep 05, 2020 3:17 pm

Thanks Nic, I will do next time onwards.
MFDEV
 
Posts: 15
Joined: Mon Dec 01, 2014 3:25 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Parse VB file to FB

Postby MFDEV » Wed Sep 09, 2020 9:49 pm

Any views on this problem?

Thanks.
MFDEV
 
Posts: 15
Joined: Mon Dec 01, 2014 3:25 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Parse VB file to FB

Postby prino » Wed Sep 09, 2020 10:10 pm

MFDEV wrote:Any views on this problem?

People here answer if they want to answer. If you need a solution hire an expert and pay for him or her!
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 641
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 29 times

Re: Parse VB file to FB

Postby sergeyken » Wed Sep 09, 2020 10:23 pm

You need two SORT passes ( either two JCL steps, or two phases in ICETOOL/SYNCTOOL):

1) split input data to get one DATA ROW per one DATASET RECORD (split by X’05’)

2) split each “really logical” record by C’,’ - to produce “vertical data columns”
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 436
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: Parse VB file to FB

Postby MFDEV » Fri Sep 11, 2020 9:04 am

Many Thanks sergeyken.
MFDEV
 
Posts: 15
Joined: Mon Dec 01, 2014 3:25 pm
Has thanked: 2 times
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post