Page 1 of 1

Parse VB file to FB

PostPosted: Sat Sep 05, 2020 12:55 pm
by MFDEV
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.

Re: Parse VB file to FB

PostPosted: Sat Sep 05, 2020 3:04 pm
by NicC
Please use the code tags when posting code and data. Coded for you this time.

Re: Parse VB file to FB

PostPosted: Sat Sep 05, 2020 3:17 pm
by MFDEV
Thanks Nic, I will do next time onwards.

Re: Parse VB file to FB

PostPosted: Wed Sep 09, 2020 9:49 pm
by MFDEV
Any views on this problem?

Thanks.

Re: Parse VB file to FB

PostPosted: Wed Sep 09, 2020 10:10 pm
by prino
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!

Re: Parse VB file to FB

PostPosted: Wed Sep 09, 2020 10:23 pm
by sergeyken
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”

Re: Parse VB file to FB

PostPosted: Fri Sep 11, 2020 9:04 am
by MFDEV
Many Thanks sergeyken.