merge 4 VB records from 4 differnt files into single VB file



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

merge 4 VB records from 4 differnt files into single VB file

Postby hariharan_bk » Thu Sep 18, 2014 5:33 pm

Input File1: (VB)
********************************* Top of Data **
TRL,V05,00,201409,20140831,                     
******************************** Bottom of Data


Input File 2: (VB)
*********************
   000000000002788   
*********************


Input File3: (VB)
********************
   000000000446967 
********************


Input File4:(VB)
*******************
000071355053       
*******************



EXPECTED OUTPUT file (VB) :
TRL,V05,00,201409,20140831,000000000000446967,000000000000002788, 00000000071355053   


I want to merge these four records from four different files into a single VB file.

Could you please help us here.

Following is the approach i tried...

//TOOLIN DD *                                       
  RESIZE FROM(IN) TO(OUT) TOLEN(540) USING(CTL1)   
/*                                                 
//CTL1CNTL DD *                                     
  INREC BUILD=(1,4,5,180)                           
  OUTFIL BUILD=(1,4,5,540,SQZ=(SHIFT=LEFT,MID=C' '))
/*                                                 


and following is the error i got..
SYT220E  RESIZE "FROM" DATASET NOT FIXED LENGTH RECORD FORMAT


Please advise.
Many Thanks,
Harry
hariharan_bk
 
Posts: 73
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Re: merge 4 VB records from 4 differnt files into single VB

Postby BillyBoyo » Thu Sep 18, 2014 6:51 pm

As you have discovered, RESIZE is for fixed-length records only.

I'd look at using SORT with WHEN=GROUP on INREC to PUSH the entire original content of each record to a fixed location for each of the separate records. You'll need to use WHEN=INIT to allocate a sequence number at the start of each record, then code four GROUPs which BEGIN on the relevant sequence number value.

On OUTFIL, you'll need to add an INCLUDE to get the fourth record only (which by then will include all the data) and the BUILD will be include the RDW, re-locate the data to the front of the record, then do the SQZ. It looks like you can use MID=C',' to get your commas. Use VLTRIM to get rid of trailing blanks.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: merge 4 VB records from 4 differnt files into single VB

Postby hariharan_bk » Thu Sep 18, 2014 7:13 pm

Thanks BillyBoyo..

To be frank, I have even tried WHEN=GROUP syntax, but got confused on how to get this done for VB records.

Hence i was not able to proceed further.. Can u help here
Many Thanks,
Harry
hariharan_bk
 
Posts: 73
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Re: merge 4 VB records from 4 differnt files into single VB

Postby BillyBoyo » Thu Sep 18, 2014 8:29 pm

You need to first add a sequence number. For a variable-length record, you do that starting in position five. You only have four records, so it can be one digit.

BUILD=(1,4,sequence-of-one-digit,5)


The lonely 5 at the end says "from position five to the end of the record".

Now you can know which record you have, by testing for 5,1 (that's a new 5, containing the sequence number) for 1, 2, 3 or 4.

You do a WHEN=GROUP for sequence 1, with RECORDS=4. You start the PUSH at a position which will not clash with any data.

If your largest LRECL is 20, then PUSH=(25:6,length-4),RECORDS=4.

You do the second GROUP with a PUSH which starts after the data you have just PUSHed from the previous record, RECORDS=3.

One more GROUP in a similar way, data starting at next available position (which you have to calculate).

Then with the OUTFIL, you only want the 4th record, so INCLUDE= for that. IFTHEN=(WHEN=INIT to BUILD the record you want, then a second WHEN=INIT to OVERLAY (or BUILD) to do the JFY. VLTRIM to finish off.

a-data
b-data
c-data
d-data

1 a-data a-data
2 b-data a-data b-data
3 c-data a-data b-data c-data
4 d-data a-data b-data c-data


That's a representation of your input data, then the input to OUTFIL.

Do it bit-by-bit, and follow how it is working. If you get stuck, show what you've don't and we'll get you further on.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: merge 4 VB records from 4 differnt files into single VB

Postby hariharan_bk » Fri Sep 19, 2014 12:09 am

Thanks BillyBoyo.. Will update you once after trying this
Many Thanks,
Harry
hariharan_bk
 
Posts: 73
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Re: merge 4 VB records from 4 differnt files into single VB

Postby hariharan_bk » Mon Sep 22, 2014 4:42 pm

Hi BillyBoyo/team,

1TRL,V05,00,201409,20140831,
2   000000000446967         
3   000000000002788         
4000071355053               


Following are the VB records which are to be merged as single record with comma as delimiter for every record merge.
I have included seq num as suggested by you in the 5th byte.

Not sure how to frame the SYSIN Card to serve the purpose. Could you please help.
//SYSIN   DD *                                             
  INREC IFTHEN=(WHEN=GROUP,RECORDS=4,PUSH=(               
        IFTHEN=(WHEN=(5,1,ZD,EQ,1),BUILD=(                 



expected output:

1TRL,V05,00,201409,20140831, 000000000446967,000000000002788,000071355053                   
Many Thanks,
Harry
hariharan_bk
 
Posts: 73
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Re: merge 4 VB records from 4 differnt files into single VB

Postby BillyBoyo » Mon Sep 22, 2014 11:20 pm

First step is to add a sequence number, one digit, between the RDW (bytes 1,4 of a variable-length record) and your data (for which you specify 5).

Run that, so you see the sequence numbers 1, 2, 3 and 4.

Then add IFTHEN=(WHEN=GROUP,BEGIN=(5,1,CH,EQ,C'1'),RECORDS=4,PUSH=(33:5,29)).

You should see now the data from the first record repeated on that record and on all the following records.

Repeat that for 2 and 3 (with decreasing RECORDS=).

By then, you should end with record number 4 having all the data on. See how it goes to get that far.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: merge 4 VB records from 4 differnt files into single VB

Postby hariharan_bk » Tue Sep 23, 2014 12:40 am

Thanks. will try this in office hours tomo.

Thanks for your patience too
Many Thanks,
Harry
hariharan_bk
 
Posts: 73
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Re: merge 4 VB records from 4 differnt files into single VB

Postby hariharan_bk » Tue Sep 23, 2014 4:17 pm

I tried this and got the record merge for one record with no issues.. but couldnt proceed further for subsequent 3 records.

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data ******************
1TRL,V05,00,201409,20140831,1TRL,V05,00,201409,20140831,       
2   000000000446967         1TRL,V05,00,201409,20140831, 
3   000000000002788         1TRL,V05,00,201409,20140831,       
4000071355053               1TRL,V05,00,201409,20140831,       
******************************** Bottom of Data ****************


Following is the sysin card used

 SYSIN :                                                     
    OPTION COPY                                               
    INREC IFTHEN=(WHEN=GROUP,RECORDS=4,BEGIN=(5,1,CH,EQ,C'1'),
    PUSH=(33:5,28)),                                         
          IFTHEN=(WHEN=GROUP,RECORDS=3,BEGIN=(5,1,CH,EQ,C'2'),                       <----
    PUSH=(60:5,19))                                                                                <----
    OUTFIL INCLUDE=(5,1,ZD,LE,4),BUILD=(1,4,5:5,74,12005:X)     


pointed rows are the ones i have included after generating the above output, to get the subsequent merges.
But got this error - which i am unable to resolve.
WER146B  20K BYTES OF EMERGENCY SPACE ALLOCATED                               
WER108I  SORTIN   : RECFM=VB   ; LRECL= 12005; BLKSIZE= 27998                 
WER073I  SORTIN   : DSNAME=V523241.PREM.GH05.MERGTRL1                         
WER257I  INREC RECORD LENGTH = 12005                                           
WER110I  SORTOUT  : RECFM=VB   ; LRECL= 12005; BLKSIZE= 27998                 
WER074I  SORTOUT  : DSNAME=V523241.PREM.GH05.FINALTR1                         
WER552I  THIS COPY STEP COULD RUN WITH SIGNIFICANTLY LESS CPU AND ELAPSED TIME
WER410B  5,868K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,       
WER410B     0 BYTES RESERVE REQUESTED, 2,300,355 BYTES USED                   
WER244A  SORTOUT  OUTREC - SHORT RECORD                                       
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
******************************* BOTTOM OF DATA ********************************



Can you please help here..
Many Thanks,
Harry
hariharan_bk
 
Posts: 73
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Re: merge 4 VB records from 4 differnt files into single VB

Postby hariharan_bk » Tue Sep 23, 2014 4:29 pm

Tried these SYSIN cards as well.. but nothing worked out. getting the same "SORTOUT OUTREC - SHORT RECORD " error. Please help me to resolve this

OPTION COPY
INREC IFTHEN=(WHEN=GROUP,RECORDS=4,BEGIN=(5,1,CH,EQ,C'1'),
PUSH=(33:5,28)),
IFTHEN=(WHEN=GROUP,RECORDS=3,BEGIN=(5,1,CH,EQ,C'2'),
PUSH=(61:5,19))
OUTFIL INCLUDE=(5,1,ZD,LE,4),BUILD=(1,4,5:5,75,12005:X)

and....

OPTION COPY
INREC IFTHEN=(WHEN=GROUP,RECORDS=4,BEGIN=(5,1,CH,EQ,C'1'),
PUSH=(33:5,28)),
IFTHEN=(WHEN=GROUP,RECORDS=3,BEGIN=(5,1,CH,EQ,C'2'),
PUSH=(61:5,19))
OUTFIL INCLUDE=(5,1,ZD,LE,4),BUILD=(1,4,5:5,76,12005:X)

highlighted the changes in BOLD....
Many Thanks,
Harry
hariharan_bk
 
Posts: 73
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post