tags:

views:

56

answers:

2

Hi,

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.

+3  A: 

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.

Gilbert Le Blanc
Thanks a lot Gilbert :) I will try this out.
Manasi
+1 for giving a correct solution plus a link to the appropriate reference manual so the OP can do their own follow up.
NealB
A: 

You could also use IEBGENER to reformat the data as follows:

//FORMAT   EXEC PGM=IEBGENER     
//SYSPRINT DD SYSOUT=*           
//SYSUT1   DD *                  
EMP_ID    EMP_NAME     EMP_ADDR  
---------------------------------
120       FIRST        NEW ROAD  
130       SECOND       OLD ROAD  
/*                               
//SYSUT2   DD SYSOUT=*           
//SYSIN    DD *                  
  GENERATE MAXFLDS=99,MAXLITS=99 
  RECORD       FIELD=(10,1,,1),  
               FIELD=(30,24,,11) 
/*                               
//                               

Further details to IEBGENER command syntax can be found here.

Stefan