Search code examples
mainframe

Mainframe Dataset


I have a sequential dataset which has some data formatted in columns. suppose below is the format of my dataset.

Emp_ID    Emp_name     Emp_addr
---------------------------------

I want to remove the column Emp_Name from the dataset. Can I do it without writing the COBOL program? Please let me know if we have any command to do the same.

Thanks and Regards, Manasi Kulkarni.


Solution

  • You can use SORT to eliminate bytes from your sequential file.

    Let's assume the following format:

    Employee ID        Bytes 1 - 10
    Employee Name      Bytes 11 - 40
    Employee Address   Bytes 41 - 70    
    

    We want to eliminate the Employee Name. We want to copy the first 10 bytes, skip the next 30 bytes, and copy the last 30 bytes.

    The input sequential file is 70 bytes and the output sequential file will be 40 bytes.

    Here's the SORT JCL to perform this task. You'll need to modify the JCL to conform to the standards of your mainframe shop.

    //EXAMP    JOB A400,PROGRAMMER
    //COPY     EXEC PGM=SORT
    //SYSOUT   DD SYSOUT=*
    //SORTIN   DD DSN=SMF.DATA,DISP=SHR
    //SORTOUT  DD DSN=SMF.COPY,DISP=(,KEEP),SPACE=(CYL,(2,5))
    //            UNIT=SYSDA
    //SYSIN    DD * 
     OPTION COPY
     OUTREC FIELDS=(1,10,41,30)
    /*
    //
    

    The OUTREC statement says to copy starting from byte 1 for 10 bytes, and from byte 41 for 30 bytes, for a total of 40 bytes.

    Here's IBM's DFSORT manual for more information.