mainframeispf

Insert data at specific column in mainframe dataset


I need a insert a data from Mainframe dataset (A) to different dataset(B) starting from a specific column. e.g. First dataset 'A' has following data

  Command ===>                
  *****************************
  1205271                      
  1205251                      
  6483068                      
  1205257                      

Second Dataset 'B' has following data

 ----+----7----+----8----+----9----+----0----+----1----+----2----+----
 ********************************* Top of Data ***********************
  EMPLOYER FFFF MMMMMMMM       TTTT    D                        
  EMPLOYER SSSS                TTTT    D                        
  FEDERAL UUUUUUUUUUU XXX      TTTT    D                        
  MI STATE UUUUUUUUUUU         TTTT    D                        
  NN STATE UUUUUUUUUUU         TTTT    D    

Finally dataset B should look like below i.e. dataset 'A' data has been inserted in 'B' starting from column '105'.

 ----+----7----+----8----+----9----+----0----+----1----+----2----+----
 ********************************* Top of Data ***********************
  EMPLOYER FFFF MMMMMMMM       TTTT    D     1205271                   
  EMPLOYER SSSS                TTTT    D     1205271                   
  FEDERAL UUUUUUUUUUU XXX      TTTT    D     6483068                   
  MI STATE UUUUUUUUUUU         TTTT    D     1205257                   
  NN STATE UUUUUUUUUUU         TTTT    D        

Please let me know your suggestion. Thanks Ashish


Solution

  • Assuming that your LRECL in the file you want to include the data in is already long enough:

    Edit your target file
    On the command-line `COPY your-source-file`
    In the line-command area, put `a ` in the asterisks before for first line of your file
    ENTER
    Take note of how many lines were copied (look at the line-numbers and calculate if necessary)
    Type BNDS in a line-command area
    ENTER
    Scroll right (usually PF11) to see that your BNDS is not before the end of the final data position that you want
    Type the "destructive shift right" edit symbol `)` in block-mode `))` on the first line of your inserted data
    Do the same with the last line of your inserted data
    After one of the `))` type 104, the number of columns you want to shift column one by (final position, less one)
    ENTER 
    Use the "move line-command symbol" `m` in block mode `mm` and mark the first and last line of the newly inserted data
    Use the "overlay line-command symbol" `o` followed by the previously-noted number of lines copied and mark the original first line of your file
    ENTER
    Job done
    

    Remember, as long as you have RECOVERY ON you can UNDO changes to a file before it is SAVEd (remember also that END automatically saves the file).

    Command ===> copy temp                                        Scroll ===> CSR
    a***** ***************************** Top of Data ******************************
    =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
    =BNDS> <                                                                      >
    000100 EMPLOYER FFFF MMMMMMMM       TTTT    D 
    000200 EMPLOYER  SSSS               TTTT    D 
    000300 FEDERAL  UUUUUUUUUUU XXX     TTTT    D 
    000400 MI  STATE UUUUUUUUUUU        TTTT    D 
    000500 NN  STATE UUUUUUUUUUU        TTTT    D 
    ****** **************************** Bottom of Data ****************************
    


    Command ===>                                                  Scroll ===> CSR
    ****** ***************************** Top of Data ******************************
    )) 010 1205271 
    000020 1205251 
    000030 6483068 
    ))39 0 1205257 
    =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
    =BNDS> <                                                                      >
    000100 EMPLOYER FFFF MMMMMMMM       TTTT    D 
    000200 EMPLOYER  SSSS               TTTT    D 
    000300 FEDERAL  UUUUUUUUUUU XXX     TTTT    D 
    000400 MI  STATE UUUUUUUUUUU        TTTT    D 
    000500 NN  STATE UUUUUUUUUUU        TTTT    D 
    


    Command ===>                                                  Scroll ===> CSR
    ****** ***************************** Top of Data ******************************
    000001                                        1205271 
    000002                                        1205251 
    000003                                        6483068 
    000004                                        1205257 
    =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
    =BNDS> <                                                                      >
    000100 EMPLOYER FFFF MMMMMMMM       TTTT    D 
    000200 EMPLOYER  SSSS               TTTT    D 
    000300 FEDERAL  UUUUUUUUUUU XXX     TTTT    D 
    000400 MI  STATE UUUUUUUUUUU        TTTT    D 
    000500 NN  STATE UUUUUUUUUUU        TTTT    D 
    


    Command ===>                                                  Scroll ===> CSR
    ****** ***************************** Top of Data ******************************
    mm 001                                        1205271 
    000002                                        1205251 
    000003                                        6483068 
    mm 004                                        1205257 
    =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
    =BNDS> <                                                                      >
    o4 100 EMPLOYER FFFF MMMMMMMM       TTTT    D 
    000200 EMPLOYER  SSSS               TTTT    D 
    000300 FEDERAL  UUUUUUUUUUU XXX     TTTT    D 
    000400 MI  STATE UUUUUUUUUUU        TTTT    D 
    000500 NN  STATE UUUUUUUUUUU        TTTT    D 
    

    Then it looks like this (I've used an example value for the column I wanted, 40):

    Command ===>                                                  Scroll ===> CSR
    ****** ***************************** Top of Data ******************************
    =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
    =BNDS> <                                                                      >
    000100 EMPLOYER FFFF MMMMMMMM       TTTT    D 1205271 
    000200 EMPLOYER  SSSS               TTTT    D 1205251 
    000300 FEDERAL  UUUUUUUUUUU XXX     TTTT    D 6483068 
    000400 MI  STATE UUUUUUUUUUU        TTTT    D 1205257 
    000500 NN  STATE UUUUUUUUUUU        TTTT    D